Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Arthorne2007-09-30 18:11:02 +0000
committerJohn Arthorne2007-09-30 18:11:02 +0000
commit2ccb446cc885495686cc9eb430c4a98031b3cfc5 (patch)
tree207e30d5f61856ece926ed3548297aa3958132c9
parentc4f6662ccd02bb75cba95a6ae56a2da38c6cadde (diff)
downloadrt.equinox.p2-2ccb446cc885495686cc9eb430c4a98031b3cfc5.tar.gz
rt.equinox.p2-2ccb446cc885495686cc9eb430c4a98031b3cfc5.tar.xz
rt.equinox.p2-2ccb446cc885495686cc9eb430c4a98031b3cfc5.zip
Renamed prov bundles to p2
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/.classpath7
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/.project28
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/.settings/org.eclipse.jdt.core.prefs343
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/.settings/org.eclipse.jdt.ui.prefs57
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/.settings/org.eclipse.pde.core.prefs4
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/META-INF/MANIFEST.MF29
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/about.html28
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/build.properties16
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/plugin.xml21
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/schema/artifactRepositories.exsd124
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/schema/processingSteps.exsd110
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/Activator.java39
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/ArtifactRepositoryIO.java74
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/ArtifactRepositoryManager.java296
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/ArtifactRequest.java90
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/ECFTransport.java128
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/FileDownloadRequest.java41
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/MirrorRequest.java73
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/SignatureVerifier.java81
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/SimpleArtifactRepository.java333
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/SimpleArtifactRepositoryFactory.java46
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/Unpack200Step.java103
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/ArtifactDescriptor.java98
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/IArtifactDescriptor.java29
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/IArtifactRepository.java73
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/IArtifactRepositoryFactory.java20
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/IArtifactRepositoryManager.java85
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/IArtifactRequest.java33
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/IWritableArtifactRepository.java56
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/Mapper.java130
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/RepositoryDescriptor.java39
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/Transport.java19
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/processing/ProcessingStep.java116
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/processing/ProcessingStepDescriptor.java86
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/processing/ProcessingStepHandler.java74
-rw-r--r--bundles/org.eclipse.equinox.p2.console/.classpath7
-rw-r--r--bundles/org.eclipse.equinox.p2.console/.project28
-rw-r--r--bundles/org.eclipse.equinox.p2.console/.settings/org.eclipse.jdt.core.prefs340
-rw-r--r--bundles/org.eclipse.equinox.p2.console/.settings/org.eclipse.jdt.ui.prefs57
-rw-r--r--bundles/org.eclipse.equinox.p2.console/META-INF/MANIFEST.MF29
-rw-r--r--bundles/org.eclipse.equinox.p2.console/Provisioning console.launch19
-rw-r--r--bundles/org.eclipse.equinox.p2.console/build.properties14
-rw-r--r--bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/prov/console/Activator.java77
-rw-r--r--bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/prov/console/ProvCommandProvider.java345
-rw-r--r--bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/prov/console/ProvisioningHelper.java288
-rw-r--r--bundles/org.eclipse.equinox.p2.core/.classpath7
-rw-r--r--bundles/org.eclipse.equinox.p2.core/.project28
-rw-r--r--bundles/org.eclipse.equinox.p2.core/.settings/org.eclipse.jdt.core.prefs331
-rw-r--r--bundles/org.eclipse.equinox.p2.core/.settings/org.eclipse.jdt.ui.prefs57
-rw-r--r--bundles/org.eclipse.equinox.p2.core/.settings/org.eclipse.pde.core.prefs4
-rw-r--r--bundles/org.eclipse.equinox.p2.core/META-INF/MANIFEST.MF27
-rw-r--r--bundles/org.eclipse.equinox.p2.core/about.html28
-rw-r--r--bundles/org.eclipse.equinox.p2.core/build.properties15
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/prov/core/Activator.java176
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/prov/core/BasicLocation.java226
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/prov/core/Locker.java22
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/prov/core/Locker_JavaIo.java53
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/prov/core/Locker_JavaNio.java66
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/prov/core/Messages.java30
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/prov/core/messages.properties10
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/ProvisionException.java23
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/eventbus/ProvisioningEventBus.java81
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/eventbus/ProvisioningListener.java18
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/eventbus/SynchronousProvisioningListener.java15
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/ArrayUtils.java58
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/FileUtils.java212
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/Headers.java300
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/LogHelper.java60
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/Messages.java27
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/MultiStatus.java258
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/MultiStatusUtil.java244
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/OrderedProperties.java163
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/ServiceHelper.java46
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/TwoTierMap.java354
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/UnmodifiableProperties.java44
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/Utils.java56
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/messages.properties15
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/location/AgentLocation.java27
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/repository/AbstractRepository.java110
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/repository/IRepositoryInfo.java82
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/repository/IWritableRepositoryInfo.java56
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/repository/RepositoryCreationException.java21
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/.classpath7
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/.cvsignore1
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/.project28
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/.settings/org.eclipse.jdt.core.prefs331
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/.settings/org.eclipse.jdt.ui.prefs57
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/META-INF/MANIFEST.MF23
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/build.properties15
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/config.ini87
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/director app.launch23
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/director.product30
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/plugin.xml18
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/prov/internal/director/app/Activator.java38
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/prov/internal/director/app/Application.java201
-rw-r--r--bundles/org.eclipse.equinox.p2.director/.classpath7
-rw-r--r--bundles/org.eclipse.equinox.p2.director/.cvsignore1
-rw-r--r--bundles/org.eclipse.equinox.p2.director/.project28
-rw-r--r--bundles/org.eclipse.equinox.p2.director/.settings/org.eclipse.jdt.core.prefs331
-rw-r--r--bundles/org.eclipse.equinox.p2.director/.settings/org.eclipse.jdt.ui.prefs57
-rw-r--r--bundles/org.eclipse.equinox.p2.director/.settings/org.eclipse.pde.core.prefs4
-rw-r--r--bundles/org.eclipse.equinox.p2.director/META-INF/MANIFEST.MF25
-rw-r--r--bundles/org.eclipse.equinox.p2.director/about.html28
-rw-r--r--bundles/org.eclipse.equinox.p2.director/build.properties15
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/prov/director/BasicIUFilter.java28
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/prov/director/DirectorActivator.java28
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/prov/director/IUFilter.java17
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/prov/director/IUTransformationHelper.java35
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/prov/director/Messages.java44
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/prov/director/OperationGenerator.java126
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/prov/director/Picker.java129
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/prov/director/RequirementBasedFilter.java28
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/prov/director/messages.properties28
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/prov/rollback/FormerState.java75
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/prov/director/IDirector.java54
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/prov/director/NewDependencyExpander.java573
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/prov/director/NewSimpleDirector.java329
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/prov/director/Oracle.java164
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/prov/director/TrackedHashSet.java44
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/prov/director/director.txt30
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/.classpath7
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/.project28
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/.settings/org.eclipse.jdt.core.prefs334
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/.settings/org.eclipse.jdt.ui.prefs57
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/.settings/org.eclipse.pde.core.prefs4
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/META-INF/MANIFEST.MF28
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/about.html28
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/build.properties16
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/plugin.xml13
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/schema/touchpoints.exsd158
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/prov/engine/CommonDef.java63
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/prov/engine/EngineActivator.java64
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/prov/engine/Messages.java44
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/prov/engine/NullTouchpoint.java43
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/prov/engine/TouchpointManager.java223
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/prov/engine/messages.properties29
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/AbstractProvisioningTransaction.java135
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/BeginOperationEvent.java20
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/CommitOperationEvent.java20
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/DefaultPhaseSet.java21
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/Engine.java83
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/EngineSession.java33
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/IProfileRegistry.java53
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/IProvisioningAction.java36
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/ITouchpoint.java26
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/ITouchpointAction.java18
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/IUPhase.java100
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/InstallableUnitEvent.java68
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/Operand.java35
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/Phase.java61
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/PhaseSet.java64
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/Profile.java142
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/ProfileEvent.java36
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/ProvisioningConfigurationException.java21
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/RollbackOperationEvent.java28
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/SimpleProfileRegistry.java184
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/TransactionEvent.java30
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/Utils.java25
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/phases/Collect.java76
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/phases/Install.java60
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/phases/Messages.java33
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/phases/Uninstall.java58
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/phases/messages.properties17
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/installregistry/IInstallRegistry.java171
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/installregistry/IProfileInstallRegistry.java27
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/installregistry/InstallRegistry.java181
-rw-r--r--bundles/org.eclipse.equinox.p2.exemplarysetup/.classpath7
-rw-r--r--bundles/org.eclipse.equinox.p2.exemplarysetup/.project28
-rw-r--r--bundles/org.eclipse.equinox.p2.exemplarysetup/.settings/org.eclipse.jdt.core.prefs339
-rw-r--r--bundles/org.eclipse.equinox.p2.exemplarysetup/.settings/org.eclipse.jdt.ui.prefs57
-rw-r--r--bundles/org.eclipse.equinox.p2.exemplarysetup/.settings/org.eclipse.pde.core.prefs4
-rw-r--r--bundles/org.eclipse.equinox.p2.exemplarysetup/META-INF/MANIFEST.MF20
-rw-r--r--bundles/org.eclipse.equinox.p2.exemplarysetup/about.html28
-rw-r--r--bundles/org.eclipse.equinox.p2.exemplarysetup/build.properties15
-rw-r--r--bundles/org.eclipse.equinox.p2.exemplarysetup/src/org/eclipse/equinox/internal/prov/examplarysetup/Activator.java137
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.generator/.classpath7
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.generator/.cvsignore2
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.generator/.project28
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.generator/.settings/org.eclipse.jdt.core.prefs331
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.generator/.settings/org.eclipse.jdt.ui.prefs57
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.generator/.settings/org.eclipse.pde.core.prefs4
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.generator/CDC-1.0_Foundation-1.0.profile19
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.generator/CDC-1.1_Foundation-1.1.profile24
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.generator/J2SE-1.2.profile42
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.generator/J2SE-1.3.profile63
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.generator/J2SE-1.4.profile118
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.generator/J2SE-1.5.profile146
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.generator/JRE-1.1.profile17
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.generator/JavaSE-1.6.profile145
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.generator/META-INF/MANIFEST.MF26
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.generator/Metadata Generator CDT.launch21
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.generator/Metadata Generator SDK.launch22
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.generator/OSGi_Minimum-1.0.profile17
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.generator/OSGi_Minimum-1.1.profile18
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.generator/about.html28
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.generator/build.properties26
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.generator/config.ini57
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.generator/generator.product30
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.generator/plugin.xml22
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/prov/metadata/generator/Activator.java32
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/prov/metadata/generator/EclipseGeneratorApplication.java295
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/prov/metadata/generator/features/FeatureParser.java238
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/BundleDescriptionFactory.java121
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/EclipseInstallGeneratorInfoProvider.java358
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/Feature.java271
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/FeatureEntry.java175
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/Generator.java338
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/GeneratorBundleInfo.java150
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/IGeneratorInfo.java65
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/IPlatformEntry.java22
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/MetadataGeneratorHelper.java504
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/URLEntry.java39
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/.classpath7
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/.project28
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/.settings/org.eclipse.jdt.core.prefs331
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/.settings/org.eclipse.jdt.ui.prefs57
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/.settings/org.eclipse.pde.core.prefs4
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/META-INF/MANIFEST.MF27
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/about.html28
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/build.properties16
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/plugin.xml9
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/schema/metadataRepositories.exsd124
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/prov/metadata/repository/AbstractMetadataRepository.java69
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/prov/metadata/repository/Activator.java35
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/prov/metadata/repository/LocalMetadataRepository.java150
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/prov/metadata/repository/Messages.java27
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/prov/metadata/repository/MetadataCache.java80
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/prov/metadata/repository/MetadataRepositoryIO.java65
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/prov/metadata/repository/MetadataRepositoryManager.java294
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/prov/metadata/repository/SimpleMetadataRepositoryFactory.java67
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/prov/metadata/repository/URLMetadataRepository.java103
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/prov/metadata/repository/messages.properties13
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/prov/metadata/repository/IMetadataRepository.java43
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/prov/metadata/repository/IMetadataRepositoryFactory.java20
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/prov/metadata/repository/IMetadataRepositoryManager.java45
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/prov/metadata/repository/IWritableMetadataRepository.java28
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/.classpath7
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/.project28
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/.settings/org.eclipse.jdt.core.prefs331
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/.settings/org.eclipse.jdt.ui.prefs57
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/.settings/org.eclipse.pde.core.prefs4
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/META-INF/MANIFEST.MF19
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/about.html28
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/build.properties15
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/prov/metadata/ArtifactKey.java84
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/prov/metadata/InternalInstallableUnit.java16
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/prov/metadata/Messages.java26
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/prov/metadata/MetadataActivator.java32
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/prov/metadata/messages.properties14
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/ConstrainableElement.java14
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/IArtifactKey.java54
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/IInstallableUnit.java72
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/IInstallableUnitConstants.java36
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/IInstallableUnitFragment.java19
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/IMetadataVisitor.java20
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/IResolvedInstallableUnit.java16
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/IResolvedInstallableUnitFragment.java13
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/Inclusion.java21
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/InstallableUnit.java217
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/InstallableUnitFragment.java67
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/ProvidedCapability.java73
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/Recommendation.java125
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/RecommendationDescriptor.java116
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/RequiredCapability.java158
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/ResolvedInstallableUnit.java148
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/ResolvedInstallableUnitFragment.java26
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/Selector.java44
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/TouchpointData.java55
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/TouchpointType.java78
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/query/CompoundIterator.java98
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/query/IQueryable.java25
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/query/Query.java73
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/query/QueryableArray.java47
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/resolution/ResolutionHelper.java171
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/resolution/StateMetadataMap.java34
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/resolution/Transformer.java141
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/resolution/UnsatisfiedCapability.java56
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/.classpath7
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/.project28
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/.settings/org.eclipse.jdt.core.prefs340
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/.settings/org.eclipse.jdt.ui.prefs57
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/.settings/org.eclipse.pde.core.prefs4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/META-INF/MANIFEST.MF41
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/Test Director CDT.launch40
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/Test Director SDK.launch43
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/Test Director Uninstall CDT.launch40
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/Test Director Uninstall SDK.launch21
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/about.html28
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/build.properties18
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/plugin.xml34
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/AbstractProvisioningTest.java181
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/AutomatedTests.java30
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/TestActivator.java56
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/TestArtifactRepository.java157
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/TestMetadataRepository.java95
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/AllTests.java26
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/JarURLRepositoryTest.java47
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/Adder.java54
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/ByteShifter.java73
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/Counter.java86
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/MD5Verifier.java90
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/Multiplier.java54
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/Pack200Unpacker.java107
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/ProcessingStepHandlerTest.java207
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/AllTests.java36
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/AutomatedDirectorTest.java256
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/Bug203637.java30
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/OperationGenerationTest.java196
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/OracleTest.java74
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/OracleTest2.java89
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/PickerTest.java104
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/RollbackTest.java55
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/SingletonTest.java81
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/UninstallTest.java38
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/UpdateTestWithEntryPoint.java77
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/UpdateTestWithoutEntryPoint.java77
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/download/AllTests.java26
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/download/DownloadManagerTest.java32
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/engine/AllTests.java29
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/engine/EngineTest.java235
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/engine/PhaseSetTest.java54
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/engine/PhaseTest.java94
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/engine/ProfileTest.java45
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/full/DirectorTest.java145
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/full/End2EndTest.java248
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/AllTests.java30
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/FragmentMethodTest.java178
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/FragmentTest.java147
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/MultipleIUAndFragmentTest.java92
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/OldTest.java107
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/RecommendationTest.java178
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/ResolutionHelperTest.java302
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/repository/AllTests.java26
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/repository/JarURLRepositoryTest.java45
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/testData/enginerepo.jarbin0 -> 47329 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/testData/jarprocessor.jar.pack.gzbin0 -> 13587 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.tools/.classpath7
-rw-r--r--bundles/org.eclipse.equinox.p2.tools/.cvsignore1
-rw-r--r--bundles/org.eclipse.equinox.p2.tools/.project28
-rw-r--r--bundles/org.eclipse.equinox.p2.tools/.settings/org.eclipse.jdt.core.prefs331
-rw-r--r--bundles/org.eclipse.equinox.p2.tools/.settings/org.eclipse.jdt.ui.prefs57
-rw-r--r--bundles/org.eclipse.equinox.p2.tools/.settings/org.eclipse.pde.core.prefs4
-rw-r--r--bundles/org.eclipse.equinox.p2.tools/META-INF/MANIFEST.MF16
-rw-r--r--bundles/org.eclipse.equinox.p2.tools/ProvTools - compare repos.launch21
-rw-r--r--bundles/org.eclipse.equinox.p2.tools/ProvTools - list profile.launch22
-rw-r--r--bundles/org.eclipse.equinox.p2.tools/build.properties14
-rw-r--r--bundles/org.eclipse.equinox.p2.tools/plugin.xml14
-rw-r--r--bundles/org.eclipse.equinox.p2.tools/src/org/eclipse/equinox/prov/tools/MetadataCompareApplication.java230
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/.classpath7
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/.project28
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/.settings/org.eclipse.jdt.core.prefs334
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/.settings/org.eclipse.jdt.ui.prefs57
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/.settings/org.eclipse.pde.core.prefs4
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/META-INF/MANIFEST.MF26
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/about.html28
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/build.properties16
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/plugin.xml8
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/prov/touchpoint/eclipse/Activator.java32
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/prov/touchpoint/eclipse/EclipseTouchpoint.java490
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/.classpath7
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/.project28
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/.settings/org.eclipse.jdt.core.prefs331
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/.settings/org.eclipse.jdt.ui.prefs57
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/.settings/org.eclipse.pde.core.prefs4
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/META-INF/MANIFEST.MF22
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/about.html28
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/build.properties16
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/plugin.xml8
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/prov/touchpoint/natives/Activator.java40
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/prov/touchpoint/natives/BackupFiles.java319
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/prov/touchpoint/natives/Messages.java26
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/prov/touchpoint/natives/NativeTouchpoint.java178
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/prov/touchpoint/natives/Permissions.java29
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/prov/touchpoint/natives/Util.java62
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/prov/touchpoint/natives/Zip.java75
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/prov/touchpoint/natives/messages.properties18
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin.rcp/.classpath7
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin.rcp/.cvsignore1
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin.rcp/.project28
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin.rcp/.settings/org.eclipse.jdt.core.prefs331
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin.rcp/.settings/org.eclipse.jdt.ui.prefs57
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin.rcp/.settings/org.eclipse.pde.core.prefs3
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin.rcp/META-INF/MANIFEST.MF16
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin.rcp/ProvAdminUI.launch22
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin.rcp/about.html28
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin.rcp/build.properties21
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin.rcp/config.ini49
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin.rcp/icons/provision.gifbin0 -> 368 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin.rcp/plugin.properties20
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin.rcp/plugin.xml42
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin.rcp/plugin_customization.ini2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin.rcp/rcp.product79
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin.rcp/src/org/eclipse/equinox/prov/ui/admin/rcp/Activator.java69
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin.rcp/src/org/eclipse/equinox/prov/ui/admin/rcp/Application.java55
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin.rcp/src/org/eclipse/equinox/prov/ui/admin/rcp/ApplicationActionBarAdvisor.java48
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin.rcp/src/org/eclipse/equinox/prov/ui/admin/rcp/ApplicationWorkbenchAdvisor.java24
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin.rcp/src/org/eclipse/equinox/prov/ui/admin/rcp/ApplicationWorkbenchWindowAdvisor.java34
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin.rcp/src/org/eclipse/equinox/prov/ui/admin/rcp/ProvisioningRCPPerspective.java48
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin.rcp/src/org/eclipse/equinox/prov/ui/admin/rcp/internal/ProvAdminUIMessages.java31
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin.rcp/src/org/eclipse/equinox/prov/ui/admin/rcp/internal/messages.properties15
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/.classpath7
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/.cvsignore1
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/.project28
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/.settings/org.eclipse.jdt.core.prefs331
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/.settings/org.eclipse.jdt.ui.prefs57
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/META-INF/MANIFEST.MF33
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/about.html28
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/build.properties21
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/icons/obj/artifact_repo_obj.gifbin0 -> 545 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/icons/obj/iu_obj.gifbin0 -> 585 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/icons/obj/metadata_repo_obj.gifbin0 -> 353 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/icons/obj/profile_obj.gifbin0 -> 368 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/icons/obj/uninstalled_iu.gifbin0 -> 237 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/icons/provision.gifbin0 -> 368 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/plugin.properties25
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/plugin.xml110
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/ProvAdminUIActivator.java72
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/ArtifactRepositoriesView.java79
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/MetadataRepositoriesView.java175
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/ProfilesView.java310
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/ProvAdminUIMessages.java74
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/ProvView.java220
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/ProvisioningPerspective.java71
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/RepositoriesView.java167
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/dialogs/AddArtifactRepositoryDialog.java56
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/dialogs/AddMetadataRepositoryDialog.java56
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/dialogs/AddProfileDialog.java144
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/dialogs/UpdateAndInstallDialog.java77
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/messages.properties54
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/preferences/PreferenceConstants.java21
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/preferences/ProvUIPreferenceInitializer.java36
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/preferences/ProvisioningPrefPage.java53
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk/.classpath7
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk/.cvsignore1
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk/.project28
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk/.settings/org.eclipse.jdt.core.prefs330
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk/.settings/org.eclipse.jdt.ui.prefs57
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk/META-INF/MANIFEST.MF34
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk/about.html28
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk/build.properties18
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk/plugin.properties19
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk/plugin.xml72
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/prov/ui/internal/sdk/ProvSDKMessages.java35
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/prov/ui/internal/sdk/ProvSDKUIActivator.java71
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/prov/ui/internal/sdk/RepositoryManipulationDialog.java66
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/prov/ui/internal/sdk/UpdateAndInstallDialog.java87
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/prov/ui/internal/sdk/UpdateHandler.java76
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/prov/ui/internal/sdk/messages.properties18
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/.classpath7
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/.cvsignore1
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/.project28
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/.settings/org.eclipse.jdt.core.prefs330
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/.settings/org.eclipse.jdt.ui.prefs57
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/META-INF/MANIFEST.MF35
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/about.html28
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/build.properties17
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/icons/obj/artifact_repo_obj.gifbin0 -> 545 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/icons/obj/iu_obj.gifbin0 -> 585 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/icons/obj/metadata_repo_obj.gifbin0 -> 353 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/icons/obj/profile_obj.gifbin0 -> 368 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/icons/obj/uninstalled_iu.gifbin0 -> 237 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/icons/wizban/config_wiz.gifbin0 -> 3388 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/icons/wizban/def_wizban.jpgbin0 -> 33456 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/icons/wizban/install_wiz.gifbin0 -> 3550 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/icons/wizban/uninstall_wiz.gifbin0 -> 3719 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/icons/wizban/update_wiz.gifbin0 -> 3744 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/plugin.properties15
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/ColocatedRepositoryInfo.java63
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/ColocatedRepositoryUtil.java67
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/IProfileChooser.java37
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/IProvisioningProperties.java27
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/IRepositoryManipulator.java38
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/ProvUI.java81
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/ProvUIActivator.java147
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/ProvUIImages.java65
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/ProvisioningUndoSupport.java119
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/ProvisioningUtil.java362
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/actions/BecomeAction.java37
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/actions/InstallAction.java88
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/actions/ProfileModificationAction.java132
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/actions/ProvisioningAction.java37
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/actions/UninstallAction.java32
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/actions/UpdateAction.java112
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/AddColocatedRepositoryDialog.java67
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/AddRepositoryDialog.java160
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/ColocatedRepositoryManipulatorGroup.java218
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/ColocatedRepositoryPropertyPage.java29
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/IUGroup.java46
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/IUImplementationGroup.java202
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/IUImplementationPropertyPage.java59
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/IUPropertiesGroup.java74
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/IUPropertyPage.java56
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/ProfileGroup.java265
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/ProfilePropertyPage.java60
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/RepositoryGroup.java156
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/RepositoryImplementationGroup.java74
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/RepositoryImplementationPropertyPage.java31
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/RepositoryPropertyPage.java79
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/UpdateAndInstallGroup.java354
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/internal/ApplyProfileChangesDialog.java75
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/internal/ProvUIMessages.java128
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/internal/ProvisioningPropertyManager.java52
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/internal/messages.properties109
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/model/AllArtifactRepositories.java58
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/model/AllMetadataRepositories.java60
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/model/AllProfiles.java61
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/model/ArtifactRepositoryContentProvider.java64
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/model/AvailableIUContentProvider.java65
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/model/InstalledIUElement.java73
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/model/MetadataRepositoryContentProvider.java66
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/model/ProfileContentProvider.java78
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/model/ProfileFactory.java78
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/model/ProvElement.java105
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/AddArtifactRepositoryOperation.java72
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/AddColocatedRepositoryOperation.java81
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/AddMetadataRepositoryOperation.java71
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/AddProfileOperation.java59
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/BecomeOperation.java71
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/IOperationConfirmer.java32
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/InstallOperation.java82
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/ProfileModificationOperation.java66
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/ProfileOperation.java59
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/ProvisioningOperation.java194
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/RemoveArtifactRepositoryOperation.java76
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/RemoveColocatedRepositoryOperation.java87
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/RemoveMetadataRepositoryOperation.java75
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/RemoveProfilesOperation.java64
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/RepositoryOperation.java38
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/UninstallOperation.java76
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/UpdateOperation.java80
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/viewers/ColocatedRepositoryLabelProvider.java62
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/viewers/IUCapabilityFilter.java59
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/viewers/IUDetailsLabelProvider.java71
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/viewers/IUDragAdapter.java138
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/viewers/IUGroupFilter.java29
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/viewers/IUPropertyFilter.java49
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/viewers/InstallIUDropAdapter.java242
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/viewers/InternalRepositoryFilter.java38
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/viewers/ProvElementLabelProvider.java126
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/viewers/StructuredViewerProvisioningListener.java94
540 files changed, 41983 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/.classpath b/bundles/org.eclipse.equinox.p2.artifact.repository/.classpath
new file mode 100644
index 000000000..7cdeb7319
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/CDC-1.1%Foundation-1.1"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/.project b/bundles/org.eclipse.equinox.p2.artifact.repository/.project
new file mode 100644
index 000000000..c94254214
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.equinox.prov.artifact.repository</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.artifact.repository/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..3f53e5adb
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,343 @@
+#Mon Sep 17 23:16:48 EDT 2007
+eclipse.preferences.version=1
+instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
+org.eclipse.jdt.core.builder.cleanOutputFolder=clean
+org.eclipse.jdt.core.builder.duplicateResourceTask=warning
+org.eclipse.jdt.core.builder.invalidClasspath=abort
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
+org.eclipse.jdt.core.circularClasspath=error
+org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
+org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=ignore
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=false
+org.eclipse.jdt.core.formatter.comment.format_comments=false
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false
+org.eclipse.jdt.core.formatter.comment.format_line_comments=false
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=800
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.incompatibleJDKLevel=ignore
+org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.p2.artifact.repository/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 000000000..e71c32e23
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,57 @@
+#Sun Sep 23 11:57:38 EDT 2007
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_core
+formatter_settings_version=11
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=;
+org.eclipse.jdt.ui.ondemandthreshold=3
+org.eclipse.jdt.ui.staticondemandthreshold=3
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates/>
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.format_source_code=true
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_variable_declarations_final=true
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=false
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/.settings/org.eclipse.pde.core.prefs b/bundles/org.eclipse.equinox.p2.artifact.repository/.settings/org.eclipse.pde.core.prefs
new file mode 100644
index 000000000..979e4e8b4
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/.settings/org.eclipse.pde.core.prefs
@@ -0,0 +1,4 @@
+
+eclipse.preferences.version=1
+pluginProject.extensions=true
+resolve.requirebundle=false
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.artifact.repository/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..ffbacbb41
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/META-INF/MANIFEST.MF
@@ -0,0 +1,29 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Artifact Repository Bundle (Incubation)
+Bundle-SymbolicName: org.eclipse.equinox.prov.artifact.repository;singleton:=true
+Bundle-Version: 0.1.0.qualifier
+Export-Package: org.eclipse.equinox.internal.prov.artifact.repository;x-friends:="org.eclipse.equinox.prov.metadata.generator,org.eclipse.equinox.prov.test,org.eclipse.equinox.prov.selfhosting",
+ org.eclipse.equinox.prov.artifact.repository,
+ org.eclipse.equinox.prov.artifact.repository.processing
+Import-Package: com.thoughtworks.xstream,
+ org.eclipse.core.runtime.preferences,
+ org.eclipse.equinox.internal.p2.jarprocessor;resolution:=optional,
+ org.eclipse.equinox.p2.jarprocessor;resolution:=optional,
+ org.eclipse.equinox.prov.core.helpers,
+ org.eclipse.equinox.prov.core.location,
+ org.eclipse.equinox.prov.core.repository,
+ org.eclipse.equinox.prov.metadata,
+ org.eclipse.osgi.internal.provisional.verifier,
+ org.osgi.framework;version="1.3.0",
+ org.osgi.service.prefs;version="1.1.0",
+ org.osgi.util.tracker;version="1.3.0"
+Bundle-Activator: org.eclipse.equinox.internal.prov.artifact.repository.Activator
+Eclipse-LazyStart: true
+Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
+ J2SE-1.4
+Require-Bundle: org.eclipse.ecf.filetransfer,
+ org.eclipse.ecf,
+ org.eclipse.equinox.common,
+ org.eclipse.equinox.registry
+Eclipse-BuddyPolicy: registered
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/about.html b/bundles/org.eclipse.equinox.p2.artifact.repository/about.html
new file mode 100644
index 000000000..460233046
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 2, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/build.properties b/bundles/org.eclipse.equinox.p2.artifact.repository/build.properties
new file mode 100644
index 000000000..8917af773
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/build.properties
@@ -0,0 +1,16 @@
+###############################################################################
+# Copyright (c) 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ about.html
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/plugin.xml b/bundles/org.eclipse.equinox.p2.artifact.repository/plugin.xml
new file mode 100644
index 000000000..be934eedd
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/plugin.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension-point id="artifactRepositories" name="Artifact Repositories" schema="schema/artifactRepositories.exsd"/>
+ <extension-point id="processingSteps" name="Processing Steps" schema="schema/processingSteps.exsd"/>
+ <extension id="simpleRepository" point="org.eclipse.equinox.prov.artifact.repository.artifactRepositories">
+ <filter suffix="artifacts.xml"/>
+ <factory class="org.eclipse.equinox.internal.prov.artifact.repository.SimpleArtifactRepositoryFactory"/>
+ </extension>
+
+ <extension
+ point="org.eclipse.equinox.prov.artifact.repository.processingSteps"
+ id="org.eclipse.equinox.p2.processing.Pack200Unpacker">
+ <step class="org.eclipse.equinox.internal.prov.artifact.repository.Unpack200Step"/>
+ </extension>
+ <extension
+ point="org.eclipse.equinox.prov.artifact.repository.processingSteps"
+ id="org.eclipse.equinox.p2.processing.SignatureVerifier">
+ <step class="org.eclipse.equinox.internal.prov.artifact.repository.SignatureVerifier"/>
+ </extension>
+</plugin>
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/schema/artifactRepositories.exsd b/bundles/org.eclipse.equinox.p2.artifact.repository/schema/artifactRepositories.exsd
new file mode 100644
index 000000000..18db7af66
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/schema/artifactRepositories.exsd
@@ -0,0 +1,124 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.equinox.prov.artifact.repository">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.equinox.prov.artifact.repository" id="artifactRepositories" name="Artifact Repositories"/>
+ </appInfo>
+ <documentation>
+ This extension point is used to provide artifact repository implementations
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="factory"/>
+ <element ref="filter" minOccurs="0" maxOccurs="1"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="factory">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ the fully-qualified name of a class which implements
+&lt;samp&gt;org.eclipse.equinox.prov.artifact.repository.IArtifactRepository&lt;/samp&gt;.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.equinox.prov.artifact.repository.IArtifactRepository"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="filter">
+ <complexType>
+ <attribute name="suffix" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ org.eclipse.equinox.prov.artifact.repository 0.1.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ The value of the class attribute must represent an
+implementor of &lt;tt&gt;org.eclipse.equinox.prov.artifact.repository.IArtifactRepository&lt;/tt&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2007 IBM Corporation and others.&lt;br&gt;
+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 &lt;a
+href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/schema/processingSteps.exsd b/bundles/org.eclipse.equinox.p2.artifact.repository/schema/processingSteps.exsd
new file mode 100644
index 000000000..2d3eaa7ab
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/schema/processingSteps.exsd
@@ -0,0 +1,110 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.equinox.prov.artifact.repository">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.equinox.prov.artifact.repository" id="processingSteps" name="Processing Steps"/>
+ </appInfo>
+ <documentation>
+ This extension point is used to provide processing step implementations
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="step"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="step">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.equinox.prov.artifact.repository.processing.IProcessingStep"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ org.eclipse.equinox.prov.artifact.repository ?.?.?
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ The value of the class attribute must represent an
+implementor of &lt;tt&gt;org.eclipse.equinox.prov.artifact.processing.IProcessingStep&lt;/tt&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2007 compeople AG and others.&lt;br&gt;
+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 &lt;a
+href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/Activator.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/Activator.java
new file mode 100644
index 000000000..e21be5826
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/Activator.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.artifact.repository;
+
+import org.eclipse.equinox.prov.artifact.repository.IArtifactRepositoryManager;
+import org.osgi.framework.*;
+
+public class Activator implements BundleActivator {
+ private static BundleContext context;
+ public static final String ID = "org.eclipse.equinox.prov.artifact.repository";
+ public static final String REPO_PROVIDER_XPT = ID + '.' + "artifactRepositories";
+ public IArtifactRepositoryManager repoManager;
+ public ServiceRegistration repoManagerRegistration;
+
+ public void start(BundleContext context) throws Exception {
+ Activator.context = context;
+ // repoManager = new ArtifactRepoManager();
+ // repoManagerRegistration = context.registerService(IArtifactRepoManager.class.getName(), repoManager, null);
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ Activator.context = null;
+ // repoManager = null;
+ // repoManagerRegistration = null;
+ }
+
+ public static BundleContext getContext() {
+ return Activator.context;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/ArtifactRepositoryIO.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/ArtifactRepositoryIO.java
new file mode 100644
index 000000000..3457ae896
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/ArtifactRepositoryIO.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.artifact.repository;
+
+import com.thoughtworks.xstream.XStream;
+import java.io.*;
+import org.eclipse.equinox.prov.artifact.repository.IArtifactRepository;
+import org.eclipse.equinox.prov.core.repository.RepositoryCreationException;
+
+/**
+ * This class reads and writes artifact repository
+ * (eg. table of contents files);
+ *
+ * This class is not used for reading or writing the actual artifacts.
+ *
+ * The implementation currently uses XStream.
+ */
+class ArtifactRepositoryIO {
+
+ /**
+ * Reads the artifact repository from the given stream,
+ * and returns the contained array of abstract artifact repositories.
+ *
+ * This method performs buffering, and closes the stream when finished.
+ */
+ public static IArtifactRepository read(InputStream input) throws RepositoryCreationException {
+ XStream stream = new XStream();
+ BufferedInputStream bufferedInput = null;
+ try {
+ try {
+ bufferedInput = new BufferedInputStream(input);
+ return (IArtifactRepository) stream.fromXML(bufferedInput);
+ } finally {
+ if (bufferedInput != null)
+ bufferedInput.close();
+ }
+ } catch (IOException e) {
+ throw new RepositoryCreationException(e);
+ }
+ }
+
+ /**
+ * Writes the given artifact repository to the stream.
+ * This method performs buffering, and closes the stream when finished.
+ */
+ public static void write(IArtifactRepository repository, OutputStream output) {
+ XStream stream = new XStream();
+ OutputStream bufferedOutput = null;
+ try {
+ try {
+ bufferedOutput = new BufferedOutputStream(output);
+ stream.toXML(repository, bufferedOutput);
+ } finally {
+ if (bufferedOutput != null) {
+ bufferedOutput.close();
+ }
+ }
+ } catch (FileNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/ArtifactRepositoryManager.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/ArtifactRepositoryManager.java
new file mode 100644
index 000000000..cd7c8854f
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/ArtifactRepositoryManager.java
@@ -0,0 +1,296 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.internal.prov.artifact.repository;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.preferences.ConfigurationScope;
+import org.eclipse.equinox.prov.artifact.repository.*;
+import org.eclipse.equinox.prov.core.helpers.*;
+import org.eclipse.equinox.prov.core.location.AgentLocation;
+import org.eclipse.equinox.prov.metadata.IArtifactKey;
+import org.osgi.service.prefs.BackingStoreException;
+import org.osgi.service.prefs.Preferences;
+
+// TODO Need to react to repository going away
+// TODO the current assumption that the "location" is the dir/root limits us to
+// having just one repo in a given URL..
+public class ArtifactRepositoryManager implements IArtifactRepositoryManager {
+ private static final String ATTR_FILTER = "filter"; //$NON-NLS-1$
+ private static final String ATTR_SUFFIX = "suffix"; //$NON-NLS-1$
+ private static final String EL_FACTORY = "factory"; //$NON-NLS-1$
+
+ private static final String KEY_DESCRIPTION = "description"; //$NON-NLS-1$
+ private static final String KEY_NAME = "name"; //$NON-NLS-1$
+ private static final String KEY_PROVIDER = "provider"; //$NON-NLS-1$
+ private static final String KEY_TYPE = "type"; //$NON-NLS-1$
+ private static final String KEY_URL = "url"; //$NON-NLS-1$
+ private static final String KEY_VERSION = "version"; //$NON-NLS-1$
+ private static final String NODE_REPOSITORIES = "repositories"; //$NON-NLS-1$
+
+ private List repositories = Collections.synchronizedList(new ArrayList());
+
+ public ArtifactRepositoryManager() {
+ restoreRepositories();
+ }
+
+ public void addRepository(IArtifactRepository repository) {
+ repositories.add(repository);
+ // save the given repository in the preferences.
+ remember(repository);
+ }
+
+ public IArtifactRequest createDownloadRequest(IArtifactKey key, IPath destination) {
+ return new FileDownloadRequest(key, destination);
+ }
+
+ private Object createExecutableExtension(IExtension extension, String element) throws CoreException {
+ IConfigurationElement[] elements = extension.getConfigurationElements();
+ for (int i = 0; i < elements.length; i++) {
+ if (elements[i].getName().equals(element))
+ return elements[i].createExecutableExtension("class"); //$NON-NLS-1$
+ }
+ throw new CoreException(new Status(IStatus.ERROR, Activator.ID, "Malformed extension"));
+ }
+
+ public IArtifactRequest createMirrorRequest(IArtifactKey key, IWritableArtifactRepository destination) {
+ return new MirrorRequest(key, destination);
+ }
+
+ public IArtifactRepository createRepository(URL location, String name, String type) {
+ IArtifactRepository result = loadRepository(location, (IProgressMonitor) null);
+ if (result != null)
+ return result;
+ IExtension extension = RegistryFactory.getRegistry().getExtension(Activator.REPO_PROVIDER_XPT, type);
+ if (extension == null)
+ return null;
+ try {
+ IArtifactRepositoryFactory factory = (IArtifactRepositoryFactory) createExecutableExtension(extension, EL_FACTORY);
+ if (factory == null)
+ return null;
+ result = factory.create(location, name, type);
+ if (result != null)
+ addRepository(result);
+ return result;
+ } catch (CoreException e) {
+ log("Failed to load artifact repository extension: " + location, e); //$NON-NLS-1$
+ return null;
+ }
+ }
+
+ private IExtension[] findMatchingRepositoryExtensions(String suffix) {
+ IConfigurationElement[] elt = RegistryFactory.getRegistry().getConfigurationElementsFor(Activator.REPO_PROVIDER_XPT);
+ int count = 0;
+ for (int i = 0; i < elt.length; i++) {
+ if (ATTR_FILTER.equals(elt[i].getName())) {
+ if (!suffix.equals(elt[i].getAttribute(ATTR_SUFFIX))) {
+ elt[i] = null;
+ } else {
+ count++;
+ }
+ } else {
+ elt[i] = null;
+ }
+ }
+ IExtension[] results = new IExtension[count];
+ for (int i = 0; i < elt.length; i++) {
+ if (elt[i] != null)
+ results[--count] = elt[i].getDeclaringExtension();
+ }
+ return results;
+ }
+
+ private void forget(IArtifactRepository toRemove) throws BackingStoreException {
+ getPreferences().node(getKey(toRemove)).removeNode();
+ }
+
+ private String[] getAllSuffixes() {
+ IConfigurationElement[] elements = RegistryFactory.getRegistry().getConfigurationElementsFor(Activator.REPO_PROVIDER_XPT);
+ ArrayList result = new ArrayList(elements.length);
+ for (int i = 0; i < elements.length; i++)
+ if (elements[i].getName().equals(ATTR_FILTER))
+ result.add(elements[i].getAttribute(ATTR_SUFFIX));
+ return (String[]) result.toArray(new String[result.size()]);
+ }
+
+ /*
+ * Return an encoded repository key that is suitable for using
+ * as the name of a preference node.
+ */
+ private String getKey(IArtifactRepository repository) {
+ return repository.getLocation().toExternalForm().replace('/', '_');
+ }
+
+ public IArtifactRepository[] getKnownRepositories() {
+ if (repositories == null)
+ restoreRepositories();
+ return (IArtifactRepository[]) repositories.toArray(new IArtifactRepository[repositories.size()]);
+ }
+
+ /*
+ * Return the root preference node where we store the repository information.
+ */
+ private Preferences getPreferences() {
+ return new ConfigurationScope().getNode(Activator.ID).node(NODE_REPOSITORIES);
+ }
+
+ public IArtifactRepository getRepository(URL location) {
+ if (repositories == null)
+ restoreRepositories();
+ for (Iterator iterator = repositories.iterator(); iterator.hasNext();) {
+ IArtifactRepository match = (IArtifactRepository) iterator.next();
+ if (Utils.sameURL(match.getLocation(), location))
+ return match;
+ }
+ return null;
+ }
+
+ public IArtifactRepository loadRepository(URL location, IProgressMonitor monitor) {
+ // TODO do some thing with the monitor
+ IArtifactRepository result = getRepository(location);
+ if (result != null)
+ return result;
+ String[] suffixes = getAllSuffixes();
+ for (int i = 0; i < suffixes.length; i++) {
+ result = loadRepository(location, suffixes[i]);
+ if (result != null) {
+ addRepository(result);
+ return result;
+ }
+ }
+ return null;
+ }
+
+ private IArtifactRepository loadRepository(URL location, String suffix) {
+ IExtension[] providers = findMatchingRepositoryExtensions(suffix);
+ // Loop over the candidates and return the first one that successfully loads
+ for (int i = 0; i < providers.length; i++)
+ try {
+ IArtifactRepositoryFactory factory = (IArtifactRepositoryFactory) createExecutableExtension(providers[i], EL_FACTORY);
+ if (factory != null)
+ return factory.load(location);
+ } catch (CoreException e) {
+ log("Unable to load repository: " + location, e); //$NON-NLS-1$
+ }
+ return null;
+ }
+
+ protected void log(String message, Throwable t) {
+ LogHelper.log(new Status(IStatus.ERROR, Activator.ID, message, t));
+ }
+
+ /*
+ * Add the given repository object to the preferences and save.
+ */
+ private void remember(IArtifactRepository repository) {
+ Preferences node = getPreferences().node(getKey(repository));
+ String value = repository.getDescription();
+ if (value != null)
+ node.put(KEY_DESCRIPTION, value);
+ value = repository.getName();
+ if (value != null)
+ node.put(KEY_NAME, value);
+ value = repository.getProvider();
+ if (value != null)
+ node.put(KEY_PROVIDER, value);
+ value = repository.getType();
+ if (value != null)
+ node.put(KEY_TYPE, value);
+ value = repository.getVersion();
+ if (value != null)
+ node.put(KEY_VERSION, value);
+ value = repository.getLocation().toExternalForm();
+ node.put(KEY_URL, value);
+ saveRepositoryList();
+ }
+
+ public void removeRepository(IArtifactRepository toRemove) {
+ if (toRemove != null)
+ repositories.remove(toRemove);
+ // remove the repository from the preferences
+ try {
+ forget(toRemove);
+ saveRepositoryList();
+ } catch (BackingStoreException e) {
+ log("Error saving preferences", e); //$NON-NLS-1$
+ }
+ }
+
+ /*
+ * Load the list of repositories from the preferences.
+ */
+ private void restoreFromPreferences() {
+ // restore the list of repositories from the preference store
+ Preferences node = getPreferences();
+ String[] children;
+ try {
+ children = node.childrenNames();
+ } catch (BackingStoreException e) {
+ log("Error restoring repositories from preferences", e); //$NON-NLS-1$
+ return;
+ }
+ for (int i = 0; i < children.length; i++) {
+ Preferences child = node.node(children[i]);
+ String url = child.get(KEY_URL, null);
+ if (url == null)
+ continue;
+ try {
+ IArtifactRepository repository = loadRepository(new URL(url), (IProgressMonitor) null);
+ // If we could not restore the repo then remove it from the preferences.
+ if (repository == null)
+ child.removeNode();
+ } catch (MalformedURLException e) {
+ log("Error while restoring repository: " + url, e); //$NON-NLS-1$
+ } catch (BackingStoreException e) {
+ log("Error restoring repositories from preferences", e); //$NON-NLS-1$
+ }
+ }
+ // now that we have loaded everything, remember them
+ saveRepositoryList();
+ }
+
+ private void restoreRepositories() {
+ repositories = new ArrayList();
+ // TODO while recreating, we may want to have proxies on repo instead of the real repo object to limit what is activated.
+ AgentLocation location = (AgentLocation) ServiceHelper.getService(Activator.getContext(), AgentLocation.class.getName());
+ if (location == null)
+ // TODO should do something here since we are failing to restore.
+ return;
+ SimpleArtifactRepository cache = (SimpleArtifactRepository) createRepository(location.getArtifactRepositoryURL(), "download cache", "org.eclipse.equinox.prov.artifact.repository.simpleRepository"); //$NON-NLS-1$ //$NON-NLS-2$
+ cache.tagAsImplementation();
+
+ String locationString = Activator.getContext().getProperty("eclipse.prov.artifactRepository"); //$NON-NLS-1$
+ if (locationString != null) {
+ StringTokenizer tokenizer = new StringTokenizer(locationString, ","); //$NON-NLS-1$
+ while (tokenizer.hasMoreTokens()) {
+ try {
+ loadRepository(new URL(tokenizer.nextToken()), (IProgressMonitor) null);
+ } catch (MalformedURLException e) {
+ log("Error while restoring repository " + locationString, e); //$NON-NLS-1$
+ }
+ }
+ }
+ // restore the persisted list of repositories
+ restoreFromPreferences();
+ }
+
+ /*
+ * Save the list of repositories to the file-system.
+ */
+ private void saveRepositoryList() {
+ try {
+ getPreferences().flush();
+ } catch (BackingStoreException e) {
+ log("Error while saving repositories in preferences", e); //$NON-NLS-1$
+ }
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/ArtifactRequest.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/ArtifactRequest.java
new file mode 100644
index 000000000..e13519131
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/ArtifactRequest.java
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.artifact.repository;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.equinox.prov.artifact.repository.*;
+import org.eclipse.equinox.prov.metadata.IArtifactKey;
+
+/**
+ * Base class for all requests on an {@link IArtifactRepository}.
+ */
+public abstract class ArtifactRequest implements IArtifactRequest {
+ protected IArtifactKey artifact;
+ protected String resolvedKey;
+ protected IArtifactRepository source;
+ protected IStatus result;
+ protected IArtifactDescriptor descriptor;
+
+ public ArtifactRequest(IArtifactKey key) {
+ artifact = key;
+ // TODO do we need to make this configurable? for now set default request handler to ECF
+ }
+
+ public IArtifactKey getArtifactKey() {
+ return artifact;
+ }
+
+ public IArtifactDescriptor getArtifactDescriptor() {
+ return descriptor;
+ }
+
+ /**
+ * Returns the result of the previous call to {@link #perform(IProgressMonitor)},
+ * or <code>null</code> if perform has never been called.
+ *
+ * @return The result of the previous perform call.
+ */
+ public IStatus getResult() {
+ return result;
+ }
+
+ protected IArtifactRepository getSourceRepository() {
+ return source;
+ }
+
+ /**
+ * Performs the artifact request, and sets the result status.
+ *
+ * @param monitor a progress monitor, or <code>null</code> if progress
+ * reporting is not desired
+ */
+ abstract public void perform(IProgressMonitor monitor);
+
+ /**
+ * Sets the descriptor to use when processing this request.
+ *
+ * @param value The descriptor to use when processing this request
+ */
+ public void setDescriptor(IArtifactDescriptor value) {
+ if (!value.getArtifactKey().equals(artifact))
+ throw new IllegalArgumentException("Descriptor's key must match the request's key"); //$NON-NLS-1$
+ descriptor = value;
+ if (artifact == null)
+ artifact = value.getArtifactKey();
+ }
+
+ /**
+ * Sets the result of an invocation of {@link #perform(IProgressMonitor)}.
+ * This method is called by subclasses to set the result status for
+ * this request.
+ *
+ * @param value The result status
+ */
+ protected void setResult(IStatus value) {
+ result = value;
+ }
+
+ public void setSourceRepository(IArtifactRepository value) {
+ source = value;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/ECFTransport.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/ECFTransport.java
new file mode 100644
index 000000000..f5c9f7674
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/ECFTransport.java
@@ -0,0 +1,128 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation Stefan Liebig -
+ * random tweaks
+ ******************************************************************************/
+package org.eclipse.equinox.internal.prov.artifact.repository;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import org.eclipse.core.runtime.*;
+import org.eclipse.ecf.filetransfer.*;
+import org.eclipse.ecf.filetransfer.events.*;
+import org.eclipse.ecf.filetransfer.identity.FileCreateException;
+import org.eclipse.ecf.filetransfer.identity.FileIDFactory;
+import org.eclipse.ecf.filetransfer.service.IRetrieveFileTransferFactory;
+import org.eclipse.equinox.prov.artifact.repository.Transport;
+import org.eclipse.equinox.prov.artifact.repository.processing.ProcessingStep;
+import org.eclipse.equinox.prov.core.helpers.LogHelper;
+import org.osgi.util.tracker.ServiceTracker;
+
+/**
+ * A request handler that implements file transfer using ECF API.
+ */
+public class ECFTransport extends Transport {
+
+ /**
+ * The singleton handler instance.
+ */
+ private static ECFTransport instance;
+
+ private final ServiceTracker retrievalFactoryTracker;
+
+ /**
+ * Returns an initialized instance of ECFHandler
+ */
+ public static synchronized ECFTransport getInstance() {
+ if (instance == null) {
+ instance = new ECFTransport();
+ }
+ return instance;
+ }
+
+ /**
+ * Private to avoid client instantiation.
+ */
+ private ECFTransport() {
+ retrievalFactoryTracker = new ServiceTracker(Activator.getContext(), IRetrieveFileTransferFactory.class.getName(), null);
+ retrievalFactoryTracker.open();
+ }
+
+ protected IStatus convertToStatus(Exception failure) {
+ if (failure == null)
+ return Status.OK_STATUS;
+ if (failure instanceof UserCancelledException)
+ return new Status(IStatus.CANCEL, Activator.ID, failure.getMessage(), failure);
+ return new Status(IStatus.ERROR, Activator.ID, "error during transfer", failure);
+ }
+
+ public IStatus download(String toDownload, OutputStream target, IProgressMonitor monitor) {
+ IRetrieveFileTransferFactory factory = (IRetrieveFileTransferFactory) retrievalFactoryTracker.getService();
+ if (factory == null)
+ return new Status(IStatus.ERROR, Activator.ID, "ECF Transfer manager not available");
+ return transfer(factory.newInstance(), toDownload, target, monitor);
+ }
+
+ private IStatus transfer(final IRetrieveFileTransferContainerAdapter retrievalContainer, final String toDownload, final OutputStream target, final IProgressMonitor monitor) {
+ final IStatus[] result = new IStatus[1];
+ IFileTransferListener listener = new IFileTransferListener() {
+ public void handleTransferEvent(IFileTransferEvent event) {
+ if (event instanceof IIncomingFileTransferReceiveStartEvent) {
+ IIncomingFileTransferReceiveStartEvent rse = (IIncomingFileTransferReceiveStartEvent) event;
+ try {
+ if (target != null) {
+ rse.receive(target);
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ if (event instanceof IIncomingFileTransferReceiveDataEvent) {
+ IIncomingFileTransfer source = ((IIncomingFileTransferReceiveDataEvent) event).getSource();
+ monitor.subTask("Transferring " + source.getID().getName() + " (" + (int) (source.getPercentComplete() * 100) + "% complete)");
+ if (monitor.isCanceled())
+ source.cancel();
+ }
+ if (event instanceof IIncomingFileTransferReceiveDoneEvent) {
+ IStatus status = convertToStatus(((IIncomingFileTransferReceiveDoneEvent) event).getException());
+ synchronized (result) {
+ result[0] = status;;
+ result.notify();
+ }
+ }
+ }
+ };
+
+ try {
+ retrievalContainer.sendRetrieveRequest(FileIDFactory.getDefault().createFileID(retrievalContainer.getRetrieveNamespace(), toDownload), listener, null);
+ } catch (IncomingFileTransferException e) {
+ return new Status(IStatus.ERROR, Activator.ID, "error during transfer", e);
+ } catch (FileCreateException e) {
+ return new Status(IStatus.ERROR, Activator.ID, "error during transfer - could not create file", e);
+ }
+ synchronized (result) {
+ while (result[0] == null) {
+ boolean logged = false;
+ try {
+ result.wait();
+ } catch (InterruptedException e) {
+ if (!logged)
+ LogHelper.log(new Status(IStatus.WARNING, Activator.ID, "Unexpected interrupt while waiting on ECF transfer", e)); //$NON-NLS-1$
+ }
+ }
+ }
+
+ if (!(target instanceof ProcessingStep))
+ return result[0];
+ IStatus stepStatus = ((ProcessingStep) target).getStatus(true);
+ IStatus[] combinedList = new IStatus[stepStatus.getChildren().length + 1];
+ combinedList[0] = result[0];
+ System.arraycopy(stepStatus.getChildren(), 0, combinedList, 1, stepStatus.getChildren().length);
+ int code = result[0].getCode() > stepStatus.getCode() ? result[0].getCode() : stepStatus.getCode();
+ return new MultiStatus(Activator.ID, code, combinedList, "Problems occurred while downloading " + toDownload, null);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/FileDownloadRequest.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/FileDownloadRequest.java
new file mode 100644
index 000000000..104d95879
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/FileDownloadRequest.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.artifact.repository;
+
+import java.io.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.prov.metadata.IArtifactKey;
+
+public class FileDownloadRequest extends ArtifactRequest {
+ public static FileDownloadRequest[] NO_REQUEST = new FileDownloadRequest[0];
+
+ private File destination; //The fully qualified path where the file should be written
+
+ public FileDownloadRequest(IArtifactKey downloadKey, IPath downloadPath) {
+ super(downloadKey);
+ destination = destination;
+ }
+
+ public void perform(IProgressMonitor monitor) {
+ try {
+ OutputStream destinationStream = null;
+ try {
+ destinationStream = new BufferedOutputStream(new FileOutputStream(destination));
+ setResult(source.getArtifact(descriptor, destinationStream, null));
+ } finally {
+ if (destinationStream != null)
+ destinationStream.close();
+ }
+ } catch (IOException e) {
+ setResult(new Status(IStatus.ERROR, Activator.ID, "Error downloading " + descriptor + " to " + destination, e));
+ };
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/MirrorRequest.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/MirrorRequest.java
new file mode 100644
index 000000000..af383462b
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/MirrorRequest.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.artifact.repository;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.prov.artifact.repository.IArtifactDescriptor;
+import org.eclipse.equinox.prov.artifact.repository.IWritableArtifactRepository;
+import org.eclipse.equinox.prov.metadata.IArtifactKey;
+
+public class MirrorRequest extends ArtifactRequest {
+ private IWritableArtifactRepository target;
+
+ public MirrorRequest(IArtifactKey key, IWritableArtifactRepository targetRepository) {
+ super(key);
+ target = targetRepository;
+ }
+
+ public void perform(IProgressMonitor monitor) {
+ monitor.subTask("Downloading " + getArtifactKey().getId());
+ // Do we already have the artifact in the target?
+ if (target.contains(getArtifactKey())) {
+ setResult(new Status(IStatus.OK, Activator.ID, "The artifact is already available in the repo."));
+ return;
+ }
+
+ // if the request does not have a descriptor then try to fill one in by getting
+ // the list of all and randomly picking the first one.
+ if (descriptor == null) {
+ IArtifactDescriptor[] descriptors = source.getArtifactDescriptors(getArtifactKey());
+ if (descriptors.length > 0)
+ descriptor = descriptors[0];
+ }
+
+ // if the descriptor is not set now then the repo does not have the requested artifact
+ if (descriptor == null) {
+ setResult(new Status(IStatus.ERROR, Activator.ID, "Artifact requested can't be found:" + getArtifactKey()));
+ return;
+ }
+
+ // Get the output stream to store the artifact
+ OutputStream destination = target.getOutputStream(getArtifactDescriptor());
+ if (destination == null) {
+ setResult(new Status(IStatus.ERROR, Activator.ID, "Can't get an output stream to " + target + " to store " + getArtifactKey()));
+ return;
+ }
+
+ // Do the actual transfer
+ try {
+ setResult(source.getArtifact(descriptor, destination, monitor));
+ return;
+ } finally {
+ try {
+ destination.close();
+ } catch (IOException e) {
+ setResult(new Status(IStatus.ERROR, Activator.ID, "Error closing the output stream for " + getArtifactKey() + "on repo " + target.getLocation(), e));
+ }
+ }
+ }
+
+ public String toString() {
+ return "Mirrroring: " + getArtifactKey() + " into " + target;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/SignatureVerifier.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/SignatureVerifier.java
new file mode 100644
index 000000000..113f388fa
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/SignatureVerifier.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+* Copyright (c) 2007 compeople AG and others.
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*
+* Contributors:
+* compeople AG (Stefan Liebig) - initial API and implementation
+* IBM - continuing development
+*******************************************************************************/
+package org.eclipse.equinox.internal.prov.artifact.repository;
+
+import java.io.*;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.prov.artifact.repository.processing.ProcessingStep;
+import org.eclipse.equinox.prov.core.helpers.FileUtils;
+import org.eclipse.equinox.prov.core.helpers.ServiceHelper;
+import org.eclipse.osgi.internal.provisional.verifier.CertificateVerifier;
+import org.eclipse.osgi.internal.provisional.verifier.CertificateVerifierFactory;
+
+/**
+ * The Pack200Unpacker expects an input containing ".jar.pack.gz" data.
+ */
+public class SignatureVerifier extends ProcessingStep {
+ private File inputFile;
+ private OutputStream tempStream;
+
+ public boolean areRequirementsSatisfied() {
+ return true;
+ }
+
+ public void write(int b) throws IOException {
+ getOutputStream().write(b);
+ }
+
+ private OutputStream getOutputStream() throws IOException {
+ if (tempStream != null)
+ return tempStream;
+ // store input stream in temporary file
+ inputFile = File.createTempFile("signatureFile", ".jar");
+ tempStream = new BufferedOutputStream(new FileOutputStream(inputFile));
+ return tempStream;
+ }
+
+ private void verify() throws IOException {
+ BufferedInputStream resultStream = null;
+ try {
+ if (tempStream == null)
+ // hmmm, no one wrote to this stream so there is nothing to pass on
+ return;
+ // Ok, so there is content, close the tempStream
+ tempStream.close();
+
+ CertificateVerifierFactory verifierFactory = (CertificateVerifierFactory) ServiceHelper.getService(Activator.getContext(), CertificateVerifierFactory.class.getName());
+ CertificateVerifier verifier = verifierFactory.getVerifier(inputFile);
+ if (verifier.verifyContent().length > 0)
+ status = new Status(IStatus.ERROR, "plugin id", "signature verification failure");
+ else
+ status = Status.OK_STATUS;
+ // now write the content to the final destination
+ resultStream = new BufferedInputStream(new FileInputStream(inputFile));
+ FileUtils.copyStream(resultStream, true, destination, false);
+ resultStream = null;
+ } finally {
+ if (inputFile != null)
+ inputFile.delete();
+ if (resultStream != null)
+ resultStream.close();
+ }
+ }
+
+ public void close() throws IOException {
+ // When we go to close we must have seen all the content we are going to see
+ // So before closing, verify and write the result to the destination
+ verify();
+ super.close();
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/SimpleArtifactRepository.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/SimpleArtifactRepository.java
new file mode 100644
index 000000000..556d8d969
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/SimpleArtifactRepository.java
@@ -0,0 +1,333 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.internal.prov.artifact.repository;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.prov.artifact.repository.*;
+import org.eclipse.equinox.prov.artifact.repository.processing.ProcessingStep;
+import org.eclipse.equinox.prov.artifact.repository.processing.ProcessingStepHandler;
+import org.eclipse.equinox.prov.core.helpers.MultiStatus;
+import org.eclipse.equinox.prov.core.repository.AbstractRepository;
+import org.eclipse.equinox.prov.core.repository.IRepositoryInfo;
+import org.eclipse.equinox.prov.metadata.IArtifactKey;
+
+public class SimpleArtifactRepository extends AbstractRepository implements IWritableArtifactRepository {
+
+ static final private String CONTENT_FILENAME = "artifacts.xml"; //$NON-NLS-1$
+ static final private String REPOSITORY_TYPE = SimpleArtifactRepository.class.getName();
+ static final private Integer REPOSITORY_VERSION = new Integer(1);
+ static final public String[][] DEFAULT_MAPPING_RULES = { {"(& (namespace=eclipse) (classifier=plugin))", "${repoUrl}/plugins/${id}_${version}.jar"}, //$NON-NLS-1$//$NON-NLS-2$
+ {"(& (namespace=eclipse) (classifier=native))", "${repoUrl}/native/${id}_${version}"}, //$NON-NLS-1$ //$NON-NLS-2$
+ {"(& (namespace=eclipse) (classifier=feature))", "${repoUrl}/features/${id}_${version}.jar"}}; //$NON-NLS-1$//$NON-NLS-2$
+
+ transient private Mapper mapper = new Mapper();
+ protected String[][] mappingRules = DEFAULT_MAPPING_RULES;
+ protected Set artifactDescriptors = new HashSet();
+ private boolean signatureVerification = false;
+
+ public static URL getActualLocation(URL base) {
+ String spec = base.toExternalForm();
+ if (spec.endsWith(CONTENT_FILENAME))
+ return base;
+ if (spec.endsWith("/")) //$NON-NLS-1$
+ spec += CONTENT_FILENAME;
+ else
+ spec += "/" + CONTENT_FILENAME; //$NON-NLS-1$
+ try {
+ return new URL(spec);
+ } catch (MalformedURLException e) {
+ return null;
+ }
+ }
+
+ public SimpleArtifactRepository(String repositoryName, URL location) {
+ super(repositoryName, REPOSITORY_TYPE, REPOSITORY_VERSION.toString(), location);
+ mapper.initialize(Activator.getContext(), mappingRules);
+ }
+
+ private IStatus getArtifact(ArtifactRequest request, IProgressMonitor monitor) {
+ request.setSourceRepository(this);
+ request.perform(monitor);
+ return request.getResult();
+ }
+
+ public IStatus getArtifacts(IArtifactRequest[] requests, IProgressMonitor monitor) {
+ SubMonitor subMonitor = SubMonitor.convert(monitor, requests.length);
+ try {
+ MultiStatus overallStatus = new MultiStatus();
+ for (int i = 0; i < requests.length; i++) {
+ if (monitor.isCanceled())
+ return Status.CANCEL_STATUS;
+ overallStatus.add(getArtifact((ArtifactRequest) requests[i], subMonitor.newChild(1)));
+ }
+ return (monitor.isCanceled() ? Status.CANCEL_STATUS : overallStatus);
+ } finally {
+ subMonitor.done();
+ }
+ }
+
+ private String basicGetArtifactLocation(IArtifactDescriptor descriptor) {
+ return computeLocation(descriptor.getArtifactKey());
+ }
+
+ private String basicGetArtifactLocation(IArtifactKey key) {
+ boolean found = false;
+ for (Iterator iterator = artifactDescriptors.iterator(); iterator.hasNext();) {
+ IArtifactDescriptor desc = (IArtifactDescriptor) iterator.next();
+ if (desc.getArtifactKey().equals(key)) { //TODO This should probably be a lookup in the set
+ found = true;
+ break;
+ }
+ }
+ return (found ? computeLocation(key) : null);
+ }
+
+ String computeLocation(IArtifactKey key) {
+ return mapper.map(location.toExternalForm(), key.getNamespace(), key.getClassifier(), key.getId(), key.getVersion().toString());
+ }
+
+ public IArtifactKey[] getArtifactKeys() {
+ // there may be more descriptors than keys to collect up the unique keys
+ HashSet result = new HashSet(artifactDescriptors.size());
+ for (Iterator it = artifactDescriptors.iterator(); it.hasNext();)
+ result.add(((IArtifactDescriptor) it.next()).getArtifactKey());
+ return (IArtifactKey[]) result.toArray(new IArtifactKey[result.size()]);
+ }
+
+ public URI getArtifact(IArtifactKey key) {
+ String result = basicGetArtifactLocation(key);
+ return (result != null ? URI.create(result) : null);
+ // if (location == null)
+ // return null;
+ // try {
+ // URL url = new URL(location);
+ // return new URI(url.getProtocol(), url.getHost(), url.getPath(), url.getQuery());
+ // } catch (MalformedURLException e) {
+ // throw new IllegalArgumentException(e);
+ // } catch (URISyntaxException e) {
+ // throw new IllegalArgumentException(e);
+ // }
+ }
+
+ public String toString() {
+ return location.toExternalForm();
+ }
+
+ public IStatus getArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) {
+ ProcessingStepHandler handler = new ProcessingStepHandler();
+ try {
+ destination = addPostSteps(handler, descriptor, destination, monitor);
+ destination = handler.createAndLink(descriptor.getProcessingSteps(), descriptor, destination, monitor);
+ destination = addPreSteps(handler, descriptor, destination, monitor);
+ IStatus status = handler.validateSteps(destination);
+ if (status.getCode() == IStatus.OK || status.getCode() == IStatus.INFO)
+ return getTransport().download(basicGetArtifactLocation(descriptor), destination, monitor);
+ return status;
+ } finally {
+ try {
+ //don't close the underlying output stream - the caller will do that
+ if (destination instanceof ProcessingStep)
+ destination.close();
+ } catch (IOException e) {
+ return new Status(IStatus.ERROR, Activator.ID, "Error closing processing steps", e);
+ }
+ }
+ }
+
+ private OutputStream addPostSteps(ProcessingStepHandler handler, IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) {
+ ArrayList steps = new ArrayList();
+ if (signatureVerification)
+ steps.add(new SignatureVerifier());
+ // if (md5Verification)
+ // steps.add(new MD5Verifier(descriptor.getProperty(IArtifactDescriptor.ARTIFACT_MD5)));
+ if (steps.isEmpty())
+ return destination;
+ ProcessingStep[] stepArray = (ProcessingStep[]) steps.toArray(new ProcessingStep[steps.size()]);
+ // TODO should probably be using createAndLink here
+ return handler.link(stepArray, destination, monitor);
+ }
+
+ private OutputStream addPreSteps(ProcessingStepHandler handler, IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) {
+ ArrayList steps = new ArrayList();
+ // Add steps here if needed
+ if (steps.isEmpty())
+ return destination;
+ ProcessingStep[] stepArray = (ProcessingStep[]) steps.toArray(new ProcessingStep[steps.size()]);
+ // TODO should probably be using createAndLink here
+ return handler.link(stepArray, destination, monitor);
+ }
+
+ private Transport getTransport() {
+ return ECFTransport.getInstance();
+ }
+
+ public IArtifactDescriptor[] getArtifactDescriptors(IArtifactKey key) {
+ ArrayList result = new ArrayList();
+ for (Iterator iterator = artifactDescriptors.iterator(); iterator.hasNext();) {
+ IArtifactDescriptor descriptor = (IArtifactDescriptor) iterator.next();
+ if (descriptor.getArtifactKey().equals(key))
+ result.add(descriptor);
+ }
+ return (IArtifactDescriptor[]) result.toArray(new IArtifactDescriptor[result.size()]);
+ }
+
+ private class ArtifactOutputStream extends OutputStream {
+ private OutputStream destination;
+ private IArtifactDescriptor descriptor;
+ private long count = 0;
+
+ public ArtifactOutputStream(OutputStream os, IArtifactDescriptor descriptor) {
+ this.destination = os;
+ this.descriptor = descriptor;
+ }
+
+ public void write(int b) throws IOException {
+ destination.write(b);
+ count++;
+ }
+
+ public void write(byte[] b) throws IOException {
+ destination.write(b);
+ count += b.length;
+ }
+
+ public void write(byte[] b, int off, int len) throws IOException {
+ destination.write(b, off, len);
+ count += len;
+ }
+
+ public void close() throws IOException {
+ // Write the artifact descriptor
+ destination.close();
+ ((ArtifactDescriptor) descriptor).setProperty(IArtifactDescriptor.DOWNLOAD_SIZE, Long.toString(count));
+ addDescriptor(descriptor);
+ }
+ }
+
+ public void addDescriptor(IArtifactDescriptor toAdd) {
+ // TODO: here we may want to ensure that the artifact has not been added concurrently
+ artifactDescriptors.add(toAdd);
+ save();
+ }
+
+ public void save() {
+ try {
+ FileOutputStream os = new FileOutputStream(getActualLocation(location).getFile());
+ ArtifactRepositoryIO.write(this, os);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public OutputStream getOutputStream(IArtifactDescriptor descriptor) {
+ // TODO we need a better way of distinguishing between errors and cases where
+ // the stuff just already exists
+ // Check if the artifact is already in this repository
+ if (contains(descriptor))
+ return null;
+
+ // Determine writing location
+ String location = computeLocation(descriptor.getArtifactKey());
+ if (location == null)
+ // TODO: Log an error, or throw an exception?
+ return null;
+
+ String file = null;
+ try {
+ file = new URL(location).getFile();
+ } catch (MalformedURLException e1) {
+ // This should not happen
+ }
+
+ File outputFile = new File(file);
+ if (outputFile.exists())
+ System.err.println("Artifact repository out of synch. Overwriting " + outputFile.getAbsoluteFile());
+
+ if (!outputFile.getParentFile().exists() && !outputFile.getParentFile().mkdirs())
+ // TODO: Log an error, or throw an exception?
+ return null;
+
+ try {
+ return new ArtifactOutputStream(new BufferedOutputStream(new FileOutputStream(file)), descriptor);
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public boolean contains(IArtifactDescriptor descriptor) {
+ return artifactDescriptors.contains(descriptor);
+ }
+
+ public boolean contains(IArtifactKey key) {
+ for (Iterator iterator = artifactDescriptors.iterator(); iterator.hasNext();) {
+ IArtifactDescriptor descriptor = (IArtifactDescriptor) iterator.next();
+ if (descriptor.getArtifactKey().equals(key))
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Return the set of descriptors in this repository.
+ * <b>NOTE:</b> this is NOT part of the API
+ * @return the set of descriptors
+ */
+ public Set getDescriptors() {
+ return artifactDescriptors;
+ }
+
+ public String[][] getRules() {
+ return mappingRules;
+ }
+
+ public void setRules(String[][] rules) {
+ mappingRules = rules;
+ }
+
+ public void tagAsImplementation() {
+ properties.setProperty(IRepositoryInfo.IMPLEMENTATION_ONLY_KEY, Boolean.valueOf(true).toString());
+ }
+
+ public void removeAll() {
+ artifactDescriptors.clear();
+ save();
+ }
+
+ public void removeDescriptor(IArtifactDescriptor descriptor) {
+ artifactDescriptors.remove(descriptor);
+ save();
+ }
+
+ public void removeDescriptor(IArtifactKey key) {
+ ArrayList toRemove = new ArrayList();
+ for (Iterator iterator = artifactDescriptors.iterator(); iterator.hasNext();) {
+ IArtifactDescriptor descriptor = (IArtifactDescriptor) iterator.next();
+ if (descriptor.getArtifactKey().equals(key))
+ toRemove.add(descriptor);
+ }
+ artifactDescriptors.removeAll(toRemove);
+ save();
+ }
+
+ // use this method to setup any transient fields etc after the object has been restored from a stream
+ public void initializeAfterLoad(URL location) {
+ this.location = location;
+ if (mapper == null)
+ mapper = new Mapper();
+ mapper.initialize(Activator.getContext(), mappingRules);
+ }
+
+ public void setSignatureVerification(boolean value) {
+ signatureVerification = value;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/SimpleArtifactRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/SimpleArtifactRepositoryFactory.java
new file mode 100644
index 000000000..d7295b329
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/SimpleArtifactRepositoryFactory.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.artifact.repository;
+
+import java.io.*;
+import java.net.URL;
+import org.eclipse.equinox.prov.artifact.repository.IArtifactRepository;
+import org.eclipse.equinox.prov.artifact.repository.IArtifactRepositoryFactory;
+import org.eclipse.equinox.prov.core.repository.RepositoryCreationException;
+
+public class SimpleArtifactRepositoryFactory implements IArtifactRepositoryFactory {
+
+ public IArtifactRepository load(URL location) {
+ if (location == null)
+ return null;
+ try {
+ InputStream descriptorStream = null;
+ try {
+ descriptorStream = new BufferedInputStream(SimpleArtifactRepository.getActualLocation(location).openStream());
+ SimpleArtifactRepository result = (SimpleArtifactRepository) ArtifactRepositoryIO.read(descriptorStream);
+ result.initializeAfterLoad(location);
+ return result;
+ } catch (RepositoryCreationException e) {
+ // TODO Auto-generated catch block
+ return null;
+ } finally {
+ if (descriptorStream != null)
+ descriptorStream.close();
+ }
+ } catch (IOException e) {
+ }
+ return null;
+ }
+
+ public IArtifactRepository create(URL location, String name, String type) {
+ return new SimpleArtifactRepository(name, location);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/Unpack200Step.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/Unpack200Step.java
new file mode 100644
index 000000000..0750ef994
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/prov/artifact/repository/Unpack200Step.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+* Copyright (c) 2007 compeople AG and others.
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*
+* Contributors:
+* compeople AG (Stefan Liebig) - initial API and implementation
+* IBM - continuing development
+*******************************************************************************/
+package org.eclipse.equinox.internal.prov.artifact.repository;
+
+import java.io.*;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.internal.p2.jarprocessor.UnpackStep;
+import org.eclipse.equinox.internal.p2.jarprocessor.Utils;
+import org.eclipse.equinox.p2.jarprocessor.JarProcessorExecutor;
+import org.eclipse.equinox.p2.jarprocessor.JarProcessorExecutor.Options;
+import org.eclipse.equinox.prov.artifact.repository.processing.ProcessingStep;
+import org.eclipse.equinox.prov.core.helpers.FileUtils;
+
+/**
+ * The Pack200Unpacker expects an input containing ".jar.pack.gz" data.
+ */
+public class Unpack200Step extends ProcessingStep {
+ private final static String PACKED_EXT = Utils.JAR_SUFFIX + Utils.PACKED_SUFFIX;
+
+ private File packed;
+ private OutputStream tempStream;
+
+ public boolean areRequirementsSatisfied() {
+ return UnpackStep.canUnpack();
+ }
+
+ public void write(int b) throws IOException {
+ OutputStream stream = getOutputStream();
+ stream.write(b);
+ }
+
+ private OutputStream getOutputStream() throws IOException {
+ if (tempStream != null)
+ return tempStream;
+ // store input stream in temporary file
+ packed = File.createTempFile("pack200", PACKED_EXT);
+ tempStream = new BufferedOutputStream(new FileOutputStream(packed));
+ return tempStream;
+ }
+
+ private void performUnpack() throws IOException {
+ BufferedInputStream unpackedStream = null;
+ File unpacked = null;
+ File workDir = null;
+ try {
+ if (tempStream == null)
+ // hmmm, no one wrote to this stream so there is nothing to pass on
+ return;
+ // Ok, so there is content, close the tempStream
+ tempStream.close();
+ // now create a temporary directory for the JarProcessor to work in
+ // TODO How to create a unique, temporary directory atomically?
+ workDir = File.createTempFile("work", "");
+ if (!workDir.delete())
+ throw new IOException("Could not delete file for creating temporary working dir.");
+ if (!workDir.mkdirs())
+ throw new IOException("Could not create temporary working dir.");
+
+ // unpack
+ Options options = new Options();
+ options.unpack = true;
+ options.processAll = true;
+ options.input = packed;
+ options.outputDir = workDir.getPath();
+ new JarProcessorExecutor().runJarProcessor(options);
+
+ // now write the unpacked content to our destination
+ String packedFileName = packed.getName();
+ unpacked = new File(workDir, packedFileName.substring(0, packedFileName.length() - Utils.PACKED_SUFFIX.length()));
+ unpackedStream = new BufferedInputStream(new FileInputStream(unpacked));
+ FileUtils.copyStream(unpackedStream, true, destination, false);
+ unpackedStream = null;
+ } finally {
+ if (packed != null)
+ packed.delete();
+ if (unpackedStream != null)
+ unpackedStream.close();
+ if (unpacked != null)
+ unpacked.delete();
+ if (workDir != null)
+ workDir.delete();
+ }
+ }
+
+ public void close() throws IOException {
+ // When we go to close we must have seen all the content we are going to see
+ // So before closing, run unpack and write the unpacked result to the destination
+ performUnpack();
+ super.close();
+ if (status == null)
+ status = Status.OK_STATUS;
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/ArtifactDescriptor.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/ArtifactDescriptor.java
new file mode 100644
index 000000000..e33e07269
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/ArtifactDescriptor.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.artifact.repository;
+
+import java.util.*;
+import org.eclipse.equinox.prov.artifact.repository.processing.ProcessingStepDescriptor;
+import org.eclipse.equinox.prov.metadata.IArtifactKey;
+
+/**
+ * This represents information about a given artifact stored on a particular byte server.
+ */
+public class ArtifactDescriptor implements IArtifactDescriptor {
+ private static int hashCode(Object[] array) {
+ int prime = 31;
+ if (array == null)
+ return 0;
+ int result = 1;
+ for (int index = 0; index < array.length; index++) {
+ result = prime * result + (array[index] == null ? 0 : array[index].hashCode());
+ }
+ return result;
+ }
+
+ protected IArtifactKey key; // The key associated with this artifact
+
+ // The list of post processing steps that must be applied one the artifact once it
+ // has been downloaded (e.g, unpack, then md5 checksum, then...)
+ protected ProcessingStepDescriptor[] processingSteps = null;
+
+ protected Map properties = new HashMap(2);
+
+ //QUESTION: Do we need any description or user readable name
+
+ public ArtifactDescriptor(IArtifactKey key) {
+ super();
+ this.key = key;
+ }
+
+ public IArtifactKey getArtifactKey() {
+ return key;
+ }
+
+ public String getProperty(String key) {
+ return (String) properties.get(key);
+ }
+
+ public void setProperty(String key, String value) {
+ properties.put(key, value);
+ }
+
+ public ProcessingStepDescriptor[] getProcessingSteps() {
+ return processingSteps;
+ }
+
+ public void setProcessingSteps(ProcessingStepDescriptor[] value) {
+ processingSteps = value;
+ }
+
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ArtifactDescriptor other = (ArtifactDescriptor) obj;
+ if (key == null) {
+ if (other.key != null)
+ return false;
+ } else if (!key.equals(other.key))
+ return false;
+ if (!Arrays.equals(processingSteps, other.processingSteps))
+ return false;
+ if (properties == null) {
+ if (other.properties != null)
+ return false;
+ } else if (!properties.equals(other.properties))
+ return false;
+ return true;
+ }
+
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((key == null) ? 0 : key.hashCode());
+ result = prime * result + ArtifactDescriptor.hashCode(processingSteps);
+ result = prime * result + ((properties == null) ? 0 : properties.hashCode());
+ return result;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/IArtifactDescriptor.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/IArtifactDescriptor.java
new file mode 100644
index 000000000..0cc89ef71
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/IArtifactDescriptor.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.artifact.repository;
+
+import org.eclipse.equinox.prov.artifact.repository.processing.ProcessingStepDescriptor;
+import org.eclipse.equinox.prov.metadata.IArtifactKey;
+
+public interface IArtifactDescriptor {
+
+ public static final String DOWNLOAD_SIZE = "download.size"; //$NON-NLS-1$
+ public static final String ARTIFACT_SIZE = "artifact.size"; //$NON-NLS-1$
+ public static final String DOWNLOAD_MD5 = "download.md5"; //$NON-NLS-1$
+ public static final String ARTIFACT_MD5 = "artifact.md5"; //$NON-NLS-1$
+
+ public abstract IArtifactKey getArtifactKey();
+
+ public abstract String getProperty(String key);
+
+ public abstract ProcessingStepDescriptor[] getProcessingSteps();
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/IArtifactRepository.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/IArtifactRepository.java
new file mode 100644
index 000000000..daf900aa1
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/IArtifactRepository.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.artifact.repository;
+
+import java.io.OutputStream;
+import java.net.URI;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.equinox.prov.core.repository.IRepositoryInfo;
+import org.eclipse.equinox.prov.metadata.IArtifactKey;
+
+/**
+ * TODO: Convert to abstract class
+ */
+public interface IArtifactRepository extends IRepositoryInfo {
+ /**
+ * Returns true if this repository contains the given descriptor.
+ * @param descriptor the descriptor to query
+ * @return true if the given descriptor is already in this repository
+ */
+ public boolean contains(IArtifactDescriptor descriptor);
+
+ /**
+ * Returns true if this repository contains the given artifact key.
+ * @param key the key to query
+ * @return true if the given key is already in this repository
+ */
+ public boolean contains(IArtifactKey key);
+
+ /**
+ * Executes the given artifact requests on this byte server.
+ * @param requests The artifact requests
+ * @param monitor
+ * @return a status object that is <code>OK</code> if requests were
+ * processed successfully. Otherwise, a status indicating information,
+ * warnings, or errors that occurred while executing the artifact requests
+ */
+ public IStatus getArtifacts(IArtifactRequest[] requests, IProgressMonitor monitor);
+
+ /**
+ * Return the set of artifact descriptors describing the ways that this repository
+ * can supply the artifact associated with the given artifact key
+ * @param key the artifact key to lookup
+ * @return the descriptors associated with the given key
+ */
+ public IArtifactDescriptor[] getArtifactDescriptors(IArtifactKey key);
+
+ /**
+ * Return a stream containing the described artifact, or null if not available
+ */
+ public IStatus getArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor);
+
+ /**
+ * Returns the list of artifact keys managed by this repository
+ * @return list of artifact keys
+ */
+ public IArtifactKey[] getArtifactKeys();
+
+ // TODO move this to a local repo interface and change to return a file
+ /**
+ * Return a URI to the given key, or null if not available
+ */
+ public URI getArtifact(IArtifactKey key);
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/IArtifactRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/IArtifactRepositoryFactory.java
new file mode 100644
index 000000000..b3d9dca07
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/IArtifactRepositoryFactory.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.artifact.repository;
+
+import java.net.URL;
+
+public interface IArtifactRepositoryFactory {
+
+ public IArtifactRepository load(URL location);
+
+ public IArtifactRepository create(URL location, String name, String type);
+}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/IArtifactRepositoryManager.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/IArtifactRepositoryManager.java
new file mode 100644
index 000000000..ace98461d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/IArtifactRepositoryManager.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.artifact.repository;
+
+import java.net.URL;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.equinox.prov.metadata.IArtifactKey;
+
+public interface IArtifactRepositoryManager {
+ public static final IArtifactRequest[] NO_ARTIFACT_REQUEST = new IArtifactRequest[0];
+
+ /**
+ * Return the list of artifact repositories known by this manager.
+ * @return the list of known repositories
+ */
+ public IArtifactRepository[] getKnownRepositories();
+
+ /**
+ * Add a repository at the given location. The location is expected to contain
+ * data that describes a valid artifact repository of a known type. If this manager
+ * already knows a repository at the given location then that repository is returned.
+ * @param location the location in which to look for a repository description
+ * @monitor
+ * @return a repository object for the given location or <code>null</code> if a repository
+ * could not be found or loaded.
+ */
+ public IArtifactRepository loadRepository(URL location, IProgressMonitor monitor);
+
+ /**
+ * Add the given repository to the set of repositories managed by this manager.
+ * @param repository the repository to add
+ */
+ public void addRepository(IArtifactRepository repository);
+
+ /**
+ * Return the artifact repository at the given location if known by this manager.
+ * Otherwise return <code>null</code>
+ * @param location the location of the repository to return
+ * @return the found repository
+ */
+ public IArtifactRepository getRepository(URL location);
+
+ /**
+ * Remove the given repository from this manager. Do nothing if the repository
+ * is not currently managed.
+ * @param toRemove the repository to remove
+ */
+ public void removeRepository(IArtifactRepository toRemove);
+
+ /**
+ * Creates and returns an artifact repository of the given type at the given location.
+ * If a repository already exists at that location <code>null</code> is returned.
+ * @param location the location for the new repository
+ * @param name the name of the new repo
+ * @param type the kind of repository to create
+ * @return the discovered or created repository
+ */
+ public IArtifactRepository createRepository(URL location, String name, String type);
+
+ /**
+ * Return a new request to download the given artifact and store it at the given destination.
+ * @param key the artifact to download
+ * @param destination the destination where the artifact will be stored
+ * @return the newly created request object
+ */
+ public IArtifactRequest createDownloadRequest(IArtifactKey key, IPath destination);
+
+ /**
+ * Return a new request to mirror the given artifact into the destination repository.
+ * @param key the artifact to mirror
+ * @param destination the destination where the artifact will be mirrored
+ * @return the newly created request object
+ */
+ public IArtifactRequest createMirrorRequest(IArtifactKey key, IWritableArtifactRepository destination);
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/IArtifactRequest.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/IArtifactRequest.java
new file mode 100644
index 000000000..2a86946b4
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/IArtifactRequest.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.artifact.repository;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.equinox.internal.prov.artifact.repository.ArtifactRequest;
+import org.eclipse.equinox.prov.metadata.IArtifactKey;
+
+/**
+ * This interface is not intended to be implemented by clients
+ */
+public interface IArtifactRequest {
+
+ public IArtifactKey getArtifactKey();
+
+ /**
+ * Returns the result of the previous call to {@link ArtifactRequest#perform(IProgressMonitor)},
+ * or <code>null</code> if perform has never been called.
+ *
+ * @return The result of the previous perform call.
+ */
+ public IStatus getResult();
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/IWritableArtifactRepository.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/IWritableArtifactRepository.java
new file mode 100644
index 000000000..227c68ec5
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/IWritableArtifactRepository.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.artifact.repository;
+
+import java.io.OutputStream;
+import org.eclipse.equinox.prov.metadata.IArtifactKey;
+
+// TODO consider having the add and remove methods take several keys/descriptors
+// to operate on at one time.
+
+public interface IWritableArtifactRepository extends IArtifactRepository {
+
+ /**
+ * Open an output stream to which a client can write the data for the given
+ * artifact descriptor.
+ * @param descriptor the descriptor describing the artifact data to be written to the
+ * resultant stream
+ * @return the stream to which the artifact content can be written
+ */
+ public OutputStream getOutputStream(IArtifactDescriptor descriptor);
+
+ /**
+ * Add the given descriptor to the set of descriptors in this repository. This is
+ * a relatively low-level operation that should be used only when the actual related
+ * content is in this repository and the given descriptor accurately describes
+ * that content.
+ * @param descriptor the descriptor to add.
+ */
+ public void addDescriptor(IArtifactDescriptor descriptor);
+
+ /**
+ * Remove the given descriptor from the set of descriptors in this repository.
+ * @param descriptor the descriptor to remove.
+ */
+ public void removeDescriptor(IArtifactDescriptor descriptor);
+
+ /**
+ * Remove the given key and all related descriptors from this repository.
+ * @param key the key to remove.
+ */
+ public void removeDescriptor(IArtifactKey key);
+
+ /**
+ * Remove the all key and descriptor information from this repository.
+ */
+ public void removeAll();
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/Mapper.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/Mapper.java
new file mode 100644
index 000000000..b84bff2ed
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/Mapper.java
@@ -0,0 +1,130 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.artifact.repository;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import org.osgi.framework.*;
+
+public class Mapper {
+ private Filter[] filters;
+ private String[] outputStrings;
+
+ private static final String REPOURL = "repoUrl";
+ private static final String NAMESPACE = "namespace";
+ private static final String CLASSIFIER = "classifier";
+ private static final String ID = "id";
+ private static final String VERSION = "version";
+
+ public Mapper() {
+ filters = new Filter[0];
+ outputStrings = new String[0];
+ }
+
+ /**
+ * mapping rule: LDAP filter --> output value
+ * the more specific filters should be given first.
+ */
+ public void initialize(BundleContext ctx, String[][] mappingRules) {
+ filters = new Filter[mappingRules.length];
+ outputStrings = new String[mappingRules.length];
+ for (int i = 0; i < mappingRules.length; i++) {
+ try {
+ filters[i] = ctx.createFilter(mappingRules[i][0]);
+ outputStrings[i] = mappingRules[i][1];
+ } catch (InvalidSyntaxException e) {
+ //TODO Neeed to process this
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public String map(String repoUrl, String namespace, String classifier, String id, String version) {
+ Dictionary values = new Hashtable(5);
+ if (repoUrl != null)
+ values.put(REPOURL, repoUrl);
+
+ if (namespace != null)
+ values.put(NAMESPACE, namespace);
+
+ if (classifier != null)
+ values.put(CLASSIFIER, classifier);
+
+ if (id != null)
+ values.put(ID, id);
+
+ if (version != null)
+ values.put(VERSION, version);
+
+ for (int i = 0; i < filters.length; i++) {
+ if (filters[i].match(values))
+ return doReplacement(outputStrings[i], repoUrl, namespace, classifier, id, version);
+ }
+ return null;
+ }
+
+ private String doReplacement(String pattern, String repoUrl, String namespace, String classifier, String id, String version) {
+
+ // currently our mapping rules assume the repo URL is not "/" terminated.
+ // This may be the case for repoURLs in the root of a URL space e.g. root of a jar file or file:/c:/
+ if (repoUrl.endsWith("/"))
+ repoUrl = repoUrl.substring(0, repoUrl.length() - 1);
+
+ StringBuffer output = new StringBuffer(pattern);
+ int index = 0;
+ while (index < output.length()) {
+ int beginning = output.indexOf("${", index);
+ if (beginning == -1)
+ return output.toString();
+
+ int end = output.indexOf("}", beginning);
+ if (end == -1)
+ return pattern;
+
+ String varName = output.substring(beginning + 2, end);
+ String varValue = null;
+ if (varName.equalsIgnoreCase(NAMESPACE)) {
+ varValue = namespace;
+ } else if (varName.equalsIgnoreCase(CLASSIFIER)) {
+ varValue = classifier;
+ } else if (varName.equalsIgnoreCase(ID)) {
+ varValue = id;
+ } else if (varName.equalsIgnoreCase(VERSION)) {
+ varValue = version;
+ } else if (varName.equalsIgnoreCase(REPOURL)) {
+ varValue = repoUrl;
+ }
+ if (varValue == null)
+ varValue = "";
+
+ output.replace(beginning, end + 1, varValue);
+ index = beginning + varValue.length();
+ }
+ return output.toString();
+ }
+
+ public String toString() {
+ StringBuffer result = new StringBuffer();
+ for (int i = 0; i < filters.length; i++) {
+ result.append(filters[i]).append('-').append('>').append(outputStrings[i]).append('\n');
+ }
+ return result.toString();
+ }
+
+ public String[][] serialize() {
+ String[][] result = new String[filters.length][2];
+ for (int i = 0; i < filters.length; i++) {
+ result[i][0] = filters[i].toString();
+ result[i][1] = outputStrings[i].toString();
+ }
+ return result;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/RepositoryDescriptor.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/RepositoryDescriptor.java
new file mode 100644
index 000000000..cb8a0378a
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/RepositoryDescriptor.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.artifact.repository;
+
+import java.net.URI;
+import org.eclipse.equinox.prov.metadata.IArtifactKey;
+import org.osgi.framework.Version;
+
+public abstract class RepositoryDescriptor {
+ /**
+ * Return the type of repository described.
+ * @return the type of repository
+ */
+ public abstract String getType();
+
+ /**
+ * Return the version of the repository
+ * @return the version of the repository
+ */
+ public abstract Version getVersion();
+
+ /**
+ * The set of transports that can be used to download artifacts from this repository
+ * @return an array of
+ */
+ public abstract String[] getTransports();
+
+ public abstract IArtifactDescriptor getArtifact(IArtifactKey key);
+
+ public abstract URI getBaseURL(); //the url to be used as a base for download
+}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/Transport.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/Transport.java
new file mode 100644
index 000000000..c8ff18afe
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/Transport.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.artifact.repository;
+
+import java.io.OutputStream;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+
+public abstract class Transport {
+ public abstract IStatus download(String toDownload, OutputStream target, IProgressMonitor pm);
+}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/processing/ProcessingStep.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/processing/ProcessingStep.java
new file mode 100644
index 000000000..f6338eeaf
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/processing/ProcessingStep.java
@@ -0,0 +1,116 @@
+/*******************************************************************************
+* Copyright (c) 2007 compeople AG and others.
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*
+* Contributors:
+* compeople AG (Stefan Liebig) - initial API and implementation
+* IBM Corporation - continuing development
+*******************************************************************************/
+package org.eclipse.equinox.prov.artifact.repository.processing;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.internal.prov.artifact.repository.Activator;
+import org.eclipse.equinox.prov.artifact.repository.IArtifactDescriptor;
+
+/**
+ * ProcessingSteps process the data written to them and pass the resultant data on
+ * to a configured destination stream. Steps may monitor (e.g., count) the data, compute information
+ * about the data (e.g., checksum or hash) or transform the data (e.g., unpack200).
+ */
+public abstract class ProcessingStep extends OutputStream {
+ protected OutputStream destination;
+ protected IProgressMonitor monitor;
+ protected IStatus status = Status.OK_STATUS;
+
+ protected ProcessingStep() {
+ super();
+ }
+
+ /**
+ * Initialize this processing step according to the information in the given
+ * descriptor and context. After initialization, this step is ready for linking
+ * with other steps or output streams
+ * @param descriptor description of the step
+ * @param context the context in which the step is being used
+ */
+ public void initialize(ProcessingStepDescriptor descriptor, IArtifactDescriptor context) {
+ }
+
+ /**
+ * Link this step with the given output stream and configure the step to use the given
+ * progress monitor. After linking the step is ready to have data written to it.
+ * @param destination the stream into which to write the processed data
+ * @param monitor the progress monitor to use for reporting activity
+ */
+ public void link(OutputStream destination, IProgressMonitor monitor) {
+ this.destination = destination;
+ this.monitor = monitor;
+ }
+
+ /**
+ * Process the given byte and pass the result on to the configured destination stream
+ * @param b the byte being written
+ */
+ public void write(int b) throws IOException {
+ }
+
+ /**
+ * Flush any unwritten data from this stream.
+ */
+ public void flush() throws IOException {
+ super.flush();
+ if (destination != null)
+ destination.flush();
+ }
+
+ /**
+ * Close this stream and, if the configured destination is a ProcessingStep,
+ * close it as well. Typically a chain of steps terminates in a conventional
+ * output stream. Implementors of this method should ensure they set the
+ * status of the step.
+ */
+ public void close() throws IOException {
+ super.close();
+ if (destination instanceof ProcessingStep)
+ destination.close();
+ destination = null;
+ monitor = null;
+ }
+
+ /**
+ * Return the status of this step. The status will be <code>null</code> if the
+ * step has not yet executed. If the step has executed the returned status
+ * indicates the success or failure of the step.
+ * @param deep whether or not to aggregate the status of any linked steps
+ * @return the requested status
+ */
+ public IStatus getStatus(boolean deep) {
+ if (!deep)
+ return status;
+ ArrayList list = new ArrayList();
+ int severity = collectStatus(list);
+ if (severity == IStatus.OK)
+ return Status.OK_STATUS;
+ IStatus[] result = (IStatus[]) list.toArray(new IStatus[list.size()]);
+ return new MultiStatus(Activator.ID, severity, result, "Result of processing steps", null);
+ }
+
+ private int collectStatus(ArrayList list) {
+ list.add(status);
+ if (!(destination instanceof ProcessingStep))
+ return status.getSeverity();
+ int result = ((ProcessingStep) destination).collectStatus(list);
+ // TODO greater than test here is a little brittle but it is very unlikely that we will add
+ // a new status severity.
+ if (status.getSeverity() > result)
+ return status.getSeverity();
+ return result;
+
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/processing/ProcessingStepDescriptor.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/processing/ProcessingStepDescriptor.java
new file mode 100644
index 000000000..e79910ef0
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/processing/ProcessingStepDescriptor.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+* Copyright (c) 2007 compeople AG and others.
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*
+* Contributors:
+* compeople AG (Stefan Liebig) - initial API and implementation
+*******************************************************************************/
+package org.eclipse.equinox.prov.artifact.repository.processing;
+
+/**
+ * The description of a processor step.
+ */
+public class ProcessingStepDescriptor {
+
+ private final String processorId; //the operation to be applied (e.g: unpack, md5, signature verification, etc.)
+ private final String data; //data requested for the processing (eg. expected checksum)
+ private final boolean required; //whether the step is optional or not
+
+ /**
+ * Create a processing step description.
+ *
+ * @param processorId
+ * @param data
+ * @param required
+ */
+ public ProcessingStepDescriptor(String processorId, String data, boolean required) {
+ super();
+ this.processorId = processorId;
+ this.data = data;
+ this.required = required;
+ }
+
+ public String getProcessorId() {
+ return processorId;
+ }
+
+ public String getData() {
+ return data;
+ }
+
+ public boolean isRequired() {
+ return required;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((data == null) ? 0 : data.hashCode());
+ result = prime * result + ((processorId == null) ? 0 : processorId.hashCode());
+ result = prime * result + (required ? 1231 : 1237);
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (!(obj instanceof ProcessingStepDescriptor))
+ return false;
+ final ProcessingStepDescriptor other = (ProcessingStepDescriptor) obj;
+ if (data == null) {
+ if (other.data != null)
+ return false;
+ } else if (!data.equals(other.data))
+ return false;
+ if (processorId == null) {
+ if (other.processorId != null)
+ return false;
+ } else if (!processorId.equals(other.processorId))
+ return false;
+ if (required != other.required)
+ return false;
+ return true;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/processing/ProcessingStepHandler.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/processing/ProcessingStepHandler.java
new file mode 100644
index 000000000..e1777da14
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/prov/artifact/repository/processing/ProcessingStepHandler.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+* Copyright (c) 2007 compeople AG and others.
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*
+* Contributors:
+* compeople AG (Stefan Liebig) - initial API and implementation
+* IBM - continuing development
+*******************************************************************************/
+package org.eclipse.equinox.prov.artifact.repository.processing;
+
+import java.io.OutputStream;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.internal.prov.artifact.repository.Activator;
+import org.eclipse.equinox.prov.artifact.repository.IArtifactDescriptor;
+
+/**
+ * Creates processing step instances from extensions and executes them.
+ */
+public class ProcessingStepHandler {
+
+ public ProcessingStep[] create(ProcessingStepDescriptor[] descriptors, IArtifactDescriptor context) {
+ ProcessingStep[] result = new ProcessingStep[descriptors.length];
+ for (int i = 0; i < descriptors.length; i++)
+ result[i] = create(descriptors[i], context);
+ return result;
+ }
+
+ public ProcessingStep create(ProcessingStepDescriptor descriptor, IArtifactDescriptor context) {
+ IExtensionRegistry registry = RegistryFactory.getRegistry();
+ IExtension extension = registry.getExtension("org.eclipse.equinox.prov.artifact.repository.processingSteps", descriptor.getProcessorId()); //$NON-NLS-1$
+ IConfigurationElement[] config = extension.getConfigurationElements();
+ Exception error = null;
+ try {
+ Object object = config[0].createExecutableExtension("class"); //$NON-NLS-1$
+ if (object instanceof ProcessingStep) {
+ ProcessingStep step = (ProcessingStep) object;
+ step.initialize(descriptor, context);
+ return step;
+ }
+ } catch (CoreException e) {
+ error = e;
+ }
+ int severity = descriptor.isRequired() ? IStatus.ERROR : IStatus.INFO;
+ ProcessingStep result = new ProcessingStep() {};
+ result.status = new Status(severity, Activator.ID, "Could not instantiate step:" + descriptor.getProcessorId(), error);
+ return result;
+ }
+
+ public OutputStream createAndLink(ProcessingStepDescriptor[] descriptors, IArtifactDescriptor context, OutputStream output, IProgressMonitor monitor) {
+ if (descriptors == null)
+ return output;
+ ProcessingStep[] steps = create(descriptors, context);
+ return link(steps, output, monitor);
+ }
+
+ public OutputStream link(ProcessingStep[] steps, OutputStream output, IProgressMonitor monitor) {
+ OutputStream previous = output;
+ for (int i = steps.length - 1; i >= 0; i--) {
+ ProcessingStep step = steps[i];
+ step.link(previous, monitor);
+ previous = step;
+ }
+ return previous;
+ }
+
+ public IStatus validateSteps(OutputStream output) {
+ if (!(output instanceof ProcessingStep))
+ return Status.OK_STATUS;
+ return ((ProcessingStep) output).getStatus(true);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.console/.classpath b/bundles/org.eclipse.equinox.p2.console/.classpath
new file mode 100644
index 000000000..7cdeb7319
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.console/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/CDC-1.1%Foundation-1.1"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.equinox.p2.console/.project b/bundles/org.eclipse.equinox.p2.console/.project
new file mode 100644
index 000000000..7c645a5cb
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.console/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.equinox.prov.console</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.equinox.p2.console/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.console/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..a455b6228
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.console/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,340 @@
+#Thu Sep 13 22:02:41 EDT 2007
+eclipse.preferences.version=1
+instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
+org.eclipse.jdt.core.builder.cleanOutputFolder=clean
+org.eclipse.jdt.core.builder.duplicateResourceTask=warning
+org.eclipse.jdt.core.builder.invalidClasspath=abort
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
+org.eclipse.jdt.core.circularClasspath=error
+org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
+org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=error
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=ignore
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=false
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false
+org.eclipse.jdt.core.formatter.comment.format_line_comments=false
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=800
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.incompatibleJDKLevel=ignore
+org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/bundles/org.eclipse.equinox.p2.console/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.p2.console/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 000000000..b61b6ad25
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.console/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,57 @@
+#Sun Sep 23 11:57:44 EDT 2007
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_core
+formatter_settings_version=11
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=;
+org.eclipse.jdt.ui.ondemandthreshold=3
+org.eclipse.jdt.ui.staticondemandthreshold=3
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates/>
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.format_source_code=true
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_variable_declarations_final=true
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=false
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/bundles/org.eclipse.equinox.p2.console/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.console/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..d9dbf8884
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.console/META-INF/MANIFEST.MF
@@ -0,0 +1,29 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Provisioning Console Plug-in (Incubation)
+Bundle-SymbolicName: org.eclipse.equinox.prov.console
+Bundle-Version: 0.1.0.qualifier
+Bundle-Activator: org.eclipse.equinox.internal.prov.console.Activator
+Bundle-Vendor: IBM
+Eclipse-LazyStart: true
+Export-Package: org.eclipse.equinox.internal.prov.console;x-friends:="org.eclipse.equinox.prov.director.app,org.eclipse.equinox.prov.tools"
+Import-Package: org.eclipse.core.runtime;common=split,
+ org.eclipse.equinox.configurator,
+ org.eclipse.equinox.prov.artifact.repository,
+ org.eclipse.equinox.prov.core,
+ org.eclipse.equinox.prov.core.helpers,
+ org.eclipse.equinox.prov.core.location,
+ org.eclipse.equinox.prov.core.repository,
+ org.eclipse.equinox.prov.director,
+ org.eclipse.equinox.prov.engine,
+ org.eclipse.equinox.prov.installregistry,
+ org.eclipse.equinox.prov.metadata,
+ org.eclipse.equinox.prov.metadata.repository,
+ org.eclipse.equinox.prov.query,
+ org.eclipse.osgi.framework.console;version="1.0.0";resolution:=optional,
+ org.eclipse.osgi.service.environment;version="1.0.0",
+ org.eclipse.osgi.service.resolver;version="1.1.0",
+ org.osgi.framework;version="1.4.0",
+ org.osgi.util.tracker;version="1.3.3"
+Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
+ J2SE-1.4
diff --git a/bundles/org.eclipse.equinox.p2.console/Provisioning console.launch b/bundles/org.eclipse.equinox.p2.console/Provisioning console.launch
new file mode 100644
index 000000000..d255cbeb7
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.console/Provisioning console.launch
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.pde.ui.EquinoxLauncher">
+<booleanAttribute key="automaticAdd" value="false"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="false"/>
+<stringAttribute key="configLocation" value="d:\tmp\selfhosting"/>
+<booleanAttribute key="default_auto_start" value="false"/>
+<intAttribute key="default_start_level" value="4"/>
+<booleanAttribute key="includeOptional" value="true"/>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-console -consolelog"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="target_bundles" value="org.eclipse.core.jobs@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.common@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.osgi@:,org.eclipse.osgi.services@default:default"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useDefaultConfigArea" value="false"/>
+<stringAttribute key="workspace_bundles" value="com.thoughtworks.xstream@default:default,org.eclipse.ecf@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.ecf.provider.filetransfer@default:default,org.eclipse.equinox.frameworkadmin@default:default,org.eclipse.equinox.frameworkadmin.equinox@default:true,org.eclipse.equinox.prov.artifact.repository@default:default,org.eclipse.equinox.prov.console@default:true,org.eclipse.equinox.prov.core@default:default,org.eclipse.equinox.prov.director@default:default,org.eclipse.equinox.prov.download@default:default,org.eclipse.equinox.prov.engine@default:default,org.eclipse.equinox.prov.examplarysetup@default:true,org.eclipse.equinox.prov.metadata@default:default,org.eclipse.equinox.prov.metadata.repository@default:default,org.eclipse.equinox.prov.touchpoint.eclipse@default:default,org.eclipse.equinox.prov.touchpoint.natives@default:default,org.eclipse.equinox.simpleconfigurator@1:true,org.eclipse.equinox.simpleconfigurator.manipulator@default:default,org.mozilla.rhino@default:default"/>
+</launchConfiguration>
diff --git a/bundles/org.eclipse.equinox.p2.console/build.properties b/bundles/org.eclipse.equinox.p2.console/build.properties
new file mode 100644
index 000000000..4a49c9482
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.console/build.properties
@@ -0,0 +1,14 @@
+###############################################################################
+# Copyright (c) 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/prov/console/Activator.java b/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/prov/console/Activator.java
new file mode 100644
index 000000000..28017a393
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/prov/console/Activator.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.console;
+
+import org.eclipse.equinox.prov.engine.IProfileRegistry;
+import org.osgi.framework.*;
+import org.osgi.util.tracker.ServiceTracker;
+import org.osgi.util.tracker.ServiceTrackerCustomizer;
+
+public class Activator implements BundleActivator, ServiceTrackerCustomizer {
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.equinox.prov.console"; //$NON-NLS-1$
+ private static final String PROVIDER_NAME = "org.eclipse.osgi.framework.console.CommandProvider"; //$NON-NLS-1$
+ private static BundleContext context;
+
+ private ServiceTracker profileTracker;
+ private ProvCommandProvider provider;
+ private ServiceRegistration providerRegistration = null;
+
+ public static BundleContext getContext() {
+ return context;
+ }
+
+ public Activator() {
+ super();
+ }
+
+ public void start(BundleContext context) throws Exception {
+ Activator.context = context;
+ boolean registerCommands = true;
+ try {
+ Class.forName(PROVIDER_NAME);
+ } catch (ClassNotFoundException e) {
+ registerCommands = false;
+ }
+
+ if (registerCommands) {
+ profileTracker = new ServiceTracker(context, IProfileRegistry.class.getName(), this);
+ profileTracker.open();
+ }
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ profileTracker.close();
+ if (providerRegistration != null)
+ providerRegistration.unregister();
+ providerRegistration = null;
+ Activator.context = null;
+ }
+
+ public Object addingService(ServiceReference reference) {
+ BundleContext context = Activator.getContext();
+ IProfileRegistry registry = (IProfileRegistry) context.getService(reference);
+ provider = new ProvCommandProvider(context.getProperty("eclipse.prov.profile"), registry);
+ providerRegistration = context.registerService(PROVIDER_NAME, provider, null);
+ return registry;
+ }
+
+ public void modifiedService(ServiceReference reference, Object service) {
+ // TODO Auto-generated method stub
+ }
+
+ public void removedService(ServiceReference reference, Object service) {
+ if (providerRegistration != null)
+ providerRegistration.unregister();
+ providerRegistration = null;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/prov/console/ProvCommandProvider.java b/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/prov/console/ProvCommandProvider.java
new file mode 100644
index 000000000..698c17b90
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/prov/console/ProvCommandProvider.java
@@ -0,0 +1,345 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.internal.prov.console;
+
+import java.net.*;
+import java.util.*;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.equinox.prov.artifact.repository.IArtifactRepository;
+import org.eclipse.equinox.prov.core.ProvisionException;
+import org.eclipse.equinox.prov.engine.IProfileRegistry;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.*;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepository;
+import org.eclipse.equinox.prov.query.Query;
+import org.eclipse.osgi.framework.console.CommandInterpreter;
+import org.eclipse.osgi.framework.console.CommandProvider;
+import org.eclipse.osgi.service.resolver.VersionRange;
+
+/**
+ * An OSGi console command provider that adds various commands for interacting
+ * with the provisioning system.
+ */
+public class ProvCommandProvider implements CommandProvider {
+ public static final String NEW_LINE = System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ private static final String IU_KIND_NAMESPACE = "org.eclipse.equinox.prov.type";
+
+ // private Profile profile;
+
+ public ProvCommandProvider(String profileId, IProfileRegistry registry) {
+ // look up the profile we are currently running and use it as the
+ // default.
+ // TODO define a way to spec the default profile to manage
+ // if (profileId != null) {
+ // profile = registry.getProfile(profileId);
+ // if (profile != null)
+ // return;
+ // }
+ // // A default was not defined so manage the first profile we can find
+ // Profile[] profiles = registry.getProfiles();
+ // if (profiles.length > 0)
+ // profile = profiles[0];
+ }
+
+ /**
+ * Adds a metadata repository.
+ */
+ public void _provaddrepo(CommandInterpreter interpreter) {
+ String urlString = interpreter.nextArgument();
+ if (urlString == null) {
+ interpreter.print("Repository location must be provided");
+ interpreter.println();
+ return;
+ }
+ URL repoURL = toURL(interpreter, urlString);
+ if (repoURL == null)
+ return;
+ if (ProvisioningHelper.addMetadataRepository(repoURL) == null)
+ interpreter.println("Unable to add repository: " + repoURL);
+ }
+
+ public void _provaddartifactrepo(CommandInterpreter interpreter) {
+ String urlString = interpreter.nextArgument();
+ if (urlString == null) {
+ interpreter.print("Repository location must be provided");
+ interpreter.println();
+ return;
+ }
+ URL repoURL = toURL(interpreter, urlString);
+ if (repoURL == null)
+ return;
+ if (ProvisioningHelper.addArtifactRepository(repoURL) == null)
+ interpreter.println("Unable to add repository: " + repoURL);
+ }
+
+ /**
+ * Install a given IU to a given profile location.
+ */
+ public void _provinstall(CommandInterpreter interpreter) {
+ String iu = interpreter.nextArgument();
+ String version = interpreter.nextArgument();
+ String profileId = interpreter.nextArgument();
+ if (profileId == null || profileId.equals("this"))
+ profileId = IProfileRegistry.SELF;
+ if (iu == null || version == null || profileId == null) {
+ interpreter.println("Installable unit id, version, and profile Id must be provided");
+ return;
+ }
+ IStatus s = null;
+ try {
+ s = ProvisioningHelper.install(iu, version, ProvisioningHelper.getProfile(profileId), new NullProgressMonitor());
+ } catch (ProvisionException e) {
+ interpreter.println("installation failed ");
+ e.printStackTrace();
+ return;
+ }
+ if (s.isOK())
+ interpreter.println("installation complete");
+ else
+ interpreter.println("installation failed " + s.getMessage());
+ }
+
+ /**
+ * Creates a profile given an id, location, and flavor
+ */
+ public void _provaddprofile(CommandInterpreter interpreter) {
+ String profileId = interpreter.nextArgument();
+ String location = interpreter.nextArgument();
+ String flavor = interpreter.nextArgument();
+ if (profileId == null || location == null || flavor == null) {
+ interpreter.println("Id, location, and flavor must be provided");
+ return;
+ }
+ String environments = interpreter.nextArgument();
+ Properties props = new Properties();
+ props.setProperty(Profile.PROP_INSTALL_FOLDER, location);
+ props.setProperty(Profile.PROP_FLAVOR, flavor);
+ if (environments != null)
+ props.setProperty(Profile.PROP_ENVIRONMENTS, environments);
+
+ ProvisioningHelper.addProfile(profileId, props);
+ }
+
+ /**
+ * Lists the known metadata repositories, or the contents of a given
+ * metadata repository.
+ *
+ * @param interpreter
+ */
+ public void _provliu(CommandInterpreter interpreter) {
+ String urlString = processArgument(interpreter.nextArgument());
+ String id = processArgument(interpreter.nextArgument());
+ String version = processArgument(interpreter.nextArgument());
+ URL repoURL = null;
+ if (urlString != null && !urlString.equals("*"))
+ repoURL = toURL(interpreter, urlString);
+ IInstallableUnit[] units = sort(ProvisioningHelper.getInstallableUnits(repoURL, id, new VersionRange(version), null));
+ for (int i = 0; i < units.length; i++)
+ println(interpreter, units[i]);
+ }
+
+ /**
+ * Lists the known metadata repositories, or the contents of a given
+ * metadata repository.
+ *
+ * @param interpreter
+ */
+ public void _provlr(CommandInterpreter interpreter) {
+ String urlString = processArgument(interpreter.nextArgument());
+ String id = processArgument(interpreter.nextArgument());
+ String version = processArgument(interpreter.nextArgument());
+ if (urlString == null) {
+ IMetadataRepository[] repositories = ProvisioningHelper.getMetadataRepositories();
+ if (repositories == null)
+ return;
+ for (int i = 0; i < repositories.length; i++)
+ interpreter.println(repositories[i].getLocation());
+ return;
+ }
+ URL repoURL = toURL(interpreter, urlString);
+ if (repoURL == null)
+ return;
+ IInstallableUnit[] units = sort(ProvisioningHelper.getInstallableUnits(repoURL, id, new VersionRange(version), null));
+ for (int i = 0; i < units.length; i++)
+ println(interpreter, units[i]);
+ }
+
+ /**
+ * Lists the group IUs in all known metadata repositories, or in the given
+ * metadata repository.
+ *
+ * @param interpreter
+ */
+ public void _provlg(CommandInterpreter interpreter) {
+ String urlString = processArgument(interpreter.nextArgument());
+ IMetadataRepository[] repositories;
+ if (urlString == null) {
+ repositories = ProvisioningHelper.getMetadataRepositories();
+ if (repositories == null)
+ return;
+ } else {
+ URL repoURL = toURL(interpreter, urlString);
+ if (repoURL == null)
+ return;
+ IMetadataRepository repo = null;
+ repo = ProvisioningHelper.getMetadataRepository(repoURL);
+ if (repo == null)
+ return;
+ repositories = new IMetadataRepository[] {repo};
+ }
+ RequiredCapability requirement = new RequiredCapability(IU_KIND_NAMESPACE, "group", null, null, false, false);
+ IInstallableUnit[] units = sort(Query.query(repositories, null, null, new RequiredCapability[] {requirement}, false, null));
+ for (int i = 0; i < units.length; i++)
+ println(interpreter, units[i]);
+ }
+
+ /**
+ * Lists the known artifact repositories, or the contents of a given
+ * artifact repository.
+ *
+ * @param interpreter
+ */
+ public void _provlar(CommandInterpreter interpreter) {
+ String urlString = processArgument(interpreter.nextArgument());
+ if (urlString == null) {
+ IArtifactRepository[] repositories = ProvisioningHelper.getArtifactRepositories();
+ if (repositories == null)
+ return;
+ for (int i = 0; i < repositories.length; i++)
+ interpreter.println(repositories[i].getLocation());
+ return;
+ }
+ URL repoURL = toURL(interpreter, urlString);
+ if (repoURL == null)
+ return;
+ IArtifactRepository repo = ProvisioningHelper.getArtifactRepository(repoURL);
+ IArtifactKey[] keys = null;
+ try {
+ keys = (repo != null) ? repo.getArtifactKeys() : null;
+ } catch (UnsupportedOperationException e) {
+ interpreter.println("Repository does not support list commands.");
+ return;
+ }
+ if (keys == null || keys.length == 0) {
+ interpreter.println("Repository has no artifacts");
+ return;
+ }
+ for (int i = 0; i < keys.length; i++)
+ println(interpreter, keys[i], repo.getArtifact(keys[i]));
+ }
+
+ /**
+ * Returns the given string as an URL, or <code>null</code> if the string
+ * could not be interpreted as an URL.
+ */
+ private URL toURL(CommandInterpreter interpreter, String urlString) {
+ try {
+ return new URL(urlString);
+ } catch (MalformedURLException e) {
+ interpreter.print(e.getMessage());
+ interpreter.println();
+ return null;
+ }
+ }
+
+ private String processArgument(String arg) {
+ if (arg == null || arg.equals("*"))
+ return null;
+ return arg;
+ }
+
+ /**
+ * Lists the known profiles, or the contents of a given profile.
+ *
+ * @param interpreter
+ */
+ public void _provlp(CommandInterpreter interpreter) {
+ String profileId = processArgument(interpreter.nextArgument());
+ String id = processArgument(interpreter.nextArgument());
+ String range = processArgument(interpreter.nextArgument());
+ if (profileId == null) {
+ Profile[] profiles = ProvisioningHelper.getProfiles();
+ for (int i = 0; i < profiles.length; i++)
+ interpreter.println(profiles[i].getProfileId());
+ return;
+ }
+ // determine which profile is to be listed
+ Profile target = null;
+ if (profileId.equals("this"))
+ profileId = IProfileRegistry.SELF;
+ target = ProvisioningHelper.getProfile(profileId);
+ if (target == null)
+ return;
+
+ // list the profile contents
+ IInstallableUnit[] result = sort(Query.query(new Profile[] {target}, id, new VersionRange(range), null, false, null));
+ for (int i = 0; i < result.length; i++)
+ interpreter.println(result[i]);
+ }
+
+ private IInstallableUnit[] sort(IInstallableUnit[] units) {
+ Arrays.sort(units, new Comparator() {
+ public int compare(Object arg0, Object arg1) {
+ return arg0.toString().compareTo(arg1.toString());
+ }
+ });
+ return units;
+ }
+
+ public String getHelp() {
+ StringBuffer help = new StringBuffer();
+ help.append(NEW_LINE);
+ help.append("---"); //$NON-NLS-1$
+ help.append("Provisioning Commands");
+ help.append("---"); //$NON-NLS-1$
+ help.append(NEW_LINE);
+ help.append("\tprovlr [<repository URL> <iu id | *> <version range | *>] - Lists all metadata repositories, or the contents of a given metadata repository");
+ help.append(NEW_LINE);
+ help.append("\tprovlar [<repository URL>] - Lists all artifact repositories, or the contents of a given artifact repository");
+ help.append(NEW_LINE);
+ help.append("\tprovliu [<repository URL | *> <iu id | *> <version range | *>] - Lists the IUs that match the pattern in the given repo. * matches all");
+ help.append(NEW_LINE);
+ help.append("\tprovlp [<profile id | *> - Lists all profiles, or the contents of the profile at the given profile");
+ help.append(NEW_LINE);
+ help.append("\tprovlg [<repository URL> <iu id | *> <version range | *>] - Lists all IUs with group capabilities in the given repo or in all repos if the URL is omitted");
+ help.append(NEW_LINE);
+ help.append("\tprovinstall <InstallableUnit> <version> <profileId> - Provisions an IU to the profile with the give id");
+ help.append(NEW_LINE);
+ help.append("\tprovaddrepo <repository URL> - Adds a metadata repository");
+ help.append(NEW_LINE);
+ help.append("\tprovaddartifactrepo <repository URL> - Adds an artifact repository");
+ help.append(NEW_LINE);
+ help.append("\tprovaddprofile <profileId> <location> <flavor> - Adds a profile with the given id, location and flavor");
+ help.append(NEW_LINE);
+ return help.toString();
+ }
+
+ /**
+ * Prints a string representation of an {@link InstallableUnit} to the
+ * iterpreter's output stream.
+ */
+ public void print(CommandInterpreter interpreter, IInstallableUnit unit) {
+ interpreter.print(unit.getId() + ' ' + unit.getVersion());
+ }
+
+ /**
+ * Prints a string representation of an {@link InstallableUnit} to the
+ * iterpreter's output stream, following by a line terminator
+ */
+ public void println(CommandInterpreter interpreter, IInstallableUnit unit) {
+ print(interpreter, unit);
+ interpreter.println();
+ }
+
+ private void println(CommandInterpreter interpreter, IArtifactKey artifactKey, URI artifact) {
+ interpreter.print(artifactKey.toString() + ' ' + artifact);
+ interpreter.println();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/prov/console/ProvisioningHelper.java b/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/prov/console/ProvisioningHelper.java
new file mode 100644
index 000000000..6e3099813
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/prov/console/ProvisioningHelper.java
@@ -0,0 +1,288 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.console;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Iterator;
+import java.util.Properties;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.equinox.configurator.Configurator;
+import org.eclipse.equinox.prov.artifact.repository.IArtifactRepository;
+import org.eclipse.equinox.prov.artifact.repository.IArtifactRepositoryManager;
+import org.eclipse.equinox.prov.core.ProvisionException;
+import org.eclipse.equinox.prov.core.helpers.ServiceHelper;
+import org.eclipse.equinox.prov.director.IDirector;
+import org.eclipse.equinox.prov.engine.IProfileRegistry;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepository;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepositoryManager;
+import org.eclipse.equinox.prov.query.CompoundIterator;
+import org.eclipse.equinox.prov.query.Query;
+import org.eclipse.osgi.service.environment.EnvironmentInfo;
+import org.eclipse.osgi.service.resolver.VersionRange;
+import org.osgi.framework.Version;
+
+public class ProvisioningHelper {
+
+ public static IMetadataRepository addMetadataRepository(URL location) {
+ IMetadataRepositoryManager manager = (IMetadataRepositoryManager) ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.class.getName());
+ if (manager == null)
+ throw new IllegalStateException("No metadata repository manager found");
+ IMetadataRepository repository = manager.loadRepository(location, null);
+ if (repository != null)
+ return repository;
+
+ // for convenience create and add a repo here
+ // TODO need to get rid o fthe factory method.
+ String repositoryName = location + " - metadata"; //$NON-NLS-1$
+ IMetadataRepository result = manager.createRepository(location, repositoryName, "org.eclipse.equinox.prov.metadata.repository.simpleRepository"); //$NON-NLS-1$
+ return result;
+ }
+
+ public static IMetadataRepository getMetadataRepository(URL location) {
+ IMetadataRepositoryManager manager = (IMetadataRepositoryManager) ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.class.getName());
+ if (manager == null)
+ throw new IllegalStateException("No metadata repository manager found");
+ return manager.getRepository(location);
+ }
+
+ public static void removeMetadataRepository(URL location) {
+ IMetadataRepositoryManager manager = (IMetadataRepositoryManager) ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.class.getName());
+ if (manager == null)
+ throw new IllegalStateException("No metadata repository manager found");
+ IMetadataRepository repo = manager.getRepository(location);
+ if (repo != null)
+ manager.removeRepository(repo);
+ }
+
+ public static IArtifactRepository addArtifactRepository(URL location) {
+ IArtifactRepositoryManager manager = (IArtifactRepositoryManager) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.class.getName());
+ if (manager == null)
+ // TODO log here
+ return null;
+ IArtifactRepository repository = manager.loadRepository(location, null);
+ if (repository != null)
+ return repository;
+
+ // could not load a repo at that location so create one as a convenience
+ String repositoryName = location + " - artifacts"; //$NON-NLS-1$
+ return manager.createRepository(location, repositoryName, "org.eclipse.equinox.prov.artifact.repository.simpleRepository"); //$NON-NLS-1$
+ }
+
+ public static void removeArtifactRepository(URL location) {
+ IArtifactRepositoryManager manager = (IArtifactRepositoryManager) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.class.getName());
+ if (manager == null)
+ // TODO log here
+ return;
+ IArtifactRepository[] repos = manager.getKnownRepositories();
+ for (int i = 0; i < repos.length; i++) {
+ IArtifactRepository repo = repos[i];
+ if (repo.getLocation().equals(location)) {
+ manager.removeRepository(repo);
+ return;
+ }
+ }
+ }
+
+ public static Profile addProfile(String profileId, Properties properties) {
+ IProfileRegistry profileRegistry = (IProfileRegistry) ServiceHelper.getService(Activator.getContext(), IProfileRegistry.class.getName());
+ if (profileRegistry == null)
+ return null;
+ Profile profile = profileRegistry.getProfile(profileId);
+ if (profile != null)
+ return profile;
+
+ profile = new Profile(profileId);
+
+ for (Iterator it = properties.keySet().iterator(); it.hasNext();) {
+ String key = (String) it.next();
+ profile.setValue(key, properties.getProperty(key));
+ }
+
+ if (profile.getValue(Profile.PROP_ENVIRONMENTS) == null) {
+ EnvironmentInfo info = (EnvironmentInfo) ServiceHelper.getService(Activator.getContext(), EnvironmentInfo.class.getName());
+ if (info != null)
+ profile.setValue(Profile.PROP_ENVIRONMENTS, "osgi.os=" + info.getOS() + ",osgi.ws=" + info.getWS() + ",osgi.arch=" + info.getOSArch());
+ else
+ profile.setValue(Profile.PROP_ENVIRONMENTS, "");
+ }
+
+ profileRegistry.addProfile(profile);
+ return profile;
+ }
+
+ public static void removeProfile(String profileId) {
+ IProfileRegistry profileRegistry = (IProfileRegistry) ServiceHelper.getService(Activator.getContext(), IProfileRegistry.class.getName());
+ if (profileRegistry == null)
+ return;
+ Profile profile = profileRegistry.getProfile(profileId);
+ if (profile != null)
+ profileRegistry.removeProfile(profile);
+ }
+
+ public static Profile[] getProfiles() {
+ IProfileRegistry profileRegistry = (IProfileRegistry) ServiceHelper.getService(Activator.getContext(), IProfileRegistry.class.getName());
+ if (profileRegistry == null)
+ return new Profile[0];
+ return profileRegistry.getProfiles();
+ }
+
+ public static Profile getProfile(String id) {
+ IProfileRegistry profileRegistry = (IProfileRegistry) ServiceHelper.getService(Activator.getContext(), IProfileRegistry.class.getName());
+ if (profileRegistry == null)
+ return null;
+ return profileRegistry.getProfile(id);
+ }
+
+ /**
+ * Returns the installable units with the given id and version
+ * specifications in the given metadata repository. <code>null</code>
+ * can be used to indicate wildcards for any of the arguments.
+ *
+ * @param location The location of the metdata repo to search. <code>null</code> indicates
+ * search all known repos.
+ * @param id The id of the IUs to find. <code>null</code> indicates
+ * wildcard.
+ * @param range The version range of the IUs to find. <code>null</code>
+ * indicates wildcard.
+ * @return The IUs that match the query
+ */
+ public static IInstallableUnit[] getInstallableUnits(URL location, String id, VersionRange range, IProgressMonitor progress) {
+ IMetadataRepository[] repositories = null;
+ if (location == null)
+ repositories = getMetadataRepositories();
+ else
+ repositories = new IMetadataRepository[] {getMetadataRepository(location)};
+ Iterator i = Query.getIterator(repositories, id, range, null, false);
+ return CompoundIterator.asArray(i, progress);
+ }
+
+ /**
+ * Returns the installable units with the given id and version
+ * specifications.
+ *
+ * @param profileId The profile to search
+ * @param id The id of the IUs to find. <code>null</code> indicates
+ * wildcard.
+ * @param range The version range of the IUs to find. <code>null</code>
+ * indicates wildcard.
+ * @return The IUs that match the query
+ */
+ public static IInstallableUnit[] getInstallableUnits(String profileId, String id, VersionRange range, IProgressMonitor progress) {
+ Profile[] profiles = null;
+ if (profileId == null)
+ profiles = getProfiles();
+ else
+ profiles = new Profile[] {getProfile(profileId)};
+ Iterator i = Query.getIterator(profiles, id, range, null, false);
+ return CompoundIterator.asArray(i, progress);
+ }
+
+ public static IMetadataRepository[] getMetadataRepositories() {
+ IMetadataRepositoryManager manager = (IMetadataRepositoryManager) ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.class.getName());
+ if (manager == null)
+ // TODO log here
+ return null;
+ IMetadataRepository[] repos = manager.getKnownRepositories();
+ if (repos.length > 0)
+ return repos;
+ return null;
+ }
+
+ /**
+ * Install the described IU
+ */
+ public static IStatus install(String unitId, String version, Profile profile, IProgressMonitor progress) throws ProvisionException {
+ IMetadataRepository[] repos = getMetadataRepositories();
+ if (repos == null || profile == null)
+ return null;
+ // search for a matching IU in the known repositories
+ IInstallableUnit toInstall = null;
+ Version unitVersion = new Version(version);
+ outer: for (int i = 0; i < repos.length; i++) {
+ IInstallableUnit[] ius = repos[i].getInstallableUnits(progress);
+ for (int j = 0; j < ius.length; j++) {
+ if (unitId.equals(ius[j].getId()) && unitVersion.equals(ius[j].getVersion())) {
+ toInstall = ius[j];
+ break outer;
+ }
+ }
+ }
+ if (toInstall == null) {
+ StringBuffer error = new StringBuffer();
+ error.append("Installable unit not found: " + unitId + ' ' + unitVersion + '\n');
+ error.append("Repositories searched:\n");
+ for (int i = 0; i < repos.length; i++)
+ error.append(repos[i].getLocation() + "\n");
+ throw new ProvisionException(error.toString());
+ }
+
+ IDirector director = (IDirector) ServiceHelper.getService(Activator.getContext(), IDirector.class.getName());
+ if (director == null)
+ throw new ProvisionException("No director service found.");
+
+ return director.install(new IInstallableUnit[] {toInstall}, profile, null, progress);
+ }
+
+ /**
+ * Uninstall the described IU
+ */
+ public static IStatus uninstall(String unitId, String version, Profile profile, IProgressMonitor progress) throws ProvisionException {
+ IDirector director = (IDirector) ServiceHelper.getService(Activator.getContext(), IDirector.class.getName());
+ if (director == null)
+ throw new ProvisionException("No director service found.");
+
+ // return director.uninstall(new InstallableUnit[] {toInstall}, profile,
+ // null);
+ return null;
+ }
+
+ public static void kick(String profileId) {
+ Configurator configurator = (Configurator) ServiceHelper.getService(Activator.getContext(), Configurator.class.getName());
+ if (configurator == null)
+ return;
+ if (profileId == null)
+ try {
+ configurator.applyConfiguration();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ else {
+ // TODO do some work here to figure out how to kick some random profile
+ // configurator.applyConfiguration(configURL);
+ }
+ }
+
+ public static IArtifactRepository[] getArtifactRepositories() {
+ IArtifactRepositoryManager manager = (IArtifactRepositoryManager) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.class.getName());
+ if (manager == null)
+ // TODO log here
+ return null;
+ IArtifactRepository[] repos = manager.getKnownRepositories();
+ if (repos.length > 0)
+ return repos;
+ return null;
+ }
+
+ public static IArtifactRepository getArtifactRepository(URL repoURL) {
+ IArtifactRepository[] repositories = getArtifactRepositories();
+ if (repositories == null)
+ return null;
+ for (int i = 0; i < repositories.length; i++)
+ if (repoURL.equals(repositories[i].getLocation()))
+ return repositories[i];
+ return null;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.core/.classpath b/bundles/org.eclipse.equinox.p2.core/.classpath
new file mode 100644
index 000000000..ce7393340
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.core/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.equinox.p2.core/.project b/bundles/org.eclipse.equinox.p2.core/.project
new file mode 100644
index 000000000..6a29114b4
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.core/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.equinox.prov.core</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.equinox.p2.core/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.core/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..744f8b46f
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.core/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,331 @@
+#Thu Sep 13 16:23:45 EDT 2007
+eclipse.preferences.version=1
+instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
+org.eclipse.jdt.core.builder.cleanOutputFolder=clean
+org.eclipse.jdt.core.builder.duplicateResourceTask=warning
+org.eclipse.jdt.core.builder.invalidClasspath=abort
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
+org.eclipse.jdt.core.circularClasspath=error
+org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
+org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=error
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=false
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false
+org.eclipse.jdt.core.formatter.comment.format_line_comments=false
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=800
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.incompatibleJDKLevel=ignore
+org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/bundles/org.eclipse.equinox.p2.core/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.p2.core/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 000000000..c4540955a
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.core/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,57 @@
+#Sun Sep 23 11:57:48 EDT 2007
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_core
+formatter_settings_version=11
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=;
+org.eclipse.jdt.ui.ondemandthreshold=3
+org.eclipse.jdt.ui.staticondemandthreshold=3
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates/>
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.format_source_code=true
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_variable_declarations_final=true
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=false
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/bundles/org.eclipse.equinox.p2.core/.settings/org.eclipse.pde.core.prefs b/bundles/org.eclipse.equinox.p2.core/.settings/org.eclipse.pde.core.prefs
new file mode 100644
index 000000000..7913d20db
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.core/.settings/org.eclipse.pde.core.prefs
@@ -0,0 +1,4 @@
+
+eclipse.preferences.version=1
+pluginProject.extensions=false
+resolve.requirebundle=false
diff --git a/bundles/org.eclipse.equinox.p2.core/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.core/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..7b94ce6da
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.core/META-INF/MANIFEST.MF
@@ -0,0 +1,27 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Core Plug-in (Incubation)
+Bundle-SymbolicName: org.eclipse.equinox.prov.core;singleton:=true
+Bundle-Version: 0.1.0.qualifier
+Import-Package: com.thoughtworks.xstream,
+ org.eclipse.core.runtime.adaptor,
+ org.eclipse.osgi.framework.eventmgr;version="1.0.0",
+ org.eclipse.osgi.framework.log;version="1.0.0",
+ org.eclipse.osgi.internal.resolver,
+ org.eclipse.osgi.service.datalocation;version="1.0.0",
+ org.eclipse.osgi.service.resolver;version="1.1.0",
+ org.eclipse.osgi.util;version="1.0.0",
+ org.osgi.framework;version="1.3.0",
+ org.osgi.util.tracker;version="1.3.3"
+Export-Package: org.eclipse.equinox.internal.prov.core;x-internal:=true,
+ org.eclipse.equinox.prov.core,
+ org.eclipse.equinox.prov.core.eventbus,
+ org.eclipse.equinox.prov.core.helpers,
+ org.eclipse.equinox.prov.core.location,
+ org.eclipse.equinox.prov.core.repository
+Eclipse-LazyStart: true
+Bundle-ClassPath: .
+Bundle-RequiredExecutionEnvironment: J2SE-1.4,
+ CDC-1.1/Foundation-1.1
+Bundle-Activator: org.eclipse.equinox.internal.prov.core.Activator
+Require-Bundle: org.eclipse.equinox.common
diff --git a/bundles/org.eclipse.equinox.p2.core/about.html b/bundles/org.eclipse.equinox.p2.core/about.html
new file mode 100644
index 000000000..460233046
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.core/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 2, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.core/build.properties b/bundles/org.eclipse.equinox.p2.core/build.properties
new file mode 100644
index 000000000..475da1dec
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.core/build.properties
@@ -0,0 +1,15 @@
+###############################################################################
+# Copyright (c) 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/prov/core/Activator.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/prov/core/Activator.java
new file mode 100644
index 000000000..521779118
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/prov/core/Activator.java
@@ -0,0 +1,176 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.internal.prov.core;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Dictionary;
+import java.util.Hashtable;
+import org.eclipse.equinox.prov.core.location.AgentLocation;
+import org.eclipse.osgi.framework.log.FrameworkLog;
+import org.eclipse.osgi.service.datalocation.Location;
+import org.osgi.framework.*;
+import org.osgi.util.tracker.ServiceTracker;
+
+public class Activator implements BundleActivator {
+
+ public static final String AGENT_DATA_AREA = "eclipse.prov.data.area"; //$NON-NLS-1$
+ public static Location agentDataLocation = null;
+
+ public static BundleContext context;
+ public static Location downloadLocation = null;
+ private static Activator instance;
+ // Data mode constants for user, configuration and data locations.
+ private static final String NO_DEFAULT = "@noDefault"; //$NON-NLS-1$
+ private static final String NONE = "@none"; //$NON-NLS-1$
+
+ private static final String PROP_CONFIG_DIR = "osgi.configuration.area"; //$NON-NLS-1$
+ public static final String PROP_TMPDIR = "java.io.tmpdir"; //$NON-NLS-1$
+ public static final String PROP_USER_DIR = "user.dir"; //$NON-NLS-1$
+ public static final String PROP_USER_HOME = "user.home"; //$NON-NLS-1$
+
+ public static final String READ_ONLY_AREA_SUFFIX = ".readOnly"; //$NON-NLS-1$
+
+ private static final String VAR_CONFIG_DIR = "@config.dir"; //$NON-NLS-1$
+ private static final String VAR_USER_DIR = "@user.dir"; //$NON-NLS-1$
+ private static final String VAR_USER_HOME = "@user.home"; //$NON-NLS-1$
+ private ServiceRegistration agentLocationRegistration = null;
+ ServiceTracker logTracker;
+
+ /**
+ * NOTE: This method is copied from LocationHelper in org.eclipse.osgi
+ * due to access restrictions.
+ */
+ private static URL adjustTrailingSlash(URL url, boolean trailingSlash) throws MalformedURLException {
+ String file = url.getFile();
+ if (trailingSlash == (file.endsWith("/"))) //$NON-NLS-1$
+ return url;
+ file = trailingSlash ? file + "/" : file.substring(0, file.length() - 1); //$NON-NLS-1$
+ return new URL(url.getProtocol(), url.getHost(), file);
+ }
+
+ /**
+ * Builds a URL with the given specification
+ * NOTE: This method is copied from LocationHelper in org.eclipse.osgi
+ * due to access restrictions.
+ *
+ * @param spec the URL specification
+ * @param trailingSlash flag to indicate a trailing slash on the spec
+ * @return a URL
+ */
+ private static URL buildURL(String spec, boolean trailingSlash) {
+ if (spec == null)
+ return null;
+ boolean isFile = spec.startsWith("file:"); //$NON-NLS-1$
+ try {
+ if (isFile)
+ return adjustTrailingSlash(new File(spec.substring(5)).toURL(), trailingSlash);
+ return new URL(spec);
+ } catch (MalformedURLException e) {
+ // if we failed and it is a file spec, there is nothing more we can do
+ // otherwise, try to make the spec into a file URL.
+ if (isFile)
+ return null;
+ try {
+ return adjustTrailingSlash(new File(spec).toURL(), trailingSlash);
+ } catch (MalformedURLException e1) {
+ return null;
+ }
+ }
+ }
+
+ /**
+ * Returns the framework log, or null if not available
+ */
+ public static FrameworkLog getFrameworkLog() {
+ //protect against concurrent shutdown
+ Activator a = instance;
+ if (a == null)
+ return null;
+ ServiceTracker tracker = a.getLogTracker();
+ if (tracker == null)
+ return null;
+ return (FrameworkLog) tracker.getService();
+ }
+
+ private static String substituteVar(String source, String var, String prop) {
+ String value = Activator.context.getProperty(prop);
+ if (value == null)
+ value = "";
+ return value + source.substring(var.length());
+ }
+
+ private Location buildLocation(String property, URL defaultLocation, boolean readOnlyDefault, boolean addTrailingSlash) {
+ String location = Activator.context.getProperty(property);
+ // the user/product may specify a non-default readOnly setting
+ String userReadOnlySetting = Activator.context.getProperty(property + READ_ONLY_AREA_SUFFIX);
+ boolean readOnly = (userReadOnlySetting == null ? readOnlyDefault : Boolean.valueOf(userReadOnlySetting).booleanValue());
+ // if the instance location is not set, predict where the workspace will be and
+ // put the instance area inside the workspace meta area.
+ if (location == null)
+ return new BasicLocation(property, defaultLocation, readOnly);
+ String trimmedLocation = location.trim();
+ if (trimmedLocation.equalsIgnoreCase(NONE))
+ return null;
+ if (trimmedLocation.equalsIgnoreCase(NO_DEFAULT))
+ return new BasicLocation(property, null, readOnly);
+ if (trimmedLocation.startsWith(VAR_USER_HOME)) {
+ String base = substituteVar(location, VAR_USER_HOME, PROP_USER_HOME);
+ location = new File(base).getAbsolutePath();
+ } else if (trimmedLocation.startsWith(VAR_USER_DIR)) {
+ String base = substituteVar(location, VAR_USER_DIR, PROP_USER_DIR);
+ location = new File(base).getAbsolutePath();
+ } else if (trimmedLocation.startsWith(VAR_CONFIG_DIR)) {
+ //note the config dir system property is already a URL
+ location = substituteVar(location, VAR_CONFIG_DIR, PROP_CONFIG_DIR);
+ }
+ URL url = buildURL(location, addTrailingSlash);
+ BasicLocation result = null;
+ if (url != null) {
+ result = new BasicLocation(property, null, readOnly);
+ result.setURL(url, false);
+ }
+ return result;
+ }
+
+ private ServiceTracker getLogTracker() {
+ if (logTracker != null)
+ return logTracker;
+ //lazy init if the bundle has been started
+ if (context == null)
+ return null;
+ logTracker = new ServiceTracker(context, FrameworkLog.class.getName(), null);
+ logTracker.open();
+ return logTracker;
+ }
+
+ public void start(BundleContext context) throws Exception {
+ instance = this;
+ Activator.context = context;
+ URL defaultLocation = new URL(context.getProperty("osgi.configuration.area") + "org.eclipse.equinox.prov.core/agentdata/");
+ agentDataLocation = buildLocation(AGENT_DATA_AREA, defaultLocation, false, true);
+ Dictionary locationProperties = new Hashtable();
+ if (defaultLocation != null) {
+ locationProperties.put("type", AGENT_DATA_AREA); //$NON-NLS-1$
+ agentLocationRegistration = context.registerService(new String[] {Location.class.getName(), AgentLocation.class.getName()}, agentDataLocation, locationProperties);
+ }
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ instance = null;
+ if (agentLocationRegistration != null)
+ agentLocationRegistration.unregister();
+ if (logTracker != null) {
+ logTracker.close();
+ logTracker = null;
+ }
+ Activator.context = null;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/prov/core/BasicLocation.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/prov/core/BasicLocation.java
new file mode 100644
index 000000000..304327928
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/prov/core/BasicLocation.java
@@ -0,0 +1,226 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 IBM Corporation and others. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.internal.prov.core;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import org.eclipse.equinox.prov.core.location.AgentLocation;
+import org.eclipse.osgi.service.datalocation.Location;
+
+/**
+ * Internal class.
+ */
+public class BasicLocation implements AgentLocation {
+ private static class MockLocker implements Locker {
+ public boolean lock() throws IOException {
+ // locking always successful
+ return true;
+ }
+
+ public void release() {
+ // nothing to release
+ }
+ }
+
+ private boolean isReadOnly;
+ private URL location = null;
+ private Location parent;
+ private URL defaultValue;
+
+ // locking related fields
+ private File lockFile;
+ private Locker locker;
+ public static final String PROP_OSGI_LOCKING = "osgi.locking"; //$NON-NLS-1$
+ public static boolean DEBUG;
+
+ private static boolean isRunningWithNio() {
+ try {
+ Class.forName("java.nio.channels.FileLock"); //$NON-NLS-1$
+ } catch (ClassNotFoundException e) {
+ return false;
+ }
+ return true;
+ }
+
+ public static Locker createLocker(File lock, String lockMode) {
+ if (lockMode == null)
+ lockMode = Activator.context.getProperty(PROP_OSGI_LOCKING);
+
+ if ("none".equals(lockMode)) //$NON-NLS-1$
+ return new MockLocker();
+
+ if ("java.io".equals(lockMode)) //$NON-NLS-1$
+ return new Locker_JavaIo(lock);
+
+ if ("java.nio".equals(lockMode)) { //$NON-NLS-1$
+ if (isRunningWithNio())
+ return new Locker_JavaNio(lock);
+ else
+ // TODO should we return null here. NIO was requested but we could not do it...
+ return new Locker_JavaIo(lock);
+ }
+
+ // Backup case if an invalid value has been specified
+ if (isRunningWithNio())
+ return new Locker_JavaNio(lock);
+ else
+ return new Locker_JavaIo(lock);
+ }
+
+ public BasicLocation(String property, URL defaultValue, boolean isReadOnly) {
+ super();
+ this.defaultValue = defaultValue;
+ this.isReadOnly = isReadOnly;
+ }
+
+ public boolean allowsDefault() {
+ return defaultValue != null;
+ }
+
+ public URL getDefault() {
+ return defaultValue;
+ }
+
+ public Location getParentLocation() {
+ return parent;
+ }
+
+ public synchronized URL getURL() {
+ if (location == null && defaultValue != null)
+ setURL(defaultValue, false);
+ return location;
+ }
+
+ public synchronized boolean isSet() {
+ return location != null;
+ }
+
+ public boolean isReadOnly() {
+ return isReadOnly;
+ }
+
+ public synchronized boolean setURL(URL value, boolean lock) throws IllegalStateException {
+ // if (location != null)
+ // throw new IllegalStateException(Messages.ECLIPSE_CANNOT_CHANGE_LOCATION);
+ //// File file = null;
+ //// if (value.getProtocol().equalsIgnoreCase("file")) { //$NON-NLS-1$
+ //// try {
+ //// String basePath = new File(value.getFile()).getCanonicalPath();
+ //// value = new URL("file:" + basePath); //$NON-NLS-1$
+ //// } catch (IOException e) {
+ //// // do nothing just use the original value
+ //// }
+ //// file = new File(value.getFile(), LOCK_FILENAME);
+ //// }
+ // lock = lock && !isReadOnly;
+ // if (lock) {
+ // try {
+ // if (!lock(file))
+ // return false;
+ // } catch (IOException e) {
+ // return false;
+ // }
+ // }
+ // lockFile = file;
+ location = value;
+ // LocationManager.buildURL(value.toExternalForm(), true);
+ // if (property != null)
+ // System.setProperty(property, location.toExternalForm());
+ return lock;
+ }
+
+ public synchronized void setParent(Location value) {
+ parent = value;
+ }
+
+ public synchronized boolean lock() throws IOException {
+ if (!isSet())
+ return false;
+ return lock(lockFile);
+ }
+
+ private boolean lock(File lock) throws IOException {
+ if (lock == null || isReadOnly)
+ return false;
+
+ File parentFile = new File(lock.getParent());
+ if (!parentFile.exists())
+ if (!parentFile.mkdirs())
+ return false;
+
+ setLocker(lock);
+ if (locker == null)
+ return true;
+ boolean locked = false;
+ try {
+ locked = locker.lock();
+ return locked;
+ } finally {
+ if (!locked)
+ locker = null;
+ }
+ }
+
+ private void setLocker(File lock) {
+ if (locker != null)
+ return;
+ String lockMode = Activator.context.getProperty(PROP_OSGI_LOCKING);
+ locker = createLocker(lock, lockMode);
+ }
+
+ public synchronized void release() {
+ if (locker != null)
+ locker.release();
+ }
+
+ public URL getArtifactRepositoryURL() {
+ try {
+ return new URL(getURL(), "artifactRepository/");
+ } catch (MalformedURLException e) {
+ // TODO Auto-generated catch block
+ return null;
+ }
+ }
+
+ public URL getMetadataRepositoryURL() {
+ try {
+ return new URL(getURL(), "metadataRepository/");
+ } catch (MalformedURLException e) {
+ // TODO Auto-generated catch block
+ return null;
+ }
+ }
+
+ public URL getTouchpointDataArea(String touchpointId) {
+ try {
+ return new URL(getURL(), "touchpoints/" + touchpointId);
+ } catch (MalformedURLException e) {
+ // TODO Auto-generated catch block
+ return null;
+ }
+ }
+
+ /**
+ * TODO: This method was added in Eclipse 3.4 - We need to stop implementing the OSGi interface,
+ * and then this stub method can be removed.
+ */
+ public Location createLocation(Location parent, URL defaultValue, boolean readonly) {
+ return null;
+ }
+
+ /**
+ * TODO: This method was added in Eclipse 3.4 - We need to stop implementing the OSGi interface,
+ * and then this stub method can be removed.
+ */
+ public boolean isLocked() throws IOException {
+ return false;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/prov/core/Locker.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/prov/core/Locker.java
new file mode 100644
index 000000000..521dc0501
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/prov/core/Locker.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.core;
+
+import java.io.IOException;
+
+/**
+ * Internal class.
+ */
+public interface Locker {
+ public boolean lock() throws IOException;
+
+ public void release();
+}
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/prov/core/Locker_JavaIo.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/prov/core/Locker_JavaIo.java
new file mode 100644
index 000000000..2ba6cf51d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/prov/core/Locker_JavaIo.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.core;
+
+import java.io.*;
+
+/**
+ * Internal class.
+ */
+public class Locker_JavaIo implements Locker {
+ private File lockFile;
+ private RandomAccessFile lockRAF;
+
+ public Locker_JavaIo(File lockFile) {
+ this.lockFile = lockFile;
+ }
+
+ public synchronized boolean lock() throws IOException {
+ //if the lock file already exists, try to delete,
+ //assume failure means another eclipse has it open
+ if (lockFile.exists())
+ lockFile.delete();
+ if (lockFile.exists())
+ return false;
+
+ //open the lock file so other instances can't co-exist
+ lockRAF = new RandomAccessFile(lockFile, "rw"); //$NON-NLS-1$
+ lockRAF.writeByte(0);
+
+ return true;
+ }
+
+ public synchronized void release() {
+ try {
+ if (lockRAF != null) {
+ lockRAF.close();
+ lockRAF = null;
+ }
+ } catch (IOException e) {
+ //don't complain, we're making a best effort to clean up
+ }
+ if (lockFile != null)
+ lockFile.delete();
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/prov/core/Locker_JavaNio.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/prov/core/Locker_JavaNio.java
new file mode 100644
index 000000000..917e26192
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/prov/core/Locker_JavaNio.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.core;
+
+import java.io.*;
+import java.nio.channels.FileLock;
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Internal class.
+ */
+public class Locker_JavaNio implements Locker {
+ private File lockFile;
+ private FileLock fileLock;
+ private RandomAccessFile raFile;
+
+ public Locker_JavaNio(File lockFile) {
+ this.lockFile = lockFile;
+ }
+
+ public synchronized boolean lock() throws IOException {
+ raFile = new RandomAccessFile(lockFile, "rw"); //$NON-NLS-1$
+ try {
+ fileLock = raFile.getChannel().tryLock();
+ } catch (IOException ioe) {
+ // print exception if debugging
+ if (BasicLocation.DEBUG)
+ System.out.println(NLS.bind(Messages.location_cannotLock, lockFile));
+ // produce a more specific message for clients
+ String specificMessage = NLS.bind(Messages.location_cannotLockNIO, new Object[] {lockFile, ioe.getMessage(), "\"-D" + BasicLocation.PROP_OSGI_LOCKING + "=none\""}); //$NON-NLS-1$ //$NON-NLS-2$
+ throw new IOException(specificMessage);
+ }
+ if (fileLock != null)
+ return true;
+ raFile.close();
+ raFile = null;
+ return false;
+ }
+
+ public synchronized void release() {
+ if (fileLock != null) {
+ try {
+ fileLock.release();
+ } catch (IOException e) {
+ //don't complain, we're making a best effort to clean up
+ }
+ fileLock = null;
+ }
+ if (raFile != null) {
+ try {
+ raFile.close();
+ } catch (IOException e) {
+ //don't complain, we're making a best effort to clean up
+ }
+ raFile = null;
+ }
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/prov/core/Messages.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/prov/core/Messages.java
new file mode 100644
index 000000000..672ebd4f7
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/prov/core/Messages.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.core;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.equinox.internal.prov.core.messages"; //$NON-NLS-1$
+ public static final String ECLIPSE_CANNOT_CHANGE_LOCATION = null;
+
+ static {
+ // initialize resource bundles
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ // Do not instantiate
+ }
+
+ public static String location_cannotLock;
+ public static String location_cannotLockNIO;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/prov/core/messages.properties b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/prov/core/messages.properties
new file mode 100644
index 000000000..f6ae633b8
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/prov/core/messages.properties
@@ -0,0 +1,10 @@
+###############################################################################
+# Copyright (c) 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/ProvisionException.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/ProvisionException.java
new file mode 100644
index 000000000..86d9afabe
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/ProvisionException.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.core;
+
+public class ProvisionException extends Exception {
+ private static final long serialVersionUID = 1L;
+
+ public ProvisionException(String message) {
+ super(message);
+ }
+
+ public ProvisionException(Throwable e) {
+ super(e);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/eventbus/ProvisioningEventBus.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/eventbus/ProvisioningEventBus.java
new file mode 100644
index 000000000..e556b6f13
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/eventbus/ProvisioningEventBus.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.core.eventbus;
+
+import java.util.EventObject;
+import org.eclipse.osgi.framework.eventmgr.*;
+
+//TODO Need to clean up the lifecycle of this class
+public class ProvisioningEventBus implements EventDispatcher {
+ private EventListeners syncListeners = new EventListeners();
+ private EventListeners asyncListeners = new EventListeners();
+ private EventManager eventManager = new EventManager("Provisioning Event Dispatcher"); //$NON-NLS-1$
+
+ public void addListener(ProvisioningListener toAdd) {
+ if (toAdd instanceof SynchronousProvisioningListener) {
+ synchronized (syncListeners) {
+ syncListeners.addListener(toAdd, toAdd);
+ }
+ } else {
+ synchronized (asyncListeners) {
+ asyncListeners.addListener(toAdd, toAdd);
+ }
+ }
+ }
+
+ public void removeListener(ProvisioningListener toRemove) {
+ if (toRemove instanceof SynchronousProvisioningListener) {
+ synchronized (syncListeners) {
+ if (syncListeners != null) {
+ syncListeners.removeListener(toRemove);
+ }
+ }
+ } else {
+ synchronized (asyncListeners) {
+ if (asyncListeners != null) {
+ asyncListeners.removeListener(toRemove);
+ }
+ }
+ }
+ }
+
+ public void publishEvent(EventObject event) {
+ /* queue to hold set of listeners */
+ ListenerQueue listeners = new ListenerQueue(eventManager);
+
+ /* synchronize while building the listener list */
+ synchronized (syncListeners) {
+ /* add set of BundleContexts w/ listeners to queue */
+ listeners.queueListeners(syncListeners, this);
+ /* synchronously dispatch to populate listeners queue */
+ listeners.dispatchEventSynchronous(0, event);
+ }
+
+ listeners = new ListenerQueue(eventManager);
+ synchronized (asyncListeners) {
+ listeners.queueListeners(asyncListeners, this);
+ listeners.dispatchEventAsynchronous(0, event);
+ }
+ }
+
+ public void dispatchEvent(Object eventListener, Object listenerObject, int eventAction, Object eventObject) {
+ try {
+ ((ProvisioningListener) eventListener).notify((EventObject) eventObject);
+ } catch (Exception e) {
+ e.printStackTrace();
+ //TODO Need to do the appropriate logging
+ }
+ }
+
+ public void close() {
+ eventManager.close();
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/eventbus/ProvisioningListener.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/eventbus/ProvisioningListener.java
new file mode 100644
index 000000000..15a90f2a6
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/eventbus/ProvisioningListener.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.core.eventbus;
+
+import java.util.EventListener;
+import java.util.EventObject;
+
+public interface ProvisioningListener extends EventListener {
+ public void notify(EventObject o);
+}
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/eventbus/SynchronousProvisioningListener.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/eventbus/SynchronousProvisioningListener.java
new file mode 100644
index 000000000..b99afe766
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/eventbus/SynchronousProvisioningListener.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.core.eventbus;
+
+public interface SynchronousProvisioningListener extends ProvisioningListener {
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/ArrayUtils.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/ArrayUtils.java
new file mode 100644
index 000000000..ee8d5f7ac
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/ArrayUtils.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.core.helpers;
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+public class ArrayUtils {
+ /**
+ * Find the index of the first occurrence of object in array, or -1.
+ * Use Arrays.binarySearch if array is big and sorted.
+ */
+ public static int indexOf(Object[] array, Object object) {
+ for (int i = 0; i < array.length; i += 1) {
+ if (object == null ? array[i] == null : object.equals(array[i]))
+ return i;
+ }
+ return -1;
+ }
+
+ /**
+ * Iterate over an array.
+ */
+ public static class ArrayIterator implements Iterator {
+ private final Object[] array;
+ private int next; // next element to return
+
+ public ArrayIterator(Object[] array) {
+ this.array = array;
+ this.next = 0;
+ }
+
+ public boolean hasNext() {
+ return this.next < this.array.length;
+ }
+
+ public Object next() throws NoSuchElementException {
+ try {
+ return this.array[this.next++];
+ } catch (ArrayIndexOutOfBoundsException e) {
+ throw new NoSuchElementException();
+ }
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/FileUtils.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/FileUtils.java
new file mode 100644
index 000000000..47d82467d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/FileUtils.java
@@ -0,0 +1,212 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.core.helpers;
+
+import java.io.*;
+import java.net.URL;
+import java.util.zip.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.osgi.util.NLS;
+
+public class FileUtils {
+
+ /**
+ * Unzip from a File to an output directory.
+ */
+ public static void unzipFile(File zipFile, File outputDir) throws IOException {
+ InputStream in = new FileInputStream(zipFile);
+ try {
+ unzipStream(in, zipFile.length(), outputDir, null, null);
+ } catch (IOException e) {
+ // add the file name to the message
+ throw new IOException(NLS.bind(Messages.Util_Error_Unzipping, zipFile, e.getMessage()));
+ } finally {
+ in.close();
+ }
+ }
+
+ /**
+ * Unzip from a File to an output directory, with progress indication.
+ * monitor may be null.
+ */
+ public static void unzipFile(File zipFile, File outputDir, String taskName, IProgressMonitor monitor) throws IOException {
+ InputStream in = new FileInputStream(zipFile);
+ try {
+ unzipStream(in, zipFile.length(), outputDir, taskName, monitor);
+ } catch (IOException e) {
+ // add the file name to the message
+ throw new IOException(NLS.bind(Messages.Util_Error_Unzipping, zipFile, e.getMessage()));
+ } finally {
+ in.close();
+ }
+ }
+
+ /**
+ * Unzip from a URL to an output directory.
+ */
+ public static void unzipURL(URL zipURL, File outputDir) throws IOException {
+ unzipURL(zipURL, outputDir, null, null);
+ }
+
+ /**
+ * Unzip from a URL to an output directory, with progress indication.
+ * monitor may be null.
+ */
+ public static void unzipURL(URL zipURL, File outputDir, String taskName, IProgressMonitor monitor) throws IOException {
+ int size = zipURL.openConnection().getContentLength();
+ InputStream in = zipURL.openStream();
+ try {
+ unzipStream(in, size, outputDir, taskName, monitor);
+ } catch (IOException e) {
+ // add the URL to the message
+ throw new IOException(NLS.bind(Messages.Util_Error_Unzipping, zipURL, e.getMessage()));
+ } finally {
+ in.close();
+ }
+ }
+
+ /**
+ * Unzip from an InputStream to an output directory.
+ */
+ public static void unzipStream(InputStream stream, long size, File outputDir, String taskName, IProgressMonitor monitor) throws IOException {
+ InputStream is = monitor == null ? stream : stream; // new ProgressMonitorInputStream(stream, size, size, taskName, monitor); TODO Commented code
+ ZipInputStream in = new ZipInputStream(is);
+ ZipEntry ze = in.getNextEntry();
+ if (ze == null) {
+ // There must be at least one entry in a zip file.
+ // When there isn't getNextEntry returns null.
+ in.close();
+ throw new IOException(Messages.Util_Invalid_Zip_File_Format);
+ }
+ do {
+ File outFile = new File(outputDir, ze.getName());
+ if (ze.isDirectory()) {
+ outFile.mkdirs();
+ } else {
+ if (outFile.exists()) {
+ outFile.delete();
+ } else {
+ outFile.getParentFile().mkdirs();
+ }
+ try {
+ copyStream(in, false, new FileOutputStream(outFile), true);
+ } catch (FileNotFoundException e) {
+ // TEMP: ignore this for now in case we're trying to replace
+ // a running eclipse.exe
+ }
+ outFile.setLastModified(ze.getTime());
+ }
+ in.closeEntry();
+ } while ((ze = in.getNextEntry()) != null);
+ in.close();
+ }
+
+ // Delete empty directories under dir, including dir itself.
+ public static void deleteEmptyDirs(File dir) throws IOException {
+ File[] files = dir.listFiles();
+ if (files != null) {
+ for (int i = 0; i < files.length; i += 1) {
+ deleteEmptyDirs(files[i]);
+ }
+ dir.getCanonicalFile().delete();
+ }
+ }
+
+ /**
+ * Copy an input stream to an output stream.
+ * Optionally close the streams when done.
+ * Return the number of bytes written.
+ */
+ public static int copyStream(InputStream in, boolean closeIn, OutputStream out, boolean closeOut) throws IOException {
+ try {
+ int written = 0;
+ byte[] buffer = new byte[16 * 1024];
+ int len;
+ while ((len = in.read(buffer)) != -1) {
+ out.write(buffer, 0, len);
+ written += len;
+ }
+ return written;
+ } finally {
+ try {
+ if (closeIn) {
+ in.close();
+ }
+ } finally {
+ if (closeOut) {
+ out.close();
+ }
+ }
+ }
+ }
+
+ public static void zip(File[] sourceFiles, File destinationArchive) throws IOException {
+ ZipOutputStream output = new ZipOutputStream(new FileOutputStream(destinationArchive));
+ try {
+ for (int i = 0; i < sourceFiles.length; i++)
+ if (sourceFiles[i].isDirectory())
+ zipDir(output, sourceFiles[i], new Path(sourceFiles[i].getName()));
+ else
+ zipFile(output, sourceFiles[i], new Path(""));//$NON-NLS-1$
+ } finally {
+ try {
+ // Note! This call will fail miserably if no entries were added to the zip!
+ // The file is left open after an exception is thrown.
+ output.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+
+ /*
+ * Zip the contents of the given directory into the zip file represented by
+ * the given zip stream. Prepend the given prefix to the file paths.
+ */
+ private static void zipDir(ZipOutputStream output, File source, IPath prefix) {
+ File[] files = source.listFiles();
+ for (int i = 0; i < files.length; i++) {
+ try {
+ if (files[i].isFile())
+ zipFile(output, files[i], prefix);
+ else
+ zipDir(output, files[i], prefix.append(files[i].getName()));
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /*
+ * Add the given file to the zip file represented by the specified stream.
+ * Prepend the given prefix to the path of the file.
+ */
+ private static void zipFile(ZipOutputStream output, File sourceFile, IPath prefix) throws IOException {
+ InputStream input = new FileInputStream(sourceFile);
+ try {
+ ZipEntry zipEntry = new ZipEntry(prefix.append(sourceFile.getName()).toString());
+ zipEntry.setTime(sourceFile.lastModified());
+ output.putNextEntry(zipEntry);
+ copyStream(input, true, output, false);
+ } finally {
+ try {
+ input.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ try {
+ output.closeEntry();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/Headers.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/Headers.java
new file mode 100644
index 000000000..9fb93dc0f
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/Headers.java
@@ -0,0 +1,300 @@
+package org.eclipse.equinox.prov.core.helpers;
+
+/*******************************************************************************
+ * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.*;
+import org.eclipse.osgi.util.ManifestElement;
+import org.osgi.framework.BundleException;
+
+/**
+ * Headers classes. This class implements a Dictionary that has
+ * the following behaviour:
+ * <ul>
+ * <li>put and remove clear throw UnsupportedOperationException.
+ * The Dictionary is thus read-only to others.
+ * <li>The String keys in the Dictionary are case-preserved,
+ * but the get operation is case-insensitive.
+ * </ul>
+ * TODO: This class is copied from org.eclipse.osgi due to access restrictions. We
+ * can't make this API so we need to find a place for it.
+ * @since 3.1
+ */
+public class Headers extends Dictionary implements Map {
+ private boolean readOnly = false;
+ private Object[] headers;
+ private Object[] values;
+ private int size = 0;
+
+ /**
+ * Create an empty Headers dictionary.
+ *
+ * @param initialCapacity The initial capacity of this Headers object.
+ */
+ public Headers(int initialCapacity) {
+ super();
+ headers = new Object[initialCapacity];
+ values = new Object[initialCapacity];
+ }
+
+ /**
+ * Create a Headers dictionary from a Dictionary.
+ *
+ * @param values The initial dictionary for this Headers object.
+ * @exception IllegalArgumentException If a case-variant of the key is
+ * in the dictionary parameter.
+ */
+ public Headers(Dictionary values) {
+ this(values.size());
+ /* initialize the headers and values */
+ Enumeration keys = values.keys();
+ while (keys.hasMoreElements()) {
+ Object key = keys.nextElement();
+ set(key, values.get(key));
+ }
+ }
+
+ /**
+ * Case-preserved keys.
+ */
+ public synchronized Enumeration keys() {
+ return new ArrayEnumeration(headers, size);
+ }
+
+ /**
+ * Values.
+ */
+ public synchronized Enumeration elements() {
+ return new ArrayEnumeration(values, size);
+ }
+
+ private int getIndex(Object key) {
+ boolean stringKey = key instanceof String;
+ for (int i = 0; i < size; i++) {
+ if (stringKey && (headers[i] instanceof String)) {
+ if (((String) headers[i]).equalsIgnoreCase((String) key))
+ return i;
+ } else {
+ if (headers[i].equals(key))
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ private Object remove(int remove) {
+ Object removed = values[remove];
+ for (int i = remove; i < size; i++) {
+ if (i == headers.length - 1) {
+ headers[i] = null;
+ values[i] = null;
+ } else {
+ headers[i] = headers[i + 1];
+ values[i] = values[i + 1];
+ }
+ }
+ if (remove < size)
+ size--;
+ return removed;
+ }
+
+ private void add(Object header, Object value) {
+ if (size == headers.length) {
+ // grow the arrays
+ Object[] newHeaders = new Object[headers.length + 10];
+ Object[] newValues = new Object[values.length + 10];
+ System.arraycopy(headers, 0, newHeaders, 0, headers.length);
+ System.arraycopy(values, 0, newValues, 0, values.length);
+ headers = newHeaders;
+ values = newValues;
+ }
+ headers[size] = header;
+ values[size] = value;
+ size++;
+ }
+
+ /**
+ * Support case-insensitivity for keys.
+ *
+ * @param key name.
+ */
+ public synchronized Object get(Object key) {
+ int i = -1;
+ if ((i = getIndex(key)) != -1)
+ return values[i];
+ return null;
+ }
+
+ /**
+ * Set a header value or optionally replace it if it already exists.
+ *
+ * @param key Key name.
+ * @param value Value of the key or null to remove key.
+ * @param replace A value of true will allow a previous
+ * value of the key to be replaced. A value of false
+ * will cause an IllegalArgumentException to be thrown
+ * if a previous value of the key exists.
+ * @return the previous value to which the key was mapped,
+ * or null if the key did not have a previous mapping.
+ *
+ * @exception IllegalArgumentException If a case-variant of the key is
+ * already present.
+ * @since 3.2
+ */
+ public synchronized Object set(Object key, Object value, boolean replace) {
+ if (readOnly)
+ throw new UnsupportedOperationException();
+ if (key instanceof String)
+ key = ((String) key).intern();
+ int i = getIndex(key);
+ if (value == null) { /* remove */
+ if (i != -1)
+ return remove(i);
+ } else { /* put */
+ if (i != -1) { /* duplicate key */
+ if (!replace)
+ throw new IllegalArgumentException("HEADER_DUPLICATE_KEY_EXCEPTION: " + key);
+ Object oldVal = values[i];
+ values[i] = value;
+ return oldVal;
+ }
+ add(key, value);
+ }
+ return null;
+ }
+
+ /**
+ * Set a header value.
+ *
+ * @param key Key name.
+ * @param value Value of the key or null to remove key.
+ * @return the previous value to which the key was mapped,
+ * or null if the key did not have a previous mapping.
+ *
+ * @exception IllegalArgumentException If a case-variant of the key is
+ * already present.
+ */
+ public synchronized Object set(Object key, Object value) {
+ return set(key, value, false);
+ }
+
+ public synchronized void setReadOnly() {
+ readOnly = true;
+ }
+
+ /**
+ * Returns the number of entries (distinct keys) in this dictionary.
+ *
+ * @return the number of keys in this dictionary.
+ */
+ public synchronized int size() {
+ return size;
+ }
+
+ /**
+ * Tests if this dictionary maps no keys to value. The general contract
+ * for the <tt>isEmpty</tt> method is that the result is true if and only
+ * if this dictionary contains no entries.
+ *
+ * @return <code>true</code> if this dictionary maps no keys to values;
+ * <code>false</code> otherwise.
+ */
+ public synchronized boolean isEmpty() {
+ return size == 0;
+ }
+
+ /**
+ * Always throws UnsupportedOperationException.
+ *
+ * @param key header name.
+ * @param value header value.
+ * @throws UnsupportedOperationException
+ */
+ public synchronized Object put(Object key, Object value) {
+ if (readOnly)
+ throw new UnsupportedOperationException();
+ return set(key, value, true);
+ }
+
+ /**
+ * Always throws UnsupportedOperationException.
+ *
+ * @param key header name.
+ * @throws UnsupportedOperationException
+ */
+ public Object remove(Object key) {
+ throw new UnsupportedOperationException();
+ }
+
+ public String toString() {
+ return (values.toString());
+ }
+
+ public static Headers parseManifest(InputStream in) throws BundleException {
+ Headers headers = new Headers(10);
+ try {
+ ManifestElement.parseBundleManifest(in, headers);
+ } catch (IOException e) {
+ throw new BundleException("Error reading bundle manifest", e);
+ }
+ headers.setReadOnly();
+ return headers;
+ }
+
+ class ArrayEnumeration implements Enumeration {
+ private Object[] array;
+ int cur = 0;
+
+ public ArrayEnumeration(Object[] array, int size) {
+ this.array = new Object[size];
+ System.arraycopy(array, 0, this.array, 0, this.array.length);
+ }
+
+ public boolean hasMoreElements() {
+ return cur < array.length;
+ }
+
+ public Object nextElement() {
+ return array[cur++];
+ }
+ }
+
+ public synchronized void clear() {
+ if (readOnly)
+ throw new UnsupportedOperationException();
+ }
+
+ public synchronized boolean containsKey(Object key) {
+ return getIndex(key) >= 0;
+ }
+
+ public boolean containsValue(Object var0) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Set entrySet() {
+ throw new UnsupportedOperationException();
+ }
+
+ public Set keySet() {
+ throw new UnsupportedOperationException();
+ }
+
+ public void putAll(Map var0) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Collection values() {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/LogHelper.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/LogHelper.java
new file mode 100644
index 000000000..140a4fa1f
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/LogHelper.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.core.helpers;
+
+import java.util.ArrayList;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.equinox.internal.prov.core.Activator;
+import org.eclipse.osgi.framework.log.FrameworkLog;
+import org.eclipse.osgi.framework.log.FrameworkLogEntry;
+
+public class LogHelper {
+
+ public static void log(IStatus status) {
+ FrameworkLog log = Activator.getFrameworkLog();
+ if (log != null) {
+ log.log(getLog(status));
+ } else {
+ System.out.println(status.getMessage());
+ if (status.getException() != null)
+ status.getException().printStackTrace();
+ }
+ }
+
+ /**
+ * Copied from PlatformLogWriter in core runtime.
+ */
+ private static FrameworkLogEntry getLog(IStatus status) {
+ Throwable t = status.getException();
+ ArrayList childlist = new ArrayList();
+
+ int stackCode = t instanceof CoreException ? 1 : 0;
+ // ensure a substatus inside a CoreException is properly logged
+ if (stackCode == 1) {
+ IStatus coreStatus = ((CoreException) t).getStatus();
+ if (coreStatus != null) {
+ childlist.add(getLog(coreStatus));
+ }
+ }
+
+ if (status.isMultiStatus()) {
+ IStatus[] children = status.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ childlist.add(getLog(children[i]));
+ }
+ }
+
+ FrameworkLogEntry[] children = (FrameworkLogEntry[]) (childlist.size() == 0 ? null : childlist.toArray(new FrameworkLogEntry[childlist.size()]));
+
+ return new FrameworkLogEntry(status.getPlugin(), status.getSeverity(), status.getCode(), status.getMessage(), stackCode, t, children);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/Messages.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/Messages.java
new file mode 100644
index 000000000..665375aab
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/Messages.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.core.helpers;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.equinox.prov.core.helpers.messages"; //$NON-NLS-1$
+
+ static {
+ // load message values from bundle file and assign to fields below
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ public static String Util_Invalid_Zip_File_Format;
+ public static String Util_Error_Unzipping;
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/MultiStatus.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/MultiStatus.java
new file mode 100644
index 000000000..0ae29073b
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/MultiStatus.java
@@ -0,0 +1,258 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.core.helpers;
+
+import java.util.*;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+
+/**
+ * An variation of the MultiStatus. Note that this does not
+ * extend runtime.MultiStatus, instead it extends Status, because
+ * the purpose of this class is to avoid a few shortcomings of
+ * runtime.MultiStatus. This is different as follows:
+ * - Add only non-ok status as child (this prevents bloat).
+ * - Children is a list instead of an array; helps when add()
+ * is called more often than getChildren()
+ */
+public class MultiStatus extends Status {
+ public final static String bundleId = "org.eclipse.equinox.prov";
+ public static final int STATUS_CODE_SUCCESS = 0;
+
+ // Use ArrayList rather than List so ensureCapacity() is available.
+ private ArrayList children = null;
+
+ /**
+ * Uses the default code, STATUS_CODE_SUCCESS and an empty message.
+ * Either set the message later, or add this to another MultiStatus.
+ */
+ public MultiStatus() {
+ this(STATUS_CODE_SUCCESS, ""); //$NON-NLS-1$
+ }
+
+ /**
+ * Uses the default code, STATUS_CODE_SUCCESS.
+ * @param msg The status message.
+ */
+ public MultiStatus(String msg) {
+ this(STATUS_CODE_SUCCESS, msg);
+ }
+
+ /**
+ * A MultiStatus with one child.
+ */
+ public MultiStatus(String msg, IStatus child) {
+ this(msg);
+ add(child);
+ }
+
+ /**
+ * This provides a way to use a specific code to
+ * indicate whether this status has been 'touched'
+ * or not. This will differentiate "operation done
+ * and successful" from "operation was not done and
+ * successful" if code < STATUS_CODE_SUCCESS.
+ * @param code The status code.
+ * @param msg The status message.
+ */
+ public MultiStatus(int code, String msg) {
+ this(code, msg, null);
+ }
+
+ /**
+ * A Multi-Status with an exception.
+ */
+ public MultiStatus(int code, String msg, Throwable exception) {
+ this(code, msg, null, exception);
+ }
+
+ /**
+ * A Multi-Status with children.
+ */
+ public MultiStatus(int code, String msg, IStatus[] nested, Throwable exception) {
+ this(OK, bundleId, code, msg, nested, exception);
+ }
+
+ /**
+ * For creation from outside of the default plugin.
+ */
+ public MultiStatus(String pluginId, int code, String msg, Throwable exception) {
+ this(OK, pluginId, code, msg, null, exception);
+ }
+
+ /**
+ * For creation from outside of the default plugin and with children.
+ */
+ public MultiStatus(String pluginId, int code, IStatus[] nested, String msg, Throwable exception) {
+ this(OK, pluginId, code, msg, nested, exception);
+ }
+
+ /**
+ * A Multi-Status with everything.
+ */
+ public MultiStatus(int severity, String pluginId, int code, String msg, IStatus[] nested, Throwable exception) {
+ super(severity, pluginId, code, msg, exception);
+ if (nested != null && nested.length > 0) {
+ addAll(Arrays.asList(nested));
+ }
+ }
+
+ /**
+ * A new MultiStatus with no children, based on a Status.
+ */
+ public MultiStatus(Status status) {
+ super(status.getSeverity(), status.getPlugin(), status.getCode(), status.getMessage(), status.getException());
+ }
+
+ /**
+ * Does this status indicate an error or cancelation.
+ */
+ public boolean isErrorOrCancel() {
+ return matches(ERROR | CANCEL);
+ }
+
+ public void setCanceled() {
+ setSeverity(getSeverity() | CANCEL);
+ }
+
+ public void setMessage(String message) {
+ super.setMessage(message);
+ }
+
+ /**
+ * Adds the given status as a child. Even if child is a
+ * multi-status it is attached as a single child. This
+ * helps in creating a tree instead of a flat list.
+ * This guards against a null child. It will add the child
+ * to the children only if the child has a non-ok severity.
+ * @param child An IStatus object to be added as a child.
+ */
+ public void add(IStatus child) {
+ if (child == null)
+ return;
+ setCumulativeCode(child);
+ // Add only non-OK children
+ if (!child.isOK()) {
+ if (child.isMultiStatus() && child.getMessage().length() == 0) {
+ addAll(child); // no message at root so just add children
+ } else {
+ ensureExtraCapacity(1);
+ children.add(child);
+ }
+ setCumulativeSeverity(child);
+ }
+ }
+
+ /**
+ * Add a collection as children of this MultiStatus, using add().
+ */
+ public void addAll(Collection nested) {
+ ensureExtraCapacity(nested.size());
+ for (Iterator i = nested.iterator(); i.hasNext();) {
+ IStatus child = (IStatus) i.next();
+ add(child);
+ }
+ }
+
+ /**
+ * Adds the children of the given status as its own
+ * chldren. This internally uses add(IStatus). This
+ * guards against a null status.
+ * @param status A multi-status IStatus object whose children
+ * are to be added to this children.
+ */
+ public void addAll(IStatus status) {
+ if (status == null || !status.isMultiStatus()) {
+ add(status);
+ return;
+ }
+ IStatus[] nested = status.getChildren();
+ ensureExtraCapacity(nested.length);
+ for (int i = 0; i < nested.length; i++) {
+ add(nested[i]);
+ }
+ }
+
+ /*
+ * @see IStatus#getChildren()
+ */
+ public IStatus[] getChildren() {
+ IStatus[] result = new IStatus[children == null ? 0 : children.size()];
+ if (result.length > 0) {
+ children.toArray(result);
+ }
+ return result;
+ }
+
+ /*
+ * @see IStatus#isMultiStatus()
+ */
+ public boolean isMultiStatus() {
+ return true;
+ }
+
+ /**
+ * Collapses the children into a flat list.
+ * If all the children are non-multi-status,
+ * this is essentially getChildren().
+ * @return An array of IStatus objects.
+ * @see #getChildren()
+ */
+ public IStatus[] getLeaves() {
+ List leaves = MultiStatusUtil.getStatusLeaves(this);
+ IStatus[] result = new IStatus[leaves.size()];
+ leaves.toArray(result);
+ return result;
+ }
+
+ // Ensure we have space for count more children,
+ // allocate or extends as needed.
+ private void ensureExtraCapacity(int count) {
+ if (this.children == null) {
+ this.children = new ArrayList(count < 4 ? 4 : count);
+ } else {
+ this.children.ensureCapacity(this.children.size() + count);
+ }
+ }
+
+ private void setCumulativeSeverity(IStatus child) {
+ int childSeverity = child.getSeverity();
+ if (childSeverity > this.getSeverity()) {
+ this.setSeverity(childSeverity);
+ }
+ }
+
+ private void setCumulativeCode(IStatus child) {
+ int childCode = child.getCode();
+ if (childCode > this.getCode()) {
+ this.setCode(childCode);
+ }
+ }
+
+ // This implementation of getMessage causes problems: in add(IStatus) we test
+ // child.getMessage().length() == 0. This change prevents that from ever being the case.
+ // We want adding a MultiStatus with no message to be equivalent to adding its children.
+ // /**
+ // * If the message is empty, iterates through the children at the time of
+ // * invocation of this message and returns the first non-blank message
+ // * @return Message string
+ // */
+ // public String getMessage() {
+ // String msg = super.getMessage();
+ // if (this.children != null) {
+ // for (Iterator i = this.children.iterator(); msg.trim().length() == 0 && i.hasNext(); ) {
+ // IStatus status = (IStatus) i.next();
+ // msg = status.getMessage();
+ // }
+ // }
+ // return msg;
+ // }
+}
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/MultiStatusUtil.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/MultiStatusUtil.java
new file mode 100644
index 000000000..df63cd910
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/MultiStatusUtil.java
@@ -0,0 +1,244 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.core.helpers;
+
+import java.util.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.MultiStatus;
+
+public class MultiStatusUtil {
+
+ private MultiStatusUtil() {
+ // No instances, please.
+ }
+
+ /**
+ * Does the given status indicate an error or cancellation.
+ */
+ public static boolean isErrorOrCancel(IStatus status) {
+ return status.matches(IStatus.ERROR | IStatus.CANCEL);
+ }
+
+ public static List getStatusLeaves(IStatus root) {
+ ArrayList leaves = new ArrayList();
+ collectStatusLeaves(root, leaves);
+ leaves.trimToSize();
+ return leaves;
+ }
+
+ public static String getFailureMessage(IStatus status) {
+ final String msgSeparator = "; "; //$NON-NLS-1$
+ return getFailureMessage(status, msgSeparator);
+ }
+
+ public static String getFailureMessage(IStatus status, String msgSeparator) {
+ if (status.isMultiStatus()) {
+ StringBuffer sb = new StringBuffer(status.getMessage());
+ List failures = MultiStatusUtil.getStatusLeaves(status);
+ boolean hasNext = false;
+ if (!failures.isEmpty()) {
+ sb.append(msgSeparator);
+ hasNext = true;
+ }
+ for (Iterator it = failures.iterator(); hasNext;) {
+ IStatus failure = (IStatus) it.next();
+ sb.append(failure.getMessage());
+ hasNext = it.hasNext();
+ int lastIndex = sb.length() - 1;
+ if (hasNext) {
+ if (sb.charAt(lastIndex) == '.') {
+ sb.deleteCharAt(lastIndex);
+ }
+ sb.append(msgSeparator);
+ } else {
+ if (sb.charAt(lastIndex) != '.') {
+ sb.append('.');
+ }
+ }
+ }
+ return sb.toString();
+ } else
+ return status.getMessage();
+ }
+
+ public static List getStatusNodes(IStatus root) {
+ ArrayList nodes = new ArrayList();
+ collectStatusNodes(root, nodes);
+ nodes.trimToSize();
+ return nodes;
+ }
+
+ private static void collectStatusLeaves(IStatus root, List leaves) {
+ if (root.isMultiStatus()) {
+ IStatus[] children = root.getChildren();
+ if (children.length == 0) {
+ leaves.add(root);
+ } else {
+ for (int i = 0; i < children.length; i++) {
+ collectStatusLeaves(children[i], leaves);
+ }
+ }
+ } else {
+ leaves.add(root);
+ }
+ }
+
+ private static IStatus newNonMultiStatus(IStatus status) {
+ if (status.isMultiStatus())
+ return new Status(status.getSeverity(), status.getPlugin(), status.getCode(), status.getMessage(), status.getException());
+ else
+ return status;
+ }
+
+ private static void collectStatusNodes(IStatus root, List nodes) {
+ nodes.add(newNonMultiStatus(root));
+ if (root.isMultiStatus()) {
+ IStatus[] children = root.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ collectStatusNodes(children[i], nodes);
+ }
+ }
+ }
+
+ public static IStatus newFlattenedStatus(String pluginId, IStatus root, String msg) {
+ if (!root.isMultiStatus())
+ return root;
+ List leaves = MultiStatusUtil.getStatusLeaves(root);
+ if (leaves.isEmpty())
+ return root;
+ IStatus[] children = (IStatus[]) leaves.toArray(new IStatus[leaves.size()]);
+ return new MultiStatus(pluginId, root.getCode(), children, msg, null);
+ }
+
+ private static boolean hasFilteredStatus(IStatus status, IStatusFilter filter) {
+ if (filter.include(status))
+ return true;
+ if (!filter.considerChildren())
+ return false;
+ IStatus[] children = status.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ IStatus child = children[i];
+ if (hasFilteredStatus(child, filter))
+ return true;
+ }
+ return false;
+ }
+
+ public interface IStatusFilter {
+ boolean include(IStatus status);
+
+ boolean considerChildren();
+ }
+
+ public static IStatus newFilteredStatus(String message, IStatus status, IStatusFilter filter) {
+ if (!status.isMultiStatus())
+ return status;
+ LinkedList list = new LinkedList();
+ IStatus[] children = status.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ IStatus child = children[i];
+ if (hasFilteredStatus(child, filter)) {
+ list.add(child);
+ }
+ }
+ IStatus[] newChildren = (IStatus[]) list.toArray(new IStatus[list.size()]);
+
+ if (newChildren.length == 0)
+ return status;
+ return new MultiStatus(status.getPlugin(), status.getCode(), newChildren, message, status.getException());
+ }
+
+ public interface IStatusRecoder {
+ boolean needsRecoding(IStatus status);
+
+ /**
+ * Recodes the status.
+ * <p>
+ * The returned status will always be a copy even if
+ * no recoding was necessary. If the input is a multi
+ * status the returned status is also a MultiStatus,
+ * but it does not yet have any children.
+ *
+ * @param status
+ * @return the recoded status
+ */
+ IStatus recode(IStatus status);
+
+ IStatus recode(IStatus multiStatus, IStatus[] children);
+ }
+
+ private static boolean needsRecoding(IStatus status, IStatusRecoder recoder) {
+ if (!status.isMultiStatus())
+ return recoder.needsRecoding(status);
+ else {
+ if (recoder.needsRecoding(status))
+ return true;
+ IStatus[] children = status.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ IStatus child = children[i];
+ if (needsRecoding(child, recoder))
+ return true;
+ }
+ return false;
+ }
+ }
+
+ private static IStatus doSingleRecode(IStatus status, IStatusRecoder recoder) {
+ if (recoder.needsRecoding(status))
+ return recoder.recode(status);
+ return status;
+ }
+
+ private static IStatus doSingleRecode(IStatus status, IStatus[] recodedChildren, IStatusRecoder recoder) {
+ if (recoder.needsRecoding(status))
+ return recoder.recode(status, recodedChildren);
+ return new org.eclipse.core.runtime.MultiStatus(status.getPlugin(), status.getCode(), recodedChildren, status.getMessage(), status.getException());
+ }
+
+ private static IStatus doRecodeStatus(IStatus status, IStatusRecoder recoder) {
+ if (!status.isMultiStatus())
+ return doSingleRecode(status, recoder);
+ IStatus[] children = status.getChildren();
+ IStatus[] recodedChildren = new IStatus[children.length];
+ for (int i = 0; i < children.length; i++) {
+ IStatus child = children[i];
+ IStatus childRecoded = doRecodeStatus(child, recoder);
+ recodedChildren[i] = childRecoded;
+ }
+ IStatus recoded = doSingleRecode(status, recodedChildren, recoder);
+ return recoded;
+ }
+
+ public static IStatus recodeStatus(IStatus status, IStatusRecoder recoder) {
+ if (!needsRecoding(status, recoder))
+ return status;
+ return doRecodeStatus(status, recoder);
+ }
+
+ public static IStatus recodeLevel(IStatus status, final int severityMask, final int newSeverity) {
+ return recodeStatus(status, new IStatusRecoder() {
+
+ public boolean needsRecoding(IStatus s) {
+ return !s.isMultiStatus() && s.matches(severityMask);
+ }
+
+ public IStatus recode(IStatus s) {
+ return new Status(newSeverity, s.getPlugin(), s.getCode(), s.getMessage(), s.getException());
+ }
+
+ public IStatus recode(IStatus multiStatus, IStatus[] children) {
+ throw new AssertionError("should never be called"); //$NON-NLS-1$
+ }
+
+ });
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/OrderedProperties.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/OrderedProperties.java
new file mode 100644
index 000000000..d1f489960
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/OrderedProperties.java
@@ -0,0 +1,163 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.core.helpers;
+
+import java.util.*;
+
+/**
+ * A Properties collection that maintains the order of insertion.
+ * <p>
+ * This class is used to store properties similar to {@link java.util.Properties}.
+ * In particular both keys and values are strings and must be not null.
+ * However this class is somewhat simplified and does not implement Cloneable,
+ * Serializable and Hashtable.
+ * <p>
+ * In contrast to java.util.Properties this class maintains the order by which
+ * properties are added. This is implemented using a {@link LinkedHashMap}.
+ * <p>
+ * The class does not support default properties as they can be expressed by
+ * creating java.util.Properties hierarchies.
+ */
+public class OrderedProperties implements Map {
+
+ private LinkedHashMap propertyMap = null;
+
+ private static final String[] NO_KEYS = new String[0];
+
+ public OrderedProperties() {
+ super();
+ }
+
+ /**
+ * Set the property value.
+ * <p>
+ * If a property with the key already exists, the previous
+ * value is replaced. Otherwise a new property is added at
+ * the end collection.
+ *
+ * @param key must not be null
+ * @param value must not be null
+ * @return previous value associated with specified key, or <tt>null</tt>
+ * if there was no mapping for key.
+ */
+ public Object setProperty(String key, String value) {
+ init();
+ return propertyMap.put(key, value);
+ }
+
+ public String getProperty(String key) {
+ return (String) (propertyMap == null ? null : propertyMap.get(key));
+ }
+
+ public String getProperty(String key, String defaultValue) {
+ String value = getProperty(key);
+ return (value == null) ? defaultValue : value;
+ }
+
+ public void putAll(OrderedProperties properties) {
+ putAll((Map) properties);
+ }
+
+ public Collection getPropertyKeysCollection() {
+ if (propertyMap == null)
+ return Collections.EMPTY_LIST;
+ return Collections.unmodifiableCollection(propertyMap.keySet());
+ }
+
+ public String[] getPropertyKeys() {
+ if (propertyMap == null)
+ return NO_KEYS;
+ Collection keySet = propertyMap.keySet();
+ return (String[]) keySet.toArray(new String[keySet.size()]);
+ }
+
+ /**
+ * Initialize the map.
+ */
+ private void init() {
+ if (propertyMap == null) {
+ propertyMap = new LinkedHashMap();
+ }
+ }
+
+ public int size() {
+ return propertyMap == null ? 0 : propertyMap.size();
+ }
+
+ public boolean isEmpty() {
+ return propertyMap == null ? true : propertyMap.isEmpty();
+ }
+
+ public synchronized void clear() {
+ propertyMap = null;
+ }
+
+ public Object put(Object arg0, Object arg1) {
+ init();
+ return propertyMap.put(arg0, arg1);
+ }
+
+ public boolean containsKey(Object key) {
+ return propertyMap != null ? propertyMap.containsKey(key) : false;
+ }
+
+ public boolean containsValue(Object value) {
+ return propertyMap != null ? propertyMap.containsValue(value) : false;
+ }
+
+ public Set entrySet() {
+ return propertyMap != null ? propertyMap.entrySet() : Collections.EMPTY_SET;
+ }
+
+ public Object get(Object key) {
+ return propertyMap != null ? propertyMap.get(key) : null;
+ }
+
+ public Set keySet() {
+ return propertyMap != null ? propertyMap.keySet() : Collections.EMPTY_SET;
+ }
+
+ public void putAll(Map arg0) {
+ init();
+ propertyMap.putAll(arg0);
+ }
+
+ public Object remove(Object key) {
+ return propertyMap != null ? propertyMap.remove(key) : null;
+ }
+
+ public Collection values() {
+ return propertyMap != null ? propertyMap.values() : Collections.EMPTY_LIST;
+ }
+
+ public boolean equals(Object o) {
+ if (o == this)
+ return true;
+ if (o instanceof OrderedProperties) {
+ OrderedProperties rhs = (OrderedProperties) o;
+ if (rhs.propertyMap == this.propertyMap)
+ return true;
+ if (rhs.propertyMap == null || this.propertyMap == null)
+ return false;
+ return rhs.propertyMap.equals(this.propertyMap);
+ }
+ return propertyMap.equals(o);
+ }
+
+ public int hashCode() {
+ return propertyMap != null ? propertyMap.hashCode() : 0;
+ }
+
+ public String toString() {
+ StringBuffer sb = new StringBuffer();
+ sb.append(propertyMap);
+ return sb.toString();
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/ServiceHelper.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/ServiceHelper.java
new file mode 100644
index 000000000..da2e44b65
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/ServiceHelper.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.core.helpers;
+
+import org.osgi.framework.*;
+
+public class ServiceHelper {
+ /**
+ * Returns the service described by the given arguments. Note that this is a helper class
+ * that <b>immediately</b> ungets the service reference. This results in a window where the
+ * system thinks the service is not in use but indeed the caller is about to use the returned
+ * service object.
+ * @param context
+ * @param name
+ * @return The requested service
+ */
+ public static Object getService(BundleContext context, String name) {
+ ServiceReference reference = context.getServiceReference(name);
+ if (reference == null)
+ return null;
+ Object result = context.getService(reference);
+ context.ungetService(reference);
+ return result;
+ }
+
+ public static Object getService(BundleContext context, String name, String filter) {
+ ServiceReference[] references;
+ try {
+ references = context.getServiceReferences(name, filter);
+ } catch (InvalidSyntaxException e) {
+ // TODO Auto-generated catch block
+ return null;
+ }
+ if (references == null || references.length == 0)
+ return null;
+ Object result = context.getService(references[0]);
+ context.ungetService(references[0]);
+ return result;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/TwoTierMap.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/TwoTierMap.java
new file mode 100644
index 000000000..0ab331da4
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/TwoTierMap.java
@@ -0,0 +1,354 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.core.helpers;
+
+import java.io.PrintStream;
+import java.io.Serializable;
+import java.util.*;
+
+/**
+ * The purpose of this class is to provide a two-tier map.
+ * MapOf(key1 => MapOf(key2 => value)).
+ * Even though this class implements Map the behavior of
+ * the methods aren't exactly the same as that of a real
+ * Map - especially, entrySet(), keySet() etc. works off
+ * the outer map while values() returns all the values of
+ * all the inner maps.
+ */
+public class TwoTierMap implements Map, Serializable {
+
+ private static final long serialVersionUID = 362497720873186265L;
+
+ private Map outerMap;
+ private int policy;
+
+ public static final int POLICY_NONE = 0, POLICY_BOTH_MAPS_PRESERVE_ORDERING = 1 << 0, POLICY_INNER_MAP_PRESERVE_EXISTING = 1 << 1, POLICY_INNER_MAP_SORTED_ASCENDING = 1 << 2, POLICY_INNER_MAP_SORTED_DESCENDING = 1 << 3, POLICY_INNER_MAP_ENSURE_SINGLETON = 1 << 4;
+
+ private static final int POLICY_INNER_MAP_SORTED_MASK = POLICY_INNER_MAP_SORTED_ASCENDING | POLICY_INNER_MAP_SORTED_DESCENDING;
+
+ public TwoTierMap() {
+ this(8, POLICY_NONE);
+ }
+
+ public TwoTierMap(int initialCapacity) {
+ this(initialCapacity, POLICY_NONE);
+ }
+
+ /**
+ * Creates a two-tier map with the specified
+ * initialCapacity and policy. The policy determines
+ * whether the outer map is ordered, inner map is
+ * sorted, clobber values of inner map etc.
+ */
+ public TwoTierMap(int initialCapacity, int policy) {
+ this.policy = policy;
+ this.outerMap = shouldUseOrderedMap() ? new LinkedHashMap(initialCapacity) : new HashMap(initialCapacity);
+ }
+
+ /**
+ * Insert the value with key key1 into the inner map
+ * that is obtained from the outer map with key key2.
+ * If you have set POLICY_INNER_MAP_PRESERVE_EXISTING
+ * at the time of creating this, it will not overwrite
+ * if there is already a non-null value at key2.
+ * The other POLICY_INNER_MAP_* policies determine
+ * what kind of inner map is created.
+ * @param key1 The key for outer map.
+ * @param key2 The key for inner map.
+ * @param value The value.
+ * @return Existing value if any, otherwise null.
+ */
+ public Object put(Object key1, Object key2, Object value) {
+ Map innerMap = (Map) this.outerMap.get(key1);
+ if (innerMap == null) {
+ if (shouldUseSingletonInnerMap()) {
+ this.outerMap.put(key1, Collections.singletonMap(key2, value));
+ return null;
+ }
+ innerMap = createInnerMap();
+ this.outerMap.put(key1, innerMap);
+ }
+ // It is faster to check for already existing entry
+ // this way instead of containsKey() check. Of course,
+ // this will prevent us from recognizing a null entry,
+ // which I think shouldn't be a problem.
+ Object existing = innerMap.put(key2, value);
+ if (existing != null && shouldPreserveExisting()) {
+ innerMap.put(key2, existing);
+ }
+ return existing;
+ }
+
+ /**
+ * Get the object stored in the inner map using key2
+ * as key where the inner map is obtained from the
+ * outer map using key1.
+ * @param key1 The key for outer map.
+ * @param key2 The key for inner map.
+ * @return The object for key2 in inner map for key1
+ * in the outer map.
+ */
+ public Object get(Object key1, Object key2) {
+ if (key1 == null || key2 == null)
+ return getAll(key1);
+ Map innerMap = (Map) this.outerMap.get(key1);
+ Object value = innerMap == null ? null : innerMap.get(key2);
+ return value;
+ }
+
+ /**
+ * Get all the values in the inner map for key1 in
+ * the outer map.
+ * @param key1 The key for outer map.
+ * @return Collection of values in the inner map.
+ */
+ public Collection getAll(Object key1) {
+ if (key1 == null)
+ // return all
+ return values();
+ Map innerMap = (Map) this.outerMap.get(key1);
+ return innerMap == null ? Collections.EMPTY_LIST : Collections.unmodifiableCollection(innerMap.values());
+
+ }
+
+ public Object remove(Object key1, Object key2) {
+ if (key1 == null || key2 == null)
+ return removeAll(key1);
+ Map innerMap = (Map) this.outerMap.get(key1);
+ if (innerMap == null)
+ return null;
+ if (shouldUseSingletonInnerMap()) {
+ Object result = innerMap.get(key2);
+ if (result != null) {
+ this.outerMap.remove(key1);
+ }
+ return result;
+ }
+ Object result = (innerMap == null) ? null : innerMap.remove(key2);
+ if (result != null && innerMap.isEmpty()) {
+ this.outerMap.remove(key1);
+ }
+ return result;
+ }
+
+ public Collection removeAll(Object key1) {
+ if (key1 == null)
+ return Collections.EMPTY_LIST;
+ Map innerMap = (Map) this.outerMap.remove(key1);
+ return innerMap == null ? Collections.EMPTY_LIST : innerMap.values();
+ }
+
+ /**
+ * Determine whether there exists a valid object for
+ * key2 in the inner map for key1 in the outer map.
+ * @param key1 The key for outer map.
+ * @param key2 The key for inner map.
+ * @return true if a non-null object exists; otherwise
+ * false.
+ */
+ public boolean containsKey(Object key1, Object key2) {
+ if (key1 == null)
+ return false;
+ if (key2 == null)
+ return containsKey(key1);
+ return get(key1, key2) != null;
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Map#clear()
+ */
+ public void clear() {
+ this.outerMap.clear();
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Map#containsKey(java.lang.Object)
+ */
+ public boolean containsKey(Object key) {
+ return this.outerMap.containsKey(key);
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Map#containsValue(java.lang.Object)
+ */
+ public boolean containsValue(Object value) {
+ for (Iterator it = entrySet().iterator(); it.hasNext();) {
+ Map.Entry entry = (Map.Entry) it.next();
+ Map innerMap = (Map) entry.getValue();
+ if (innerMap.containsValue(value))
+ return true;
+ }
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Map#size()
+ */
+ public int size() {
+ return this.outerMap.size();
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Map#isEmpty()
+ */
+ public boolean isEmpty() {
+ return this.size() == 0;
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Map#entrySet()
+ */
+ public Set entrySet() {
+ return Collections.unmodifiableSet(this.outerMap.entrySet());
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Map#values()
+ */
+ public Collection values() {
+ ArrayList result = new ArrayList(size());
+ for (Iterator it = this.outerMap.keySet().iterator(); it.hasNext();) {
+ Object key = it.next();
+ // A null key will cause infinite recursion!
+ if (key != null) {
+ result.addAll(getAll(key));
+ }
+ }
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Map#get(java.lang.Object)
+ */
+ public Object get(Object key) {
+ if (key instanceof Object[]) {
+ Object[] keys = (Object[]) key;
+ return get(keys[0], keys[1]);
+ } else
+ return getAll(key);
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Map#keySet()
+ */
+ public Set keySet() {
+ return Collections.unmodifiableSet(this.outerMap.keySet());
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Map#put(java.lang.Object, java.lang.Object)
+ */
+ public Object put(Object key, Object value) {
+ if (key instanceof Object[]) {
+ Object[] keys = (Object[]) key;
+ return put(keys[0], keys[1], value);
+ }
+ throw new IllegalArgumentException("First arg should be an array!"); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Map#putAll(java.util.Map)
+ */
+ public void putAll(Map t) {
+ throw new UnsupportedOperationException();
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Map#remove(java.lang.Object)
+ */
+ public Object remove(Object key) {
+ if (key instanceof Object[]) {
+ Object[] keys = (Object[]) key;
+ return remove(keys[0], keys[1]);
+ } else
+ return removeAll(key);
+ }
+
+ public String toString() {
+ StringBuffer sb = new StringBuffer();
+ if (this.outerMap.isEmpty()) {
+ sb.append(" (Empty)"); //$NON-NLS-1$
+ } else {
+ for (Iterator it = this.outerMap.entrySet().iterator(); it.hasNext();) {
+ Map.Entry entry = (Map.Entry) it.next();
+ sb.append(" ").append(entry.getKey()) //$NON-NLS-1$
+ .append(" = ") //$NON-NLS-1$
+ .append(entry.getValue()).append('\n');
+ }
+ sb.setLength(sb.length() - 1);
+ }
+ return sb.toString();
+ }
+
+ public void dump(PrintStream ps) {
+ if (ps == null) {
+ ps = System.out;
+ }
+ ps.println(this.toString());
+ }
+
+ private Map createInnerMap() {
+ Map innerMap;
+ if (shouldUseSortedInnerMap()) {
+ innerMap = new TreeMap(new ValueComparator(shouldSortInAscendingOrder()));
+ } else if (shouldUseOrderedMap()) {
+ innerMap = new LinkedHashMap(2);
+ } else {
+ innerMap = new HashMap(2);
+ }
+ return innerMap;
+ }
+
+ private boolean shouldPreserveExisting() {
+ return (this.policy & POLICY_INNER_MAP_PRESERVE_EXISTING) == POLICY_INNER_MAP_PRESERVE_EXISTING;
+ }
+
+ private boolean shouldUseOrderedMap() {
+ return (this.policy & POLICY_BOTH_MAPS_PRESERVE_ORDERING) == POLICY_BOTH_MAPS_PRESERVE_ORDERING;
+ }
+
+ private boolean shouldUseSortedInnerMap() {
+ return (this.policy & POLICY_INNER_MAP_SORTED_MASK) != 0;
+ }
+
+ private boolean shouldSortInAscendingOrder() {
+ return (this.policy & POLICY_INNER_MAP_SORTED_MASK) == POLICY_INNER_MAP_SORTED_ASCENDING;
+ }
+
+ private boolean shouldUseSingletonInnerMap() {
+ return (this.policy & POLICY_INNER_MAP_ENSURE_SINGLETON) == POLICY_INNER_MAP_ENSURE_SINGLETON;
+ }
+
+ private static class ValueComparator implements Comparator, Serializable {
+ private static final long serialVersionUID = 362497720873186266L;
+ private boolean ascending;
+
+ public ValueComparator(boolean ascending) {
+ this.ascending = ascending;
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+ */
+ public int compare(Object o1, Object o2) {
+ try {
+ if (o1 instanceof Comparable) {
+ int cmp = ((Comparable) o1).compareTo(o2);
+ return this.ascending ? cmp : (0 - cmp);
+ }
+ } catch (Exception e) {
+ // Ignore
+ }
+ return 1;
+ }
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/UnmodifiableProperties.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/UnmodifiableProperties.java
new file mode 100644
index 000000000..7b220d45d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/UnmodifiableProperties.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.core.helpers;
+
+import java.util.Iterator;
+import java.util.Map;
+
+public class UnmodifiableProperties extends OrderedProperties {
+
+ public UnmodifiableProperties(OrderedProperties properties) {
+ super();
+ for (Iterator iter = properties.entrySet().iterator(); iter.hasNext();) {
+ Map.Entry entry = (Map.Entry) iter.next();
+ super.put(entry.getKey(), entry.getValue());
+ }
+ }
+
+ public synchronized Object setProperty(String key, String value) {
+ throw new UnsupportedOperationException();
+ }
+
+ public synchronized Object put(Object key, Object value) {
+ throw new UnsupportedOperationException();
+ }
+
+ public synchronized Object remove(Object key) {
+ throw new UnsupportedOperationException();
+ }
+
+ public synchronized void putAll(Map t) {
+ throw new UnsupportedOperationException();
+ }
+
+ public synchronized void clear() {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/Utils.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/Utils.java
new file mode 100644
index 000000000..02c1c7ede
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/Utils.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.core.helpers;
+
+import java.io.File;
+import java.net.URL;
+
+public class Utils {
+ /*
+ * Compares two URL for equality
+ * Return false if one of them is null
+ */
+ public static boolean sameURL(URL url1, URL url2) {
+
+ if (url1 == null || url2 == null)
+ return false;
+ if (url1 == url2)
+ return true;
+ if (url1.equals(url2))
+ return true;
+
+ // check if URL are file: URL as we may
+ // have 2 URL pointing to the same featureReference
+ // but with different representation
+ // (i.e. file:/C;/ and file:C:/)
+ if (!"file".equalsIgnoreCase(url1.getProtocol())) //$NON-NLS-1$
+ return false;
+ if (!"file".equalsIgnoreCase(url2.getProtocol())) //$NON-NLS-1$
+ return false;
+
+ File file1 = getFileFor(url1);//new File(url1.getFile());
+ File file2 = getFileFor(url2);
+
+ if (file1 == null)
+ return false;
+
+ return (file1.equals(file2));
+ }
+
+ /*
+ * Method getFileFor.
+ * @param url1
+ * @return File
+ */
+ private static File getFileFor(URL url1) {
+ return new File(url1.getFile());
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/messages.properties b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/messages.properties
new file mode 100644
index 000000000..a5294426c
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/helpers/messages.properties
@@ -0,0 +1,15 @@
+###############################################################################
+# Copyright (c) 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+
+Util_Invalid_Zip_File_Format=Invalid zip file format
+Util_Error_Unzipping=Error unzipping {0}: {1}
+
+
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/location/AgentLocation.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/location/AgentLocation.java
new file mode 100644
index 000000000..809826915
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/location/AgentLocation.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.core.location;
+
+import java.net.URL;
+import org.eclipse.osgi.service.datalocation.Location;
+
+/**
+ * TODO: We are not allowed to extend Location because it's not intended
+ * to be implemented by clients.
+ */
+public interface AgentLocation extends Location {
+
+ public URL getArtifactRepositoryURL();
+
+ public URL getMetadataRepositoryURL();
+
+ public URL getTouchpointDataArea(String touchpointId);
+}
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/repository/AbstractRepository.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/repository/AbstractRepository.java
new file mode 100644
index 000000000..fed3e032e
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/repository/AbstractRepository.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.core.repository;
+
+import java.net.URL;
+import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.equinox.prov.core.helpers.OrderedProperties;
+import org.eclipse.equinox.prov.core.helpers.UnmodifiableProperties;
+
+/**
+* AbstractRepository defines common properties that may be provided by various kinds
+* of repositories.
+* <p>
+* Clients may extend this class.
+* </p>
+* TODO: Do we want additional properties - time zone, copyrights, security etc..
+*/
+
+public abstract class AbstractRepository extends PlatformObject {
+
+ protected String name;
+ protected String type;
+ protected String version;
+ protected String description;
+ protected String provider;
+ // TODO make sure that this is transiaent. NO point in storing the location in the repo itself.
+ protected URL location;
+ protected OrderedProperties properties = new OrderedProperties();
+
+ protected AbstractRepository(String name, String type, String version, URL location) {
+ this.name = name;
+ this.type = type;
+ this.version = version;
+ this.description = ""; //$NON-NLS-1$
+ this.provider = ""; //$NON-NLS-1$
+ this.location = location;
+ }
+
+ protected AbstractRepository(String name, String type, String version, URL location, String description, String provider) {
+ this(name, type, version, location);
+ this.description = description;
+ this.provider = provider;
+ }
+
+ /**
+ * Returns the name of the repository.
+ * @return the name of the repository.
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Returns a string representing the type of the repository.
+ * @return the type of the repository.
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * Returns a string representing the version for the repository type.
+ * @return the version of the type of the repository.
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ * Returns the location of this repository.
+ * TODO: Should we use URL or URI? URL requires a protocol handler
+ * to be installed in Java. Can the URL have any protocol?
+ * @return the URL of the repository.
+ */
+ public URL getLocation() {
+ return location;
+ }
+
+ /**
+ * Returns a brief description of the repository.
+ * @return the description of the repository.
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Returns the name of the provider of the repository.
+ * @return the provider of this repository.
+ */
+ public String getProvider() {
+ return provider;
+ }
+
+ /**
+ * Returns a read-only collection of the properties of the repository.
+ * @return the properties of this repository.
+ */
+ public UnmodifiableProperties getProperties() {
+ return new UnmodifiableProperties(properties);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/repository/IRepositoryInfo.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/repository/IRepositoryInfo.java
new file mode 100644
index 000000000..a63b3fc8b
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/repository/IRepositoryInfo.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.core.repository;
+
+import java.net.URL;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.equinox.prov.core.helpers.UnmodifiableProperties;
+
+/**
+ * IRepositoryInfo defines common properties that may be provided by various kinds
+ * of repositories.
+ * <p>
+ * Clients may implement this interface.
+ * </p>
+ * TODO: This should be an abstract class so methods can be added in the future
+ * without breaking clients.
+ * TODO: Do we want additional properties - time zone, copyrights, security etc..
+ */
+public interface IRepositoryInfo extends IAdaptable {
+
+ /**
+ * Returns the URL of the repository.
+ * TODO: Should we use URL or URI? URL requires a protocol handler
+ * to be installed in Java. Can the URL have any protocol?
+ * @return the URL of the repository.
+ */
+ public URL getLocation();
+
+ /**
+ * Returns the name of the repository.
+ * @return the name of the repository.
+ */
+ public String getName();
+
+ /**
+ * Returns a string representing the type of the repository.
+ * @return the type of the repository.
+ */
+ public String getType();
+
+ /**
+ * Returns a string representing the version for the repository type.
+ * @return the version of the type of the repository.
+ */
+ public String getVersion();
+
+ /**
+ * Returns a brief description of the repository.
+ * @return the description of the repository.
+ */
+ public String getDescription();
+
+ /**
+ * Returns the name of the provider of the repository.
+ * @return the provider of this repository.
+ */
+ public String getProvider();
+
+ /**
+ * Returns a read-only collection of the properties of the repository.
+ * @return the properties of this repository.
+ */
+ public UnmodifiableProperties getProperties();
+
+ /**
+ * Definitions of common property keys
+ */
+
+ // The property key for a boolean property indicating that the repository
+ // is an implementation detail, not subject to general access, hidden
+ // from the typical user, etc.
+ static public String IMPLEMENTATION_ONLY_KEY = "implementationOnly"; //$NON-NLS-1$
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/repository/IWritableRepositoryInfo.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/repository/IWritableRepositoryInfo.java
new file mode 100644
index 000000000..895435165
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/repository/IWritableRepositoryInfo.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.core.repository;
+
+import org.eclipse.equinox.prov.core.helpers.OrderedProperties;
+
+/**
+ * IWritableRepositoryInfo provides setters for common properties of various kinds
+ * of repositories.
+ * <p>
+ * Clients may implement this interface.
+ */
+public interface IWritableRepositoryInfo extends IRepositoryInfo {
+
+ /**
+ * Set the name of the repository.
+ */
+ public void setName(String name);
+
+ /**
+ * Set the type of the repository.
+ */
+ // TODO remove this method
+ public void setType(String type);
+
+ /**
+ * Set the string representing the version for the repository type.
+ */
+ // TODO and likely this method too
+ public void setVersion(String version);
+
+ /**
+ * Returns a brief description of the repository.
+ */
+ public void setDescription(String description);
+
+ /**
+ * Set the name of the provider of the repository.
+ */
+ public void setProvider(String provider);
+
+ /**
+ * Returns the modifiable collection of the properties of the repository.
+ * @return the properties of this repository.
+ */
+ public OrderedProperties getModifiableProperties();
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/repository/RepositoryCreationException.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/repository/RepositoryCreationException.java
new file mode 100644
index 000000000..87db53e90
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/prov/core/repository/RepositoryCreationException.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.core.repository;
+
+public class RepositoryCreationException extends Exception {
+
+ private static final long serialVersionUID = -5648382121963317100L;
+
+ public RepositoryCreationException(Throwable e) {
+ super(e);
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.director.app/.classpath b/bundles/org.eclipse.equinox.p2.director.app/.classpath
new file mode 100644
index 000000000..ce0c7a5d4
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.director.app/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/CDC-1.0%Foundation-1.0"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.equinox.p2.director.app/.cvsignore b/bundles/org.eclipse.equinox.p2.director.app/.cvsignore
new file mode 100644
index 000000000..c5e82d745
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.director.app/.cvsignore
@@ -0,0 +1 @@
+bin \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.director.app/.project b/bundles/org.eclipse.equinox.p2.director.app/.project
new file mode 100644
index 000000000..a1bda4f8f
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.director.app/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.equinox.prov.director.app</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.equinox.p2.director.app/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.director.app/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..78523cd05
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.director.app/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,331 @@
+#Thu Aug 16 11:00:59 EDT 2007
+eclipse.preferences.version=1
+org.eclipse.jdt.core.builder.cleanOutputFolder=clean
+org.eclipse.jdt.core.builder.duplicateResourceTask=warning
+org.eclipse.jdt.core.builder.invalidClasspath=abort
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
+org.eclipse.jdt.core.circularClasspath=error
+org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
+org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=error
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=false
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false
+org.eclipse.jdt.core.formatter.comment.format_line_comments=false
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=800
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.incompatibleJDKLevel=ignore
+org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/bundles/org.eclipse.equinox.p2.director.app/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.p2.director.app/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 000000000..03102cb3f
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.director.app/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,57 @@
+#Sun Sep 23 11:57:58 EDT 2007
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_core
+formatter_settings_version=11
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=;
+org.eclipse.jdt.ui.ondemandthreshold=3
+org.eclipse.jdt.ui.staticondemandthreshold=3
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates/>
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.format_source_code=true
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_variable_declarations_final=true
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=false
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/bundles/org.eclipse.equinox.p2.director.app/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.director.app/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..332a4197a
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.director.app/META-INF/MANIFEST.MF
@@ -0,0 +1,23 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Equinox Provisioning Director Application Plug-in (Incubation)
+Bundle-SymbolicName: org.eclipse.equinox.prov.director.app;singleton:=true
+Bundle-Version: 0.1.0.qualifier
+Import-Package: org.eclipse.equinox.app,
+ org.eclipse.equinox.internal.prov.console,
+ org.eclipse.equinox.prov.artifact.repository,
+ org.eclipse.equinox.prov.core.helpers,
+ org.eclipse.equinox.prov.core.location,
+ org.eclipse.equinox.prov.director,
+ org.eclipse.equinox.prov.engine,
+ org.eclipse.equinox.prov.metadata,
+ org.eclipse.equinox.prov.metadata.repository,
+ org.eclipse.equinox.prov.query,
+ org.eclipse.osgi.service.environment,
+ org.eclipse.osgi.service.resolver;version="1.1.0",
+ org.osgi.framework
+Bundle-Activator: org.eclipse.equinox.prov.internal.director.app.Activator
+Eclipse-LazyStart: true
+Bundle-RequiredExecutionEnvironment: CDC-1.0/Foundation-1.0,
+ J2SE-1.4
+Require-Bundle: org.eclipse.equinox.common
diff --git a/bundles/org.eclipse.equinox.p2.director.app/build.properties b/bundles/org.eclipse.equinox.p2.director.app/build.properties
new file mode 100644
index 000000000..e2356b946
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.director.app/build.properties
@@ -0,0 +1,15 @@
+###############################################################################
+# Copyright (c) 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
diff --git a/bundles/org.eclipse.equinox.p2.director.app/config.ini b/bundles/org.eclipse.equinox.p2.director.app/config.ini
new file mode 100644
index 000000000..c0024e787
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.director.app/config.ini
@@ -0,0 +1,87 @@
+# Eclipse runtime configuration file
+# This file contains a number of key/value pairs that are merged into the
+# System properties on system startup. The values control the way the
+# runtime is structured and runs.
+
+# Note: Only platform:/base/ and file: URLs are supported. In general the
+# URLs given may include a version number (e.g., .../location_1.2.3).
+# If a version is not specified, the system binds
+# to the location which matches exactly or to the versioned location with the
+# latest version number. If a version number is given then only exact matches
+# are considered.
+
+# The URL for the runtime entry point. The default value is
+# platform:/base/plugins/org.eclipse.osgi
+#osgi.framework=platform:/base/plugins/org.eclipse.osgi
+
+# The classpath for the framework found at the osgi.framework location. This
+# comma-separated list contains either URLs or simple element names. Simple
+# names are assumed to be relative to the framework's install directory.
+# Typically this value need not be set as it is initialized by the framework itself.
+# Version match searching is not done for URLs listed here.
+#osgi.frameworkClassPath =
+
+# The comma-separated list of locations to search for the splash screen file (splash.bmp).
+# For each list element a subdirectory structure based on the pattern nl/<locale> is searched.
+# The system binds to the first matching file. There is no default value.
+#osgi.splashPath=
+
+# The location of the splash screen file. If this value is set at system startup it is used
+# in favour of the osgi.splashPath searching outlined above. If the value is not set
+# the searching is done and this key is bound to the result of the search.
+#osgi.splashLocation =
+
+# The comma-separated list of bundles which are automatically installed and optionally started
+# once the system is up and running. Each entry if of the form
+# <URL | simple bundle location>[@ [<startlevel>] [":start"]]
+# If the startlevel is omitted then the framework will use the default start level for the bundle.
+# If the "start" tag is added then the bundle will be marked as started after being installed.
+# Simple bundle locations are interepreted as relative to the framework's parent directory.
+# The startlevel indicates the OSGi start level at which the bundle should run.
+osgi.bundles=\
+ com.thoughtworks.xstream,\
+ org.eclipse.core.jobs,\
+ org.eclipse.ecf,\
+ org.eclipse.ecf.filetransfer,\
+ org.eclipse.ecf.identity,\
+ org.eclipse.ecf.provider.filetransfer,\
+ org.eclipse.equinox.app@start,\
+ org.eclipse.equinox.common,\
+ org.eclipse.equinox.frameworkadmin,\
+ org.eclipse.equinox.frameworkadmin.equinox@start,\
+ org.eclipse.equinox.prov.artifact.repository,\
+ org.eclipse.equinox.prov.console,\
+ org.eclipse.equinox.prov.core,\
+ org.eclipse.equinox.prov.director,\
+ org.eclipse.equinox.prov.director.app,\
+ org.eclipse.equinox.prov.download,\
+ org.eclipse.equinox.prov.engine,\
+ org.eclipse.equinox.prov.examplarysetup@start,\
+ org.eclipse.equinox.prov.metadata,\
+ org.eclipse.equinox.prov.metadata.repository,\
+ org.eclipse.equinox.prov.operations,\
+ org.eclipse.equinox.prov.touchpoint.eclipse,\
+ org.eclipse.equinox.prov.touchpoint.natives,\
+ org.eclipse.equinox.registry,\
+ org.eclipse.equinox.simpleconfigurator,\
+ org.eclipse.equinox.simpleconfigurator.manipulator@start,\
+ org.eclipse.osgi.services,\
+ org.mozilla.rhino
+
+org.eclipse.update.reconcile=false
+
+# The product to run. A given Eclipse configuration may contain many products.
+# The product identified will supply the branding (window icons, title bar text) etc
+# as well as define the default application to run.
+#eclipse.product=
+
+# The application to run. The value specified here is the id of the application extension
+# the runtime will find, instantiate and execute once the system is up. Note that typically
+# the identified eclipse.product defines the default application to run.
+#eclipse.application=
+
+# The build identifier
+eclipse.buildId=@build@
+
+# End of file marker - must be here
+eof=eof \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.director.app/director app.launch b/bundles/org.eclipse.equinox.p2.director.app/director app.launch
new file mode 100644
index 000000000..1e149412a
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.director.app/director app.launch
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<launchConfiguration type="org.eclipse.pde.ui.EquinoxLauncher">
+<booleanAttribute key="append.args" value="true"/>
+<booleanAttribute key="automaticAdd" value="false"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="true"/>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/director app"/>
+<booleanAttribute key="default_auto_start" value="false"/>
+<intAttribute key="default_start_level" value="4"/>
+<booleanAttribute key="includeOptional" value="false"/>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-console -consolelog -application org.eclipse.equinox.prov.director.app.application&#13;&#10;-metadataRepository file:d:/tmp/equinox.prov/servers/metadataRepository/ &#13;&#10;-artifactRepository file:d:/tmp/equinox.prov/servers/artifactRepository/ &#13;&#10;-installIU sdk&#13;&#10;-destination d:/tmp/equinox.prov/eclipseApp&#13;&#10;-flavor tooling&#13;&#10;-profile foo"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Declipse.prov.data.area=d:/tmp/equinox.prov/agentData"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<stringAttribute key="target_bundles" value="org.eclipse.core.contenttype@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.runtime@default:default,org.eclipse.core.runtime.compatibility.registry@default:default,org.eclipse.equinox.app@default:true,org.eclipse.equinox.common@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.osgi@:,org.eclipse.osgi.services@default:default"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useDefaultConfigArea" value="true"/>
+<stringAttribute key="vminstall" value="ibm1.5sr1"/>
+<stringAttribute key="workspace_bundles" value="com.thoughtworks.xstream@default:default,org.eclipse.ecf@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.ecf.provider.filetransfer@default:default,org.eclipse.equinox.frameworkadmin@default:default,org.eclipse.equinox.frameworkadmin.equinox@default:true,org.eclipse.equinox.prov.artifact.repository@default:default,org.eclipse.equinox.prov.console@default:default,org.eclipse.equinox.prov.core@default:default,org.eclipse.equinox.prov.director@default:default,org.eclipse.equinox.prov.director.app@default:default,org.eclipse.equinox.prov.download@default:default,org.eclipse.equinox.prov.engine@default:default,org.eclipse.equinox.prov.examplarysetup@default:true,org.eclipse.equinox.prov.metadata@default:default,org.eclipse.equinox.prov.metadata.repository@default:default,org.eclipse.equinox.prov.touchpoint.eclipse@default:default,org.eclipse.equinox.prov.touchpoint.natives@default:default,org.eclipse.equinox.simpleconfigurator@default:default,org.eclipse.equinox.simpleconfigurator.manipulator@default:true,org.eclipse.osgi@:,org.mozilla.rhino@default:default"/>
+</launchConfiguration>
diff --git a/bundles/org.eclipse.equinox.p2.director.app/director.product b/bundles/org.eclipse.equinox.p2.director.app/director.product
new file mode 100644
index 000000000..da518df4c
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.director.app/director.product
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?pde version="3.1"?>
+
+<product name="Equinox Provisioning Director" id="org.eclipse.equinox.prov.director.app.product" application="org.eclipse.equinox.prov.director.app.application" useFeatures="true">
+
+ <configIni use="custom" path="/org.eclipse.equinox.prov.director.app/config.ini"/>
+
+ <launcherArgs>
+ <vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts</vmArgsMac>
+ </launcherArgs>
+
+ <launcher name="eclipse">
+ <solaris/>
+ <win useIco="false">
+ <bmp/>
+ </win>
+ </launcher>
+
+ <vm>
+ </vm>
+
+ <plugins>
+ </plugins>
+
+ <features>
+ <feature id="org.eclipse.equinox.prov.director.feature" version="0.0.0"/>
+ <feature id="org.eclipse.rcp" version="0.0.0"/>
+ </features>
+
+</product>
diff --git a/bundles/org.eclipse.equinox.p2.director.app/plugin.xml b/bundles/org.eclipse.equinox.p2.director.app/plugin.xml
new file mode 100644
index 000000000..e1149a15c
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.director.app/plugin.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension id="application" point="org.eclipse.core.runtime.applications">
+ <application>
+ <run class="org.eclipse.equinox.prov.internal.director.app.Application"/>
+ </application>
+ </extension>
+ <extension
+ id="product"
+ point="org.eclipse.core.runtime.products">
+ <product
+ application="org.eclipse.equinox.prov.director.app.application"
+ name="Equinox Provisioning Director">
+ </product>
+ </extension>
+
+</plugin>
diff --git a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/prov/internal/director/app/Activator.java b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/prov/internal/director/app/Activator.java
new file mode 100644
index 000000000..d87fe4da6
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/prov/internal/director/app/Activator.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.internal.director.app;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+/**
+ * @since 3.3
+ */
+public class Activator implements BundleActivator {
+
+ private static BundleContext bundleContext;
+
+ /* (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ bundleContext = context;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ bundleContext = null;
+ }
+
+ public static BundleContext getContext() {
+ return bundleContext;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/prov/internal/director/app/Application.java b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/prov/internal/director/app/Application.java
new file mode 100644
index 000000000..cb13a593c
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/prov/internal/director/app/Application.java
@@ -0,0 +1,201 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.internal.director.app;
+
+import java.net.URL;
+import java.util.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.app.IApplication;
+import org.eclipse.equinox.app.IApplicationContext;
+import org.eclipse.equinox.internal.prov.console.ProvisioningHelper;
+import org.eclipse.equinox.prov.core.helpers.LogHelper;
+import org.eclipse.equinox.prov.core.helpers.ServiceHelper;
+import org.eclipse.equinox.prov.director.IDirector;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepository;
+import org.eclipse.equinox.prov.query.IQueryable;
+import org.eclipse.equinox.prov.query.Query;
+import org.eclipse.osgi.service.resolver.VersionRange;
+import org.osgi.framework.Version;
+
+/**
+ * @since 3.3
+ */
+public class Application implements IApplication {
+
+ private String destination;
+ private URL artifactRepositoryLocation;
+ private URL metadataRepositoryLocation;
+ private String root;
+ private String flavor;
+ private String profileId;
+ private boolean install;
+ private String bundlePool = null;
+ private String nl;
+ private String os;
+ private String arch;
+ private String ws;
+ private boolean roamingProfile = false;
+ private Version version = null;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext)
+ */
+ public Object start(IApplicationContext context) throws Exception {
+ Map args = context.getArguments();
+ initializeFromArguments((String[]) args.get("application.args"));
+
+ Properties props = new Properties();
+ props.setProperty(Profile.PROP_INSTALL_FOLDER, destination);
+ props.setProperty(Profile.PROP_FLAVOR, flavor);
+ if (bundlePool != null)
+ if (bundlePool.equals("<destination>"))
+ props.setProperty("eclipse.prov.cache", destination);
+ else
+ props.setProperty("eclipse.prov.cache", bundlePool);
+ if (roamingProfile)
+ props.setProperty("eclipse.prov.roaming", "true");
+
+ String env = getEnvironmentProperty();
+ if (env != null)
+ props.setProperty(Profile.PROP_ENVIRONMENTS, env);
+ Profile profile = ProvisioningHelper.addProfile(profileId, props);
+ String currentFlavor = profile.getValue(Profile.PROP_FLAVOR);
+ if (currentFlavor != null && !currentFlavor.endsWith(flavor))
+ throw new RuntimeException("Install flavor not consistent with profile flavor");
+
+ IDirector director = (IDirector) ServiceHelper.getService(Activator.getContext(), IDirector.class.getName());
+ if (director == null)
+ throw new RuntimeException("Director could not be loaded");
+ ProvisioningHelper.addArtifactRepository(artifactRepositoryLocation);
+ IMetadataRepository metadataRepository = ProvisioningHelper.addMetadataRepository(metadataRepositoryLocation);
+ IInstallableUnit[] roots = Query.query(new IQueryable[] {metadataRepository}, root, version == null ? null : new VersionRange(version, true, version, true), null, false, null);
+ IStatus operationStatus = null;
+ if (roots.length > 0) {
+ if (install) {
+ operationStatus = director.install(roots, profile, null, new NullProgressMonitor());
+ } else {
+ operationStatus = director.uninstall(roots, profile, new NullProgressMonitor());
+ }
+ } else {
+ operationStatus = new Status(IStatus.INFO, "org.eclipse.equinox.prov.director.test", "The installable unit '" + root + "' has not been found");
+ }
+
+ if (operationStatus.isOK()) {
+ System.out.println((install ? "installation" : "uninstallation") + " complete");
+ } else {
+ System.out.println((install ? "installation" : "uninstallation") + " failed. " + operationStatus);
+ LogHelper.log(operationStatus);
+ }
+ return null;
+ }
+
+ public void stop() {
+ }
+
+ public void initializeFromArguments(String[] args) throws Exception {
+ if (args == null)
+ return;
+ for (int i = 0; i < args.length; i++) {
+
+ if (args[i].equals("-roaming")) {
+ roamingProfile = true;
+ }
+
+ // check for args without parameters (i.e., a flag arg)
+
+ // check for args with parameters. If we are at the last
+ // argument or
+ // if the next one
+ // has a '-' as the first character, then we can't have an arg
+ // with
+ // a parm so continue.
+ if (i == args.length - 1 || args[i + 1].startsWith("-")) //$NON-NLS-1$
+ continue;
+
+ String arg = args[++i];
+
+ if (args[i - 1].equalsIgnoreCase("-profile"))
+ profileId = arg;
+
+ if (args[i - 1].equalsIgnoreCase("-destination") || args[i - 1].equalsIgnoreCase("-dest"))
+ destination = arg;
+
+ if (args[i - 1].equalsIgnoreCase("-bundlepool") || args[i - 1].equalsIgnoreCase("-bp"))
+ bundlePool = arg;
+
+ if (args[i - 1].equalsIgnoreCase("-metadataRepository") || args[i - 1].equalsIgnoreCase("-mr"))
+ metadataRepositoryLocation = new URL(arg);
+
+ if (args[i - 1].equalsIgnoreCase("-artifactRepository") | args[i - 1].equalsIgnoreCase("-ar"))
+ artifactRepositoryLocation = new URL(arg);
+
+ if (args[i - 1].equalsIgnoreCase("-flavor"))
+ flavor = arg;
+
+ if (args[i - 1].equalsIgnoreCase("-installIU")) {
+ root = arg;
+ install = true;
+ }
+
+ if (args[i - 1].equalsIgnoreCase("-version")) {
+ version = new Version(arg);
+ }
+
+ if (args[i - 1].equalsIgnoreCase("-uninstallIU")) {
+ root = arg;
+ install = false;
+ }
+
+ if (args[i - 1].equalsIgnoreCase("-prov.os")) {
+ os = arg;
+ }
+ if (args[i - 1].equalsIgnoreCase("-prov.ws")) {
+ ws = arg;
+ }
+ if (args[i - 1].equalsIgnoreCase("-prov.nl")) {
+ nl = arg;
+ }
+ if (args[i - 1].equalsIgnoreCase("-prov.arch")) {
+ arch = arg;
+ }
+ }
+ }
+
+ private String getEnvironmentProperty() {
+ Properties values = new Properties();
+ if (os != null)
+ values.put("osgi.os", os);
+ if (nl != null)
+ values.put("osgi.nl", nl);
+ if (ws != null)
+ values.put("osgi.ws", ws);
+ if (arch != null)
+ values.put("osgi.arch", arch);
+ if (values.isEmpty())
+ return null;
+ return toString(values);
+ }
+
+ private String toString(Properties context) {
+ StringBuffer result = new StringBuffer();
+ for (Enumeration iter = context.keys(); iter.hasMoreElements();) {
+ String key = (String) iter.nextElement();
+ result.append(key);
+ result.append('=');
+ result.append(context.get(key));
+ if (iter.hasMoreElements())
+ result.append(',');
+ }
+ return result.toString();
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.director/.classpath b/bundles/org.eclipse.equinox.p2.director/.classpath
new file mode 100644
index 000000000..7cdeb7319
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.director/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/CDC-1.1%Foundation-1.1"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.equinox.p2.director/.cvsignore b/bundles/org.eclipse.equinox.p2.director/.cvsignore
new file mode 100644
index 000000000..c5e82d745
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.director/.cvsignore
@@ -0,0 +1 @@
+bin \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.director/.project b/bundles/org.eclipse.equinox.p2.director/.project
new file mode 100644
index 000000000..aae538be8
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.director/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.equinox.prov.director</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.equinox.p2.director/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.director/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..78523cd05
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.director/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,331 @@
+#Thu Aug 16 11:00:59 EDT 2007
+eclipse.preferences.version=1
+org.eclipse.jdt.core.builder.cleanOutputFolder=clean
+org.eclipse.jdt.core.builder.duplicateResourceTask=warning
+org.eclipse.jdt.core.builder.invalidClasspath=abort
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
+org.eclipse.jdt.core.circularClasspath=error
+org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
+org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=error
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=false
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false
+org.eclipse.jdt.core.formatter.comment.format_line_comments=false
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=800
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.incompatibleJDKLevel=ignore
+org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/bundles/org.eclipse.equinox.p2.director/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.p2.director/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 000000000..014501b61
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.director/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,57 @@
+#Sun Sep 23 11:57:54 EDT 2007
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_core
+formatter_settings_version=11
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=;
+org.eclipse.jdt.ui.ondemandthreshold=3
+org.eclipse.jdt.ui.staticondemandthreshold=3
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates/>
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.format_source_code=true
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_variable_declarations_final=true
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=false
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/bundles/org.eclipse.equinox.p2.director/.settings/org.eclipse.pde.core.prefs b/bundles/org.eclipse.equinox.p2.director/.settings/org.eclipse.pde.core.prefs
new file mode 100644
index 000000000..7913d20db
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.director/.settings/org.eclipse.pde.core.prefs
@@ -0,0 +1,4 @@
+
+eclipse.preferences.version=1
+pluginProject.extensions=false
+resolve.requirebundle=false
diff --git a/bundles/org.eclipse.equinox.p2.director/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.director/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..bea852499
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.director/META-INF/MANIFEST.MF
@@ -0,0 +1,25 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Director Plug-in (Incubation)
+Bundle-SymbolicName: org.eclipse.equinox.prov.director
+Bundle-Version: 0.1.0.qualifier
+Import-Package: org.eclipse.equinox.prov.core.eventbus,
+ org.eclipse.equinox.prov.core.helpers,
+ org.eclipse.equinox.prov.core.location,
+ org.eclipse.equinox.prov.core.repository,
+ org.eclipse.equinox.prov.engine,
+ org.eclipse.equinox.prov.installregistry,
+ org.eclipse.equinox.prov.metadata,
+ org.eclipse.equinox.prov.metadata.repository,
+ org.eclipse.equinox.prov.query,
+ org.eclipse.equinox.prov.resolution,
+ org.eclipse.osgi.service.resolver;version="1.1.0",
+ org.eclipse.osgi.util;version="1.0.0",
+ org.osgi.framework;version="1.3.0"
+Export-Package: org.eclipse.equinox.internal.prov.director,
+ org.eclipse.equinox.prov.director
+Bundle-Activator: org.eclipse.equinox.internal.prov.director.DirectorActivator
+Eclipse-LazyStart: true
+Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
+ J2SE-1.4
+Require-Bundle: org.eclipse.equinox.common
diff --git a/bundles/org.eclipse.equinox.p2.director/about.html b/bundles/org.eclipse.equinox.p2.director/about.html
new file mode 100644
index 000000000..460233046
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.director/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 2, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.director/build.properties b/bundles/org.eclipse.equinox.p2.director/build.properties
new file mode 100644
index 000000000..475da1dec
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.director/build.properties
@@ -0,0 +1,15 @@
+###############################################################################
+# Copyright (c) 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/prov/director/BasicIUFilter.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/prov/director/BasicIUFilter.java
new file mode 100644
index 000000000..bbc212a06
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/prov/director/BasicIUFilter.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.internal.prov.director;
+
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+
+public class BasicIUFilter extends IUFilter {
+ private IInstallableUnit[] accepted;
+
+ public BasicIUFilter(IInstallableUnit[] accepted) {
+ this.accepted = accepted;
+ }
+
+ public boolean accept(IInstallableUnit iu) {
+ for (int i = 0; i < accepted.length; i++) {
+ if (accepted[i].equals(iu))
+ return true;
+ }
+ return false;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/prov/director/DirectorActivator.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/prov/director/DirectorActivator.java
new file mode 100644
index 000000000..6fc46f6de
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/prov/director/DirectorActivator.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.director;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class DirectorActivator implements BundleActivator {
+ public static final String PI_DIRECTOR = "org.eclipse.equinox.prov.director"; //$NON-NLS-1$
+ public static BundleContext context;
+
+ public void start(BundleContext ctx) throws Exception {
+ context = ctx;
+ }
+
+ public void stop(BundleContext ctx) throws Exception {
+ DirectorActivator.context = null;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/prov/director/IUFilter.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/prov/director/IUFilter.java
new file mode 100644
index 000000000..96d88da8c
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/prov/director/IUFilter.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.director;
+
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+
+public abstract class IUFilter {
+ public abstract boolean accept(IInstallableUnit iu);
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/prov/director/IUTransformationHelper.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/prov/director/IUTransformationHelper.java
new file mode 100644
index 000000000..5b305bdd0
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/prov/director/IUTransformationHelper.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.internal.prov.director;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.metadata.RequiredCapability;
+import org.eclipse.osgi.service.resolver.VersionRange;
+
+public class IUTransformationHelper {
+ static public RequiredCapability[] toRequirements(Iterator ius, boolean optional) {
+ ArrayList result = new ArrayList();
+ while (ius.hasNext()) {
+ IInstallableUnit current = (IInstallableUnit) ius.next();
+ result.add(new RequiredCapability(IInstallableUnit.IU_NAMESPACE, current.getId(), new VersionRange(current.getVersion(), true, current.getVersion(), true), null, optional, false));
+ }
+ return (RequiredCapability[]) result.toArray(new RequiredCapability[result.size()]);
+ }
+
+ static public RequiredCapability[] toRequirements(IInstallableUnit[] ius, boolean optional) {
+ RequiredCapability[] result = new RequiredCapability[ius.length];
+ for (int i = 0; i < result.length; i++) {
+ IInstallableUnit current = ius[i];
+ result[i] = new RequiredCapability(IInstallableUnit.IU_NAMESPACE, current.getId(), new VersionRange(current.getVersion(), true, current.getVersion(), true), null, optional, false);
+ }
+ return result;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/prov/director/Messages.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/prov/director/Messages.java
new file mode 100644
index 000000000..dd4b9980a
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/prov/director/Messages.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.director;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.equinox.internal.prov.director.messages"; //$NON-NLS-1$
+
+ static {
+ // initialize resource bundles
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ // Do not instantiate
+ }
+
+ public static String Director_Install_Problems;
+
+ public static String Director_Uninstall_Problems;
+ public static String Director_Nothing_To_Uninstall;
+ public static String Director_Cannot_Uninstall;
+
+ public static String Director_Replace_Problems;
+ public static String Director_Become_Problems;
+ public static String Director_Unexpected_IU;
+ public static String Director_Task_Installing;
+ public static String Director_Task_Uninstalling;
+ public static String Director_Task_Updating;
+ public static String Director_Task_Resolving_Dependencies;
+ public static String Director_Resolving_Shared_Dependencies;
+ public static String Director_Unsatisfied_Dependencies;
+ public static String Director_Unsatisfied_Dependency;
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/prov/director/OperationGenerator.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/prov/director/OperationGenerator.java
new file mode 100644
index 000000000..1944bb4b8
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/prov/director/OperationGenerator.java
@@ -0,0 +1,126 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.internal.prov.director;
+
+import java.util.*;
+import org.eclipse.equinox.prov.engine.Operand;
+import org.eclipse.equinox.prov.metadata.*;
+import org.eclipse.equinox.prov.query.CompoundIterator;
+import org.eclipse.osgi.service.resolver.VersionRange;
+
+public class OperationGenerator {
+ static IResolvedInstallableUnit NULL_IU = new ResolvedInstallableUnit(new InstallableUnit());
+
+ public Operand[] generateOperation(Collection from_, Collection to_) {
+ List from = new ArrayList(from_);
+ Collections.sort(from);
+
+ List to = new ArrayList(to_);
+ Collections.sort(to);
+
+ ArrayList operations = new ArrayList();
+ generateUpdates(from, to, operations);
+ generateInstallUninstall(from, to, operations);
+ Operand[] ops = (Operand[]) operations.toArray(new Operand[operations.size()]);
+ return ops;
+ }
+
+ private void generateInstallUninstall(List from, List to, ArrayList operations) {
+ int toIdx = 0;
+ int fromIdx = 0;
+ while (fromIdx != from.size() && toIdx != to.size()) {
+ IResolvedInstallableUnit fromIU = (IResolvedInstallableUnit) from.get(fromIdx);
+ IResolvedInstallableUnit toIU = (IResolvedInstallableUnit) to.get(toIdx);
+ int comparison = toIU.compareTo(fromIU);
+ if (comparison < 0) {
+ operations.add(createInstallOperation(toIU));
+ toIdx++;
+ } else if (comparison == 0) {
+ toIdx++;
+ fromIdx++;
+ // System.out.println("same " + fromIU);
+ } else {
+ operations.add(createUninstallOperation(fromIU));
+ fromIdx++;
+ }
+ }
+ if (fromIdx != from.size()) {
+ for (int i = fromIdx; i < from.size(); i++) {
+ operations.add(createUninstallOperation((IResolvedInstallableUnit) from.get(i)));
+ }
+ }
+ if (toIdx != to.size()) {
+ for (int i = toIdx; i < to.size(); i++) {
+ operations.add(createInstallOperation((IResolvedInstallableUnit) to.get(i)));
+ }
+ }
+ }
+
+ private void generateUpdates(List from, List to, ArrayList operations) {
+ Set processed = new HashSet();
+ for (int toIdx = 0; toIdx < to.size(); toIdx++) {
+ IResolvedInstallableUnit iuTo = (IResolvedInstallableUnit) to.get(toIdx);
+ if (iuTo.getId().equals(next(from, toIdx).getId())) {
+ toIdx = skip(to, iuTo, toIdx) - 1;
+ //System.out.println("Can't update " + iuTo + " because another iu with same id is in the target state");
+ continue;
+ }
+ if (iuTo.getProperty(IInstallableUnitConstants.UPDATE_FROM) == null)
+ continue;
+ //when the ui we update from is in the new state, skip (for example FROM is A, C, B & TO is C (update of
+ Iterator updates = new CompoundIterator(new Iterator[] {from.iterator()}, iuTo.getProperty(IInstallableUnitConstants.UPDATE_FROM), new VersionRange(iuTo.getProperty(IInstallableUnitConstants.UPDATE_RANGE)), null, false);
+ IResolvedInstallableUnit iuFrom;
+ if (!updates.hasNext()) { //Nothing to udpate from.
+ continue;
+ }
+ iuFrom = (IResolvedInstallableUnit) updates.next();
+ if (updates.hasNext()) { //There are multiple IUs to update from
+ //System.out.println("Can't update " + iuTo + " because there are multiple IUs to update from (" + toString(iusFrom) + ')');
+ continue;
+ }
+ if (iuTo.equals(iuFrom)) {
+ from.remove(iuFrom);
+ to.remove(iuTo);
+ continue;
+ }
+ operations.add(createUpdateOperation(iuFrom, iuTo));
+ from.remove(iuFrom);
+ processed.add(iuTo);
+ }
+ to.removeAll(processed);
+ }
+
+ private Operand createUninstallOperation(IResolvedInstallableUnit iu) {
+ return new Operand(iu, null);
+ }
+
+ private Operand createInstallOperation(IResolvedInstallableUnit iu) {
+ return new Operand(null, iu);
+ }
+
+ private Operand createUpdateOperation(IResolvedInstallableUnit from, IResolvedInstallableUnit to) {
+ return new Operand(from, to);
+ }
+
+ private IResolvedInstallableUnit next(List l, int i) {
+ i++;
+ if (i >= l.size())
+ return NULL_IU;
+ return (IResolvedInstallableUnit) l.get(i);
+ }
+
+ private int skip(List c, IResolvedInstallableUnit id, int idx) {
+ int i = idx;
+ for (; i < c.size(); i++) {
+ if (!id.getId().equals(((IInstallableUnit) c.get(idx)).getId()))
+ return i;
+ }
+ return i;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/prov/director/Picker.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/prov/director/Picker.java
new file mode 100644
index 000000000..70249358e
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/prov/director/Picker.java
@@ -0,0 +1,129 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.director;
+
+import java.util.*;
+import org.eclipse.equinox.prov.metadata.*;
+import org.eclipse.osgi.service.resolver.VersionRange;
+
+//The pickers goal is to find an installable unit that satisfies a search criteria
+//TODO we may need additional variations of these method where version can be null, or where the search returns all the match, not just the first one
+//TODO do we want a facility to limit the searching space, or do we assume that the unitsToPickFrom has already been scoped
+public class Picker {
+ //TODO we'll likely need better indexing capabilities
+ private IInstallableUnit[] preferredSet;
+ private IInstallableUnit[] completeSet;
+ private IInstallableUnit[] secondChoiceSet;
+ private RecommendationDescriptor recommendations;
+
+ private List filters;
+
+ public Picker(IInstallableUnit[] unitsToPickFrom, RecommendationDescriptor recommendations) {
+ if (unitsToPickFrom != null)
+ completeSet = unitsToPickFrom;
+ else
+ completeSet = new InstallableUnit[0];
+ this.secondChoiceSet = completeSet;
+ this.recommendations = recommendations;
+ this.filters = new ArrayList(2);
+ }
+
+ public Collection[] findInstallableUnit(String id, VersionRange range, RequiredCapability searchedCapability) {
+ IInstallableUnit[][] tmp = findInstallableUnit(id, range, new RequiredCapability[] {searchedCapability}, false);
+ return new Collection[] {Arrays.asList(tmp[0]), Arrays.asList(tmp[1])};
+ }
+
+ public void prefer(Collection filtersToAdd) {
+ if (!filters.addAll(filtersToAdd))
+ return;
+ if (filters.size() == 0)
+ return;
+ Set preferredIUs = new HashSet(completeSet.length);
+ Set secondChoice = new HashSet(completeSet.length);
+ for (int i = 0; i < completeSet.length; i++) {
+ for (Iterator iterator = filters.iterator(); iterator.hasNext();) {
+ if (((IUFilter) iterator.next()).accept(completeSet[i])) {
+ preferredIUs.add(completeSet[i]);
+ continue;
+ } else {
+ secondChoice.add(completeSet[i]);
+ }
+ }
+ }
+ preferredSet = (IInstallableUnit[]) preferredIUs.toArray(new IInstallableUnit[preferredIUs.size()]);
+ secondChoiceSet = (IInstallableUnit[]) secondChoice.toArray(new IInstallableUnit[secondChoice.size()]);
+ }
+
+ public IInstallableUnit[][] findInstallableUnit(String id, VersionRange range, RequiredCapability[] searchedCapability, boolean fragmentsOnly) {
+ return new IInstallableUnit[][] {findInstallableUnit(preferredSet, id, range, searchedCapability, fragmentsOnly), findInstallableUnit(secondChoiceSet, id, range, searchedCapability, fragmentsOnly)};
+ }
+
+ //TODO what should be the return value when all the parameters are null. Is it even a valid call?
+ //TODO A lot of improvement could be done on this algorithm, for example
+ // - remove from the set of searchedCapability the one that are found
+ private IInstallableUnit[] findInstallableUnit(IInstallableUnit[] pool, String id, VersionRange range, RequiredCapability[] searchedCapability, boolean fragmentsOnly) {
+ if (pool == null || pool.length == 0)
+ return new IInstallableUnit[0];
+ Set candidates = new HashSet();
+
+ //Filter on plugin id and range
+ if (id != null && range != null) {
+ for (int i = 0; i < pool.length; i++) {
+ if (pool[i].getId().equals(id) && range.isIncluded(pool[i].getVersion()))
+ candidates.add(pool[i]);
+ }
+ pool = (InstallableUnit[]) candidates.toArray(new IInstallableUnit[candidates.size()]);
+ }
+
+ //Filter on capabilities.
+ if (searchedCapability != null) {
+ searchedCapability = rewrite(searchedCapability);
+ for (int i = 0; i < pool.length; i++) {
+ IInstallableUnit candidate = pool[i];
+ for (int k = 0; k < searchedCapability.length; k++) {
+ boolean valid = false;
+ ProvidedCapability[] capabilities = candidate.getProvidedCapabilities();
+ if (capabilities.length == 0)
+ valid = false;
+ for (int j = 0; j < capabilities.length; j++) {
+ if ((searchedCapability[k].getName().equals(capabilities[j].getName()) && searchedCapability[k].getNamespace().equals(capabilities[j].getNamespace()) && (searchedCapability[k].getRange() == null ? true : searchedCapability[k].getRange().isIncluded(capabilities[j].getVersion())))) { //TODO Need to deal with option
+ valid = true;
+ break;
+ }
+ }
+ if (valid && (!fragmentsOnly || candidate.isFragment())) {
+ candidates.add(candidate);
+ }
+ }
+ }
+ pool = (IInstallableUnit[]) candidates.toArray(new IInstallableUnit[candidates.size()]);
+ }
+
+ return pool;
+ }
+
+ private RequiredCapability[] rewrite(RequiredCapability[] requiredCapabilities) {
+ if (recommendations == null)
+ return requiredCapabilities;
+ RequiredCapability[] result = new RequiredCapability[requiredCapabilities.length];
+ for (int i = 0; i < requiredCapabilities.length; i++) {
+ result[i] = getRecommendation(requiredCapabilities[i]);
+ if (result[i] == null)
+ result[i] = requiredCapabilities[i];
+ }
+ return result;
+ }
+
+ private RequiredCapability getRecommendation(RequiredCapability match) {
+ Recommendation foundRecommendation = recommendations.findRecommendation(match);
+ return foundRecommendation != null ? foundRecommendation.newValue() : match;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/prov/director/RequirementBasedFilter.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/prov/director/RequirementBasedFilter.java
new file mode 100644
index 000000000..957eb6f31
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/prov/director/RequirementBasedFilter.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.internal.prov.director;
+
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.metadata.RequiredCapability;
+
+public class RequirementBasedFilter extends IUFilter {
+ private RequiredCapability[] reqs;
+
+ public RequirementBasedFilter(RequiredCapability[] toFilterOn) {
+ reqs = toFilterOn;
+ }
+
+ public boolean accept(IInstallableUnit iu) {
+ for (int i = 0; i < reqs.length; i++) {
+ if (reqs[i].getNamespace().equals(IInstallableUnit.IU_NAMESPACE) && reqs[i].getName().equals(iu.getId()) && reqs[i].getRange().isIncluded(iu.getVersion()))
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/prov/director/messages.properties b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/prov/director/messages.properties
new file mode 100644
index 000000000..795fa00db
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/prov/director/messages.properties
@@ -0,0 +1,28 @@
+###############################################################################
+# Copyright (c) 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+
+Director_Uninstall_Problems=Problems occurred while uninstalling.
+Director_Install_Problems=Problems occurred while installing.
+Director_Cannot_Uninstall=Can not uninstall {0} because others IUs depend on it.
+Director_Nothing_To_Uninstall=Nothing to uninstall.
+Director_Replace_Problems=Problems occurred while replacing.
+Director_Become_Problems=Problems occured while running become.
+Director_Unexpected_IU=The installable unit {0} can not be used here.
+Director_Task_Installing=Installing {0} to {1}
+Director_Task_Uninstalling=Uninstalling
+Director_Task_Updating=Updating
+Director_Task_Resolving_Dependencies=Resolving dependencies
+
+Director_Unsatisfied_Dependencies=\
+ Cannot complete the install because some dependencies are not satisfiable
+Director_Unsatisfied_Dependency=\
+ Unsatisfied dependency: {0}
+Director_Resolving_Shared_Dependencies=Resolving shared dependencies
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/prov/rollback/FormerState.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/prov/rollback/FormerState.java
new file mode 100644
index 000000000..f6fa26786
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/prov/rollback/FormerState.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.internal.prov.rollback;
+
+import java.util.EventObject;
+import java.util.Hashtable;
+import org.eclipse.equinox.internal.prov.director.IUTransformationHelper;
+import org.eclipse.equinox.prov.core.eventbus.ProvisioningEventBus;
+import org.eclipse.equinox.prov.core.eventbus.SynchronousProvisioningListener;
+import org.eclipse.equinox.prov.engine.*;
+import org.eclipse.equinox.prov.metadata.*;
+import org.eclipse.equinox.prov.metadata.repository.IWritableMetadataRepository;
+import org.osgi.framework.Version;
+
+public class FormerState {
+ IWritableMetadataRepository storage = null;
+
+ Hashtable generatedIUs = new Hashtable(); //key profile id, value the iu representing this profile
+
+ public FormerState(ProvisioningEventBus bus, IWritableMetadataRepository repo) {
+ if (bus == null || repo == null) {
+ throw new IllegalArgumentException("bus and storage can' be null"); //$NON-NLS-1$
+ }
+ storage = repo;
+
+ //listen for pre-event. to memorize the state of the profile
+ bus.addListener(new SynchronousProvisioningListener() {
+ public void notify(EventObject o) {
+ if (o instanceof BeginOperationEvent) {
+ BeginOperationEvent event = (BeginOperationEvent) o;
+ IInstallableUnit iuForProfile = profileToIU(event.getProfile());
+ generatedIUs.put(event.getProfile().getProfileId(), iuForProfile);
+ } else if (o instanceof CommitOperationEvent) {
+ CommitOperationEvent event = (CommitOperationEvent) o;
+ storage.addInstallableUnits(new IInstallableUnit[] {(IInstallableUnit) generatedIUs.get(event.getProfile().getProfileId())});
+ return;
+ } else if (o instanceof RollbackOperationEvent) {
+ RollbackOperationEvent event = (RollbackOperationEvent) o;
+ generatedIUs.remove(event.getProfile().getProfileId());
+ return;
+ }
+ //TODO We need to decide what to do on profile removal
+ // else if (o instanceof ProfileEvent) {
+ // ProfileEvent pe = (ProfileEvent) o;
+ // if (pe.getReason() == ProfileEvent.REMOVED) {
+ // profileRegistries.remove(pe.getProfile().getProfileId());
+ // persist();
+ // }
+ // }
+ }
+
+ });
+ }
+
+ IInstallableUnit profileToIU(Profile toConvert) {
+ InstallableUnit result = new InstallableUnit();
+ result.setProperty(IInstallableUnitConstants.PROFILE_IU_KEY, Boolean.TRUE.toString());
+ result.setId(toConvert.getProfileId());
+ result.setVersion(new Version(0, 0, 0, Long.toString(System.currentTimeMillis())));
+ result.setRequiredCapabilities(IUTransformationHelper.toRequirements(toConvert.getInstallableUnits(), false));
+ //TODO Need to do the properties in the profile
+ //TODO Do we need to mark profile with a special marker
+ return result;
+ }
+
+ // private copyProperty(Profile p) {
+ // Map profileProperties = p.getValues();
+ // }
+}
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/prov/director/IDirector.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/prov/director/IDirector.java
new file mode 100644
index 000000000..152832a56
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/prov/director/IDirector.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.director;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+
+/**
+ * Directors are responsible for determining what should be done to a given
+ * profile to reshape it as requested. That is, given the current state of a
+ * profile, a description of the desired end state of that profile and metadata
+ * describing the available IUs, a director produces a list of provisioning
+ * operations (e.g., install, update or uninstall) to perform on the related IUs.
+ * Directors are also able to validate profiles and assist in the diagnosis of
+ * configuration errors. Note that directors may range in complexity from
+ * very simple (e.g., reading a list of bundles from a static file) to very complex.
+ */
+public interface IDirector {
+ /**
+ * Installs the given units into the given profile.
+ *
+ * @param toInstall The units to install
+ * @param profile The profile to install into
+ * @param entryPoint The user visible name of the entry point. If <code>null</code> is being passed, no entry point gets created
+ * @param monitor a progress monitor, or <code>null</code> if progress
+ * reporting is not desired
+ */
+ public IStatus install(IInstallableUnit[] toInstall, Profile profile, String entryPoint, IProgressMonitor monitor);
+
+ /**
+ * Uninstalls the given units from the given profile.
+ *
+ * @param toUninstall The units to uninstall
+ * @param profile The profile from which to uninstall
+ * @param monitor a progress monitor, or <code>null</code> if progress
+ * reporting is not desired
+ */
+ public IStatus uninstall(IInstallableUnit[] toUninstall, Profile profile, IProgressMonitor monitor);
+
+ public IStatus become(IInstallableUnit target, Profile profile, IProgressMonitor monitor);
+
+ public IStatus replace(IInstallableUnit[] toUninstall, IInstallableUnit[] toInstall, Profile profile, IProgressMonitor monitor);
+
+ //TODO And many more operations for uninstallation and the rest ! See bug 179819
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/prov/director/NewDependencyExpander.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/prov/director/NewDependencyExpander.java
new file mode 100644
index 000000000..164aeeea3
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/prov/director/NewDependencyExpander.java
@@ -0,0 +1,573 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.director;
+
+import java.util.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.internal.prov.director.*;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.*;
+import org.eclipse.equinox.prov.query.CompoundIterator;
+import org.eclipse.equinox.prov.resolution.ResolutionHelper;
+import org.eclipse.equinox.prov.resolution.UnsatisfiedCapability;
+import org.eclipse.osgi.service.resolver.VersionRange;
+import org.eclipse.osgi.util.NLS;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.Version;
+
+/**
+ * Rather than trying to satisfy a particular IU, we try to satisfy all the requirements of this IU and thus recursively.
+ * The core data structure here is a map of all the requirements encountered. More precisely it is a map whose key is a simplified requirement object (ns and name only),
+ * and whose value is a data structure holding:
+ * - the intersection of all occurrences of the constraints encountered
+ * - the list of IUs satisfying this intersection
+ * The algorithm is rather simple:
+ * - gather the requirements of a set of bundles and add them to the map computing the intersection
+ * - find the IUs matching each of these requirement
+ * - repeat the two previous steps until the last step no longer find matches
+ * Then the resolver is invoked and for each unsatisfied IU that comes out of the resolver we verify if it belongs to an entry in the map where at least one other IU has been picked.
+ * If so we are good, otherwise we have a failure.
+ * Known problems:
+ * - Malicious IU. A malicious IU could be brought into the system, thus causing a detection of impossible solution. Is this really unavoidable?
+ * - The more general problem is that we do not backtrack and therefore when we pick an IU and it may cause problems that we will not discover soon enough. Looking ahead may help us
+ * in avoiding those cases but still we may have problems.
+ *
+ * To be implemented:
+ * - merge of requirements with filters
+ * - check if the IU is applicable according to its platform filter with the given environment
+ * - return unsatisfied constraints
+ * - do the recommendation
+ * TODO It may worth experimenting with two pickers (or chained) . One would pick on the alreadyInstalled ius and one on the available ones. This could help us favor already installed ius over the others.
+ */
+public class NewDependencyExpander {
+
+ private class Match {
+ /**
+ * The {@link IInstallableUnit}s satisfying this requirement.
+ */
+ Set candidates;
+ /**
+ * The environment against which capability filters are evaluated for this match.
+ */
+ Dictionary env;
+ RequiredCapability req;
+
+ public Match(RequiredCapability range, Dictionary environment) {
+ this.req = range;
+ this.env = environment;
+ candidates = new HashSet(2);
+ }
+
+ /**
+ * For debugging purposes only
+ */
+ public String toString() {
+ return "Match[" + req + ']'; //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Represents a requirement name in the map of required capabilities.
+ */
+ private class MatchKey {
+ String name;
+ String namespace;
+
+ MatchKey(RequiredCapability capability) {
+ this.namespace = capability.getNamespace();
+ this.name = capability.getName();
+ }
+
+ public boolean equals(Object object) {
+ if (!(object instanceof MatchKey))
+ return false;
+ MatchKey that = (MatchKey) object;
+ return this.namespace.equals(that.namespace) && this.name.equals(that.name);
+ }
+
+ public int hashCode() {
+ return 31 * namespace.hashCode() + name.hashCode();
+ }
+
+ public String toString() {
+ return "MatchKey(" + namespace + '/' + name + ')'; //$NON-NLS-1$
+ }
+ }
+
+ // Installable units that are optional have a dependency on themselves.
+ private class OptionalInstallableUnit extends InstallableUnit {
+ private boolean optionalReqs;
+ private IInstallableUnit wrapped;
+
+ OptionalInstallableUnit(IInstallableUnit iu, boolean generateOptionalReqs) {
+ wrapped = iu;
+ optionalReqs = generateOptionalReqs;
+ }
+
+ public String getId() {
+ return wrapped.getId();
+ }
+
+ public Version getVersion() {
+ return wrapped.getVersion();
+ }
+
+ public String getProperty(String key) {
+ return wrapped.getProperty(key);
+ }
+
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ final OptionalInstallableUnit other = (OptionalInstallableUnit) obj;
+ if (wrapped == null) {
+ if (other.wrapped != null)
+ return false;
+ } else if (!wrapped.equals(other.wrapped))
+ return false;
+ return true;
+ }
+
+ public RequiredCapability[] getRequiredCapabilities() {
+ ArrayList result = new ArrayList();
+ ProvidedCapability[] caps = wrapped.getProvidedCapabilities();
+ for (int i = 0; i < caps.length; i++) {
+ result.add(new RequiredCapability(caps[i].getNamespace(), caps[i].getName(), new VersionRange(caps[i].getVersion(), true, caps[i].getVersion(), true), null, optionalReqs, false));
+ }
+ result.addAll(Arrays.asList(wrapped.getRequiredCapabilities()));
+ return (RequiredCapability[]) result.toArray(new RequiredCapability[result.size()]);
+ }
+
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((wrapped == null) ? 0 : wrapped.hashCode());
+ return result;
+ }
+
+ public String toString() {
+ return wrapped.toString();
+ }
+ }
+
+ static final int OperationWork = 100;
+
+ private final Set alreadyInstalled = new HashSet();
+
+ private boolean includeOptional;
+
+ /**
+ * A map of all the requirements ever encountered in the system. The key is
+ * a MatchKey and the value is a List of Match objects.
+ */
+ private Map must = new HashMap();
+ private Picker picker;
+
+ private Profile profile;
+
+ private RecommendationDescriptor recommendations;
+
+ private ResolutionHelper resolver;
+
+ private IInstallableUnit[] roots;
+
+ private Collection solution;
+
+ public NewDependencyExpander(IInstallableUnit[] r, IInstallableUnit[] alreadyInstalled, IInstallableUnit[] availableIUs, Profile profile, boolean includeOptional) {
+ this.profile = profile;
+ this.roots = (r == null) ? new IInstallableUnit[0] : r;
+ this.includeOptional = includeOptional;
+ alreadyInstalled = alreadyInstalled == null ? new IInstallableUnit[0] : alreadyInstalled;
+ this.alreadyInstalled.addAll(Arrays.asList(alreadyInstalled));
+
+ IInstallableUnit[] result = new IInstallableUnit[roots.length + alreadyInstalled.length + availableIUs.length];
+ System.arraycopy(roots, 0, result, 0, roots.length);
+ System.arraycopy(alreadyInstalled, 0, result, roots.length, alreadyInstalled.length);
+ System.arraycopy(availableIUs, 0, result, roots.length + alreadyInstalled.length, availableIUs.length);
+ picker = new Picker(result, new RecommendationDescriptor(new HashSet()));
+ Collection filterForRoot = new ArrayList();
+ if (r != null && r.length > 0) {
+ filterForRoot.add(new BasicIUFilter(r));
+ filterForRoot.add(new RequirementBasedFilter(r[0].getRequiredCapabilities()));
+ }
+ picker.prefer(filterForRoot);
+ }
+
+ /**
+ * Creates a problem status for the given unsatisfied dependency.
+ */
+ private void addUnsatisfied(RequiredCapability req, Collection toAdd, MultiStatus problems) {
+ for (Iterator it = toAdd.iterator(); it.hasNext();) {
+ IInstallableUnit unit = (IInstallableUnit) it.next();
+ RequiredCapability[] required = unit.getRequiredCapabilities();
+ for (int i = 0; i < required.length; i++) {
+ if (required[i].equals(req)) {
+ UnsatisfiedCapability unsatisfied = new UnsatisfiedCapability(req, unit);
+ String msg = NLS.bind(Messages.Director_Unsatisfied_Dependency, unsatisfied);
+ problems.add(new Status(IStatus.ERROR, DirectorActivator.PI_DIRECTOR, msg));
+ }
+ }
+ }
+ }
+
+ private void algo(SubMonitor p, MultiStatus problems) {
+ //First we create dependencies on the root themselves. The first iteration will mostly consist in rediscovering the roots.
+ Collection toAdd = asOptionalIUs(Arrays.asList(roots), false);
+ toAdd.addAll(alreadyInstalled);
+ do {
+ //reset work at each iteration, then use up a third. This results in an infinite series where remaining ticks gets steadily smaller
+ p.setWorkRemaining(100);
+ extractVisibilityData(toAdd);
+ extractRequirements(toAdd);
+ toAdd = collectMatches(toAdd, problems);
+ p.worked(33);
+ } while (toAdd.size() != 0);
+
+ //don't bother invoking the resolver if we already have problems
+ // if (!problems.isOK())
+ // return;
+ invokeResolver(problems);
+ // if (problems.isOK())
+ extractSolution();
+ }
+
+ private void extractVisibilityData(Collection ius) {
+ Collection filters = new ArrayList();
+ for (Iterator iterator = ius.iterator(); iterator.hasNext();) {
+ IInstallableUnit iu = (IInstallableUnit) iterator.next();
+ if ("true".equalsIgnoreCase(iu.getProperty("lineUp"))) {
+ filters.add(new RequirementBasedFilter(iu.getRequiredCapabilities()));
+ }
+ }
+ picker.prefer(filters);
+ }
+
+ private Collection asOptionalIUs(Collection asList, boolean generateOptionalReqs) {
+ ArrayList result = new ArrayList();
+ for (Iterator iterator = asList.iterator(); iterator.hasNext();) {
+ result.add(new OptionalInstallableUnit(((IInstallableUnit) iterator.next()), generateOptionalReqs));
+ }
+ return result;
+ }
+
+ private Collection collectFlavorProviders(Collection toSearchFor) {
+ String flavor = profile.getValue(Profile.PROP_FLAVOR);
+ if (flavor == null)
+ return new HashSet();
+ IInstallableUnit[][] picked = picker.findInstallableUnit(null, null, new RequiredCapability[] {new RequiredCapability(IInstallableUnit.FLAVOR_NAMESPACE, flavor, VersionRange.emptyRange, null, false, false)}, true /* fragmentsOnly */);
+ IInstallableUnit[] ius;
+ if (picked[0].length > 0)
+ ius = picked[0];
+ else
+ ius = picked[1];
+ Set results = new HashSet(ius.length);
+ for (int i = 0; i < ius.length; i++) {
+ IInstallableUnit tmp = match(toSearchFor, ius[i]);
+ if (tmp != null)
+ results.add(new OptionalInstallableUnit(tmp, false));
+ }
+ return results;
+ }
+
+ private Collection collectInstallableUnitFragments(Collection ius) {
+ Set picked = new HashSet();
+ for (Iterator iterator = ius.iterator(); iterator.hasNext();) {
+ IInstallableUnit current = (IInstallableUnit) iterator.next();
+ IInstallableUnit[][] candidates = picker.findInstallableUnit(null, null, new RequiredCapability[] {new RequiredCapability("fragment", current.getId(), VersionRange.emptyRange, null, true, false)}, false /* not fragmentsOnly */); //$NON-NLS-1$
+ IInstallableUnit[] matches = candidates[0].length > 0 ? candidates[0] : candidates[1];
+ if (matches.length > 0) { //TODO Here we need to check the filter of the found iu
+ if (matches.length == 1) {
+ picked.add(matches[0]);
+ continue;
+ }
+ //verify that each IU requires the current iu
+ ProvidedCapability capForCurrent = new ProvidedCapability(IInstallableUnit.IU_NAMESPACE, current.getId(), current.getVersion());
+ Map toAdd = new HashMap();
+ for (int i = 0; i < matches.length; i++) {
+ RequiredCapability[] reqs = matches[i].getRequiredCapabilities();
+ boolean isReallyAFragment = false;
+ for (int j = 0; j < reqs.length; j++) {
+ isReallyAFragment = capForCurrent.isSatisfiedBy(reqs[j]);
+ }
+ if (!isReallyAFragment)
+ continue;
+ IInstallableUnit match = (IInstallableUnit) toAdd.get(matches[i].getId());
+ if (match == null || match.getVersion().compareTo(matches[i].getVersion()) < 0)
+ toAdd.put(matches[i].getId(), matches[i]);
+ }
+ picked.addAll(toAdd.values());
+ //in the reminder, check if more than one is good, then pick the highest one.
+ }
+ }
+ return picked;
+ }
+
+ // For each requirement, find the potential IUs
+ private Collection collectMatches(Collection toAdd, MultiStatus problems) {
+ Collection thingsAdded = new HashSet();
+ for (Iterator iterator = must.values().iterator(); iterator.hasNext();) {
+ List all = (List) iterator.next();
+ for (Iterator matches = all.iterator(); matches.hasNext();) {
+ Match current = (Match) matches.next();
+ Collection[] picked = picker.findInstallableUnit(null, null, current.req);
+ Collection found = picked[0].size() > 0 ? picked[0] : picked[1];
+ if (current.candidates.addAll(found)) {
+ thingsAdded.addAll(found);
+ thingsAdded.addAll(collectOptionalInstallableUnits(found));
+ }
+ if (current.candidates.size() == 0 && requirementEnabled(current.req))
+ addUnsatisfied(current.req, toAdd, problems);
+ }
+ if (all.size() > 2) {
+ throw new IllegalStateException("Can't deal with three or more different versions of the same IU " + ((Match) all.get(0)).req + ". See bug 200380");
+ }
+ if (all.size() > 1) {
+ //TODO This algorithm needs to be generalized to consider all the potential candidates.
+ Set set1 = ((Match) all.get(0)).candidates;
+ Set set2 = ((Match) all.get(1)).candidates;
+ boolean potentialSolution = false;
+ for (Iterator iteratorSet1 = set1.iterator(); iteratorSet1.hasNext() && !potentialSolution;) {
+ IInstallableUnit itemSet1 = (IInstallableUnit) iteratorSet1.next();
+ for (Iterator iteratorSet2 = set2.iterator(); iteratorSet2.hasNext() && !potentialSolution;) {
+ IInstallableUnit itemSet2 = (IInstallableUnit) iteratorSet2.next();
+ if (itemSet1.getId().equals(itemSet2.getId()) && ((itemSet1.isSingleton() == true && itemSet1.isSingleton() == itemSet2.isSingleton()) || itemSet1.isSingleton() != itemSet2.isSingleton())) {
+ continue; //This combination would not work. Keep on searching
+ }
+ potentialSolution = true;
+ }
+ }
+ if (potentialSolution == false) {
+ String msg = "Can't find a solution where both: " + all.get(0) + " and " + all.get(1) + " would be satisfied.";
+ problems.add(new Status(IStatus.ERROR, DirectorActivator.PI_DIRECTOR, msg));
+ }
+ }
+
+ }
+ return thingsAdded;
+ }
+
+ private Collection collectOptionalInstallableUnits(Collection optionalFor) {
+ if (!includeOptional)
+ return new ArrayList(0);
+ Collection result = collectFlavorProviders(optionalFor);
+ result.addAll(collectInstallableUnitFragments(optionalFor));
+ // if (result.size() != 0) {//Find the optional pieces of the optional pieces. TODO I think there can be cases where we would cycle infinitely
+ // result.addAll(collectOptionalInstallableUnits(result));
+ // }
+ return result;
+ }
+
+ /**
+ * Eliminate false positives from the set of unsatisfied capabilities returned
+ * by the resolver. This includes optional dependencies, and dependencies for
+ * which we have an available installable unit.
+ */
+ private UnsatisfiedCapability[] collectUnsatisfiedDependencies(UnsatisfiedCapability[] unresolved) {
+ ArrayList reallyUnsatisfied = new ArrayList(unresolved.length);
+ for (int i = 0; i < unresolved.length; i++) {
+ List all = (List) must.get(new MatchKey(unresolved[i].getRequiredCapability()));
+ for (Iterator iterator = all.iterator(); iterator.hasNext();) {
+ Match m = (Match) iterator.next();
+ if (requirementEnabled(m.req) && !oneResolved(m.candidates))
+ reallyUnsatisfied.add(unresolved[i]);
+ }
+ }
+ return (UnsatisfiedCapability[]) reallyUnsatisfied.toArray(new UnsatisfiedCapability[reallyUnsatisfied.size()]);
+ }
+
+ private List createList(Match m) {
+ List result = new LinkedList();
+ result.add(m);
+ return result;
+ }
+
+ public IStatus expand(SubMonitor p) {
+ MultiStatus result = new MultiStatus(DirectorActivator.PI_DIRECTOR, 1, Messages.Director_Unsatisfied_Dependencies, null);
+ try {
+ algo(SubMonitor.convert(p, "Resolving", 10), result);
+ } catch (IllegalStateException e) {
+ return new Status(IStatus.ERROR, DirectorActivator.PI_DIRECTOR, 1, e.getMessage(), null);
+ }
+ if (result.isOK())
+ return Status.OK_STATUS;
+ return result;
+ }
+
+ // return a map from a requirement to the set of installable units
+ // depending on that requirement
+ private void extractRequirements(Collection ius) {
+ //map of MatchKey->Match
+ for (Iterator iterator = ius.iterator(); iterator.hasNext();) {
+ IInstallableUnit currentUnit = (IInstallableUnit) iterator.next();
+ RequiredCapability[] toAdd = currentUnit.getRequiredCapabilities();
+ outer: for (int i = 0; i < toAdd.length; i++) {
+ RequiredCapability current = toAdd[i];
+ if (!isMeta(current)) {
+ MatchKey key = new MatchKey(current);
+ List match = (List) must.get(key);
+ if (match == null) {
+ //We've never seen a requirement like this. Make a new match
+ must.put(key, createList(new Match(current, profile.getSelectionContext())));
+ } else {
+ //look for an existing match whose version range is overlapping the new one
+ for (Iterator matches = match.iterator(); matches.hasNext();) {
+ Match currentMatch = (Match) matches.next();
+ VersionRange newRange = intersect(currentMatch.req.getRange(), current.getRange());
+ if (newRange != null) {
+ //merge version range and environment with existing match
+ currentMatch.req = new RequiredCapability(current.getNamespace(), current.getName(), newRange, null, currentMatch.req.isOptional() && current.isOptional(), false);
+ currentMatch.env = mergeEnvironments(currentMatch.env, current);
+ continue outer;
+ }
+ }
+ //the new match is disjoint from existing ones, so add a new match to the list
+ match.add(new Match(current, profile.getSelectionContext()));
+ }
+ }
+ }
+ }
+ }
+
+ private void extractSolution() {
+ solution = Collections.unmodifiableCollection(resolver.getAllResolved());
+ }
+
+ public Collection getAllInstallableUnits() {
+ if (solution == null)
+ solution = new ArrayList(0);
+ return solution;
+ }
+
+ public Collection getNewInstallableUnits() {
+ HashSet newIUs = new HashSet(getAllInstallableUnits());
+ newIUs.removeAll(alreadyInstalled);
+ return newIUs;
+ }
+
+ public RecommendationDescriptor getRecommendations() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ private VersionRange intersect(VersionRange r1, VersionRange r2) {
+ Version resultMin = null;
+ boolean resultMinIncluded = false;
+ Version resultMax = null;
+ boolean resultMaxIncluded = false;
+
+ int minCompare = r1.getMinimum().compareTo(r2.getMinimum());
+ if (minCompare < 0) {
+ resultMin = r2.getMinimum();
+ resultMinIncluded = r2.getIncludeMinimum();
+ } else if (minCompare > 0) {
+ resultMin = r1.getMinimum();
+ resultMinIncluded = r1.getIncludeMinimum();
+ } else {//minCompare == 0
+ resultMin = r1.getMinimum();
+ resultMinIncluded = r1.getIncludeMinimum() && r2.getIncludeMinimum();
+ }
+
+ int maxCompare = r1.getMaximum().compareTo(r2.getMaximum());
+ if (maxCompare > 0) {
+ resultMax = r2.getMaximum();
+ resultMaxIncluded = r2.getIncludeMaximum();
+ } else if (maxCompare < 0) {
+ resultMax = r1.getMaximum();
+ resultMaxIncluded = r1.getIncludeMaximum();
+ } else {//maxCompare == 0
+ resultMax = r1.getMaximum();
+ resultMaxIncluded = r1.getIncludeMaximum() && r2.getIncludeMaximum();
+ }
+
+ int resultRangeComparison = resultMin.compareTo(resultMax);
+ if (resultRangeComparison < 0)
+ return new VersionRange(resultMin, resultMinIncluded, resultMax, resultMaxIncluded);
+ else if (resultRangeComparison == 0 && resultMinIncluded == resultMaxIncluded) {
+ return new VersionRange(resultMin, resultMinIncluded, resultMax, resultMaxIncluded);
+ } else
+ return null;
+ }
+
+ private void invokeResolver(MultiStatus problems) {
+ resolver = new ResolutionHelper(profile.getSelectionContext(), recommendations);
+ Set toInstall = new HashSet(must.size());
+ for (Iterator iterator = must.values().iterator(); iterator.hasNext();) {
+ List allMatches = (List) iterator.next();
+ for (Iterator matches = allMatches.iterator(); matches.hasNext();) {
+ Match current = (Match) matches.next();
+ toInstall.addAll(current.candidates);
+ }
+ }
+ toInstall.removeAll(alreadyInstalled);
+ UnsatisfiedCapability[] unsatisfied = collectUnsatisfiedDependencies(resolver.install(toInstall, alreadyInstalled));
+ for (int i = 0; i < unsatisfied.length; i++) {
+ problems.add(new Status(IStatus.ERROR, DirectorActivator.PI_DIRECTOR, NLS.bind(Messages.Director_Unsatisfied_Dependency, unsatisfied[i])));
+ }
+ }
+
+ // Check whether the requirement is applicable
+ private boolean isApplicable(RequiredCapability req) {
+ String filter = req.getFilter();
+ if (filter == null)
+ return true;
+ try {
+ return DirectorActivator.context.createFilter(filter).match(profile.getSelectionContext());
+ } catch (InvalidSyntaxException e) {
+ return false;
+ }
+ }
+
+ /**
+ * Because information to discover additional things to install is mixed with information
+ * about inter-component dependencies, we end up having dependencies that cause
+ * the whole world to be selected. We are here filtering them out.
+ */
+ private boolean isMeta(RequiredCapability requiredCapability) {
+ String namespace = requiredCapability.getNamespace();
+ return namespace.equals(IInstallableUnit.CAPABILITY_ECLIPSE_TYPES) || namespace.equals(IInstallableUnit.IU_KIND_NAMESPACE) || namespace.equals(IInstallableUnit.FLAVOR_NAMESPACE);
+ }
+
+ private IInstallableUnit match(Collection close, IInstallableUnit picked) {
+ CompoundIterator it = new CompoundIterator(new Iterator[] {close.iterator()}, null, null, picked.getRequiredCapabilities(), true);
+ if (it.hasNext())
+ return picked;
+ return null;
+ }
+
+ private Dictionary mergeEnvironments(Dictionary context, RequiredCapability newCapability) {
+ String[] newSelectors = newCapability.getSelectors();
+ if (newSelectors == null || newSelectors.length == 0)
+ return context;
+ if (context == null)
+ context = new Hashtable();
+ String trueString = Boolean.TRUE.toString();
+ for (int i = 0; i < newSelectors.length; i++) {
+ context.put(newSelectors[i], trueString);
+ }
+ return context;
+ }
+
+ private boolean oneResolved(Collection ius) {
+ for (Iterator iterator = ius.iterator(); iterator.hasNext();) {
+ if (resolver.isResolved((IInstallableUnit) iterator.next()))
+ return true;
+ }
+ return false;
+ }
+
+ private boolean requirementEnabled(RequiredCapability req) {
+ if (req.isOptional())
+ return false;
+ return isApplicable(req);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/prov/director/NewSimpleDirector.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/prov/director/NewSimpleDirector.java
new file mode 100644
index 000000000..665cca2ee
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/prov/director/NewSimpleDirector.java
@@ -0,0 +1,329 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.director;
+
+import java.net.URL;
+import java.util.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.internal.prov.director.*;
+import org.eclipse.equinox.internal.prov.rollback.FormerState;
+import org.eclipse.equinox.prov.core.eventbus.ProvisioningEventBus;
+import org.eclipse.equinox.prov.core.helpers.ServiceHelper;
+import org.eclipse.equinox.prov.core.location.AgentLocation;
+import org.eclipse.equinox.prov.core.repository.IRepositoryInfo;
+import org.eclipse.equinox.prov.core.repository.IWritableRepositoryInfo;
+import org.eclipse.equinox.prov.engine.*;
+import org.eclipse.equinox.prov.metadata.*;
+import org.eclipse.equinox.prov.metadata.repository.*;
+import org.eclipse.equinox.prov.resolution.ResolutionHelper;
+import org.eclipse.osgi.service.resolver.VersionRange;
+import org.eclipse.osgi.util.NLS;
+import org.osgi.framework.Version;
+
+public class NewSimpleDirector implements IDirector {
+ static final int ExpandWork = 10;
+ static final int OperationWork = 100;
+ private Engine engine;
+
+ public static void tagAsImplementation(IWritableMetadataRepository repository) {
+ if (repository != null && repository.getProperties().getProperty(IRepositoryInfo.IMPLEMENTATION_ONLY_KEY) == null) {
+ IWritableRepositoryInfo writableInfo = (IWritableRepositoryInfo) repository.getAdapter(IWritableRepositoryInfo.class);
+ if (writableInfo != null)
+ writableInfo.getModifiableProperties().setProperty(IRepositoryInfo.IMPLEMENTATION_ONLY_KEY, Boolean.valueOf(true).toString());
+ }
+ }
+
+ public NewSimpleDirector() {
+ URL rollbackLocation = null;
+ AgentLocation agentLocation = (AgentLocation) ServiceHelper.getService(DirectorActivator.context, AgentLocation.class.getName());
+ rollbackLocation = agentLocation.getTouchpointDataArea("director");
+ ProvisioningEventBus eventBus = (ProvisioningEventBus) ServiceHelper.getService(DirectorActivator.context, ProvisioningEventBus.class.getName());
+ IMetadataRepositoryManager manager = (IMetadataRepositoryManager) ServiceHelper.getService(DirectorActivator.context, IMetadataRepositoryManager.class.getName());
+ IWritableMetadataRepository rollbackRepo = (IWritableMetadataRepository) manager.loadRepository(rollbackLocation, null);
+ if (rollbackRepo == null)
+ rollbackRepo = (IWritableMetadataRepository) manager.createRepository(rollbackLocation, "Agent rollback repo", "org.eclipse.equinox.prov.metadata.repository.simpleRepository"); //$NON-NLS-1$//$NON-NLS-2$
+ if (rollbackRepo == null)
+ throw new IllegalStateException("Unable to open or create Agent's rollback repository");
+ tagAsImplementation(rollbackRepo);
+ new FormerState(eventBus, rollbackRepo);
+ engine = (Engine) ServiceHelper.getService(DirectorActivator.context, Engine.class.getName());
+ }
+
+ //TODO This is really gross!!!!! We need to make things uniform
+ private IInstallableUnit[] toArray(Iterator it) {
+ ArrayList result = new ArrayList();
+ while (it.hasNext()) {
+ result.add(it.next());
+ }
+ return (IInstallableUnit[]) result.toArray(new IInstallableUnit[result.size()]);
+ }
+
+ protected IInstallableUnit[] createEntryPointHelper(String entryPointName, IInstallableUnit[] content) {
+ if (entryPointName == null)
+ return content;
+ return new IInstallableUnit[] {createEntryPoint(entryPointName, content)};
+ }
+
+ protected InstallableUnit createEntryPoint(String entryPointName, IInstallableUnit[] content) {
+ InstallableUnit result = new InstallableUnit();
+ result.setId("entry point " + entryPointId(content)); //$NON-NLS-1$
+ result.setVersion(new Version(0, 0, 0, Long.toString(System.currentTimeMillis())));
+ result.setRequiredCapabilities(IUTransformationHelper.toRequirements(content, false));
+ result.setProperty(IInstallableUnitConstants.ENTRYPOINT_IU_KEY, Boolean.TRUE.toString());
+ result.setProperty(IInstallableUnitConstants.NAME, entryPointName);
+ return result;
+ }
+
+ private String entryPointId(IInstallableUnit[] ius) {
+ StringBuffer result = new StringBuffer();
+ for (int i = 0; i < ius.length; i++) {
+ result.append(ius[i].getId());
+ if (i < ius.length - 1)
+ result.append(", "); //$NON-NLS-1$
+ }
+ return result.toString();
+ }
+
+ public IStatus install(IInstallableUnit[] installRoots, Profile profile, String entryPointName, IProgressMonitor monitor) {
+ SubMonitor sub = SubMonitor.convert(monitor, ExpandWork + OperationWork);
+ sub.setTaskName(Messages.Director_Task_Resolving_Dependencies);
+ try {
+ MultiStatus result = new MultiStatus(DirectorActivator.PI_DIRECTOR, 1, Messages.Director_Install_Problems, null);
+ // Get the list of ius installed in the profile we are installing into
+ IInstallableUnit[] alreadyInstalled = toArray(profile.getInstallableUnits());
+ //Compute the complete closure of things to install to successfully install the installRoots.
+ NewDependencyExpander expander = new NewDependencyExpander(createEntryPointHelper(entryPointName, installRoots), alreadyInstalled, gatherAvailableInstallableUnits(installRoots), profile, true);
+ // NewDependencyExpander expander = new NewDependencyExpander(installRoots, alreadyInstalled, gatherAvailableInstallableUnits(), profile, true);
+ IStatus expanderResult = expander.expand(sub.newChild(ExpandWork));
+ if (!expanderResult.isOK()) {
+ result.merge(expanderResult);
+ return result;
+ }
+
+ ResolutionHelper oldStateHelper = new ResolutionHelper(profile.getSelectionContext(), null);
+ Collection oldState = oldStateHelper.attachCUs(Arrays.asList(alreadyInstalled));
+ List oldStateOrder = oldStateHelper.getSorted();
+
+ ResolutionHelper newStateHelper = new ResolutionHelper(profile.getSelectionContext(), expander.getRecommendations());
+ Collection newState = newStateHelper.attachCUs(expander.getAllInstallableUnits());
+ List newStateOrder = newStateHelper.getSorted();
+
+ //TODO Here we need to sort the operations to ensure that the dependents will be treated first (see ensureDependencyOrder)
+ sub.setTaskName(NLS.bind(Messages.Director_Task_Installing, entryPointName, profile.getValue(Profile.PROP_INSTALL_FOLDER)));
+ IStatus engineResult = engine.perform(profile, new DefaultPhaseSet(), generateOperations(oldState, newState, oldStateOrder, newStateOrder), sub.newChild(OperationWork));
+ if (!engineResult.isOK())
+ result.merge(engineResult);
+
+ return result.isOK() ? Status.OK_STATUS : result;
+ } finally {
+ sub.done();
+ }
+ }
+
+ private Operand[] generateOperations(Collection fromState, Collection toState, List fromStateOrder, List newStateOrder) {
+ return sortOperations(new OperationGenerator().generateOperation(fromState, toState), newStateOrder, fromStateOrder);
+ }
+
+ private Operand[] sortOperations(Operand[] toSort, List installOrder, List uninstallOrder) {
+ List updateOp = new ArrayList();
+ for (int i = 0; i < toSort.length; i++) {
+ Operand op = toSort[i];
+ if (op.first() == null && op.second() != null) {
+ installOrder.set(installOrder.indexOf(op.second()), op);
+ continue;
+ }
+ if (op.first() != null && op.second() == null) {
+ uninstallOrder.set(uninstallOrder.indexOf(op.first()), op);
+ continue;
+ }
+ if (op.first() != null && op.second() != null) {
+ updateOp.add(op);
+ continue;
+ }
+ }
+ int i = 0;
+ for (Iterator iterator = installOrder.iterator(); iterator.hasNext();) {
+ Object elt = iterator.next();
+ if (elt instanceof Operand) {
+ toSort[i++] = (Operand) elt;
+ }
+ }
+ for (Iterator iterator = uninstallOrder.iterator(); iterator.hasNext();) {
+ Object elt = iterator.next();
+ if (elt instanceof Operand) {
+ toSort[i++] = (Operand) elt;
+ }
+ }
+ for (Iterator iterator = updateOp.iterator(); iterator.hasNext();) {
+ Object elt = iterator.next();
+ if (elt instanceof Operand) {
+ toSort[i++] = (Operand) elt;
+ }
+ }
+ return toSort;
+ }
+
+ public IStatus become(IInstallableUnit target, Profile profile, IProgressMonitor monitor) {
+ SubMonitor sub = SubMonitor.convert(monitor, OperationWork + ExpandWork);
+ sub.setTaskName(Messages.Director_Task_Resolving_Dependencies);
+ try {
+ MultiStatus result = new MultiStatus(DirectorActivator.PI_DIRECTOR, 1, Messages.Director_Become_Problems, null);
+
+ if (!Boolean.valueOf(target.getProperty(IInstallableUnitConstants.PROFILE_IU_KEY)).booleanValue()) {
+ result.add(new Status(IStatus.ERROR, DirectorActivator.PI_DIRECTOR, NLS.bind(Messages.Director_Unexpected_IU, target.getId())));
+ return result;
+ }
+
+ //TODO Here we need to deal with the change of properties between the two profiles
+ //Also if the profile changes (locations are being modified, etc), should not we do a full uninstall then an install?
+ //Maybe it depends on the kind of changes in a profile
+ //We need to get all the ius that were part of the profile and give that to be what to become
+ NewDependencyExpander toExpander = new NewDependencyExpander(new IInstallableUnit[] {target}, null, gatherAvailableInstallableUnits(new IInstallableUnit[] {target}), profile, true);
+ toExpander.expand(sub.newChild(ExpandWork));
+ ResolutionHelper newStateHelper = new ResolutionHelper(profile.getSelectionContext(), toExpander.getRecommendations());
+ Collection newState = newStateHelper.attachCUs(toExpander.getAllInstallableUnits());
+ newState.remove(target);
+
+ Iterator it = profile.getInstallableUnits();
+ Collection oldIUs = new HashSet();
+ for (; it.hasNext();) {
+ oldIUs.add(it.next());
+ }
+
+ ResolutionHelper oldStateHelper = new ResolutionHelper(profile.getSelectionContext(), null);
+ Collection oldState = oldStateHelper.attachCUs(oldIUs);
+ sub.setTaskName(Messages.Director_Task_Updating);
+ IStatus engineResult = engine.perform(profile, new DefaultPhaseSet(), generateOperations(oldState, newState, oldStateHelper.getSorted(), newStateHelper.getSorted()), sub.newChild(OperationWork));
+ if (!engineResult.isOK())
+ result.merge(engineResult);
+
+ return result;
+ } finally {
+ sub.done();
+ }
+ }
+
+ private IInstallableUnit[] inProfile(IInstallableUnit[] toFind, Profile profile, boolean found, IProgressMonitor monitor) {
+ ArrayList result = new ArrayList(toFind.length);
+ for (int i = 0; i < toFind.length; i++) {
+ if (profile.query(toFind[i].getId(), new VersionRange(toFind[i].getVersion(), true, toFind[i].getVersion(), true), null, false, monitor).length > 0) {
+ if (found)
+ result.add(toFind[i]);
+ } else {
+ if (!found)
+ result.add(toFind[i]);
+ }
+ }
+ return (IInstallableUnit[]) result.toArray(new IInstallableUnit[result.size()]);
+ }
+
+ public IStatus uninstall(IInstallableUnit[] uninstallRoots, Profile profile, IProgressMonitor monitor) {
+ SubMonitor sub = SubMonitor.convert(monitor, OperationWork + ExpandWork);
+ sub.setTaskName(Messages.Director_Task_Resolving_Dependencies);
+ try {
+ IInstallableUnit[] toReallyUninstall = inProfile(uninstallRoots, profile, true, sub.newChild(0));
+ if (toReallyUninstall.length == 0) {
+ return new Status(IStatus.OK, DirectorActivator.PI_DIRECTOR, Messages.Director_Nothing_To_Uninstall);
+ } else if (toReallyUninstall.length != uninstallRoots.length) {
+ uninstallRoots = toReallyUninstall;
+ }
+
+ MultiStatus result = new MultiStatus(DirectorActivator.PI_DIRECTOR, 1, Messages.Director_Uninstall_Problems, null);
+
+ IInstallableUnit[] alreadyInstalled = toArray(profile.getInstallableUnits());
+ ResolutionHelper oldStateHelper = new ResolutionHelper(profile.getSelectionContext(), null);
+ Collection oldState = oldStateHelper.attachCUs(Arrays.asList(alreadyInstalled));
+
+ NewDependencyExpander expander = new NewDependencyExpander(uninstallRoots, new IInstallableUnit[0], alreadyInstalled, profile, true);
+ expander.expand(sub.newChild(ExpandWork / 2));
+ Collection toUninstallClosure = new ResolutionHelper(profile.getSelectionContext(), null).attachCUs(expander.getAllInstallableUnits());
+
+ Collection remainingIUs = new HashSet(oldState);
+ remainingIUs.removeAll(toUninstallClosure);
+ NewDependencyExpander finalExpander = new NewDependencyExpander(null, (IInstallableUnit[]) remainingIUs.toArray(new IInstallableUnit[remainingIUs.size()]), gatherAvailableInstallableUnits(uninstallRoots), profile, true);
+ finalExpander.expand(sub.newChild(ExpandWork / 2));
+ ResolutionHelper newStateHelper = new ResolutionHelper(profile.getSelectionContext(), null);
+ Collection newState = newStateHelper.attachCUs(finalExpander.getAllInstallableUnits());
+
+ for (int i = 0; i < uninstallRoots.length; i++) {
+ if (newState.contains(uninstallRoots[i]))
+ result.add(new Status(IStatus.ERROR, DirectorActivator.PI_DIRECTOR, NLS.bind(Messages.Director_Cannot_Uninstall, uninstallRoots[i])));
+ }
+ if (!result.isOK())
+ return result;
+
+ sub.setTaskName(Messages.Director_Task_Uninstalling);
+ IStatus engineResult = engine.perform(profile, new DefaultPhaseSet(), generateOperations(oldState, newState, oldStateHelper.getSorted(), newStateHelper.getSorted()), sub.newChild(OperationWork));
+ if (!engineResult.isOK())
+ result.merge(engineResult);
+
+ return result.isOK() ? Status.OK_STATUS : result;
+ } finally {
+ sub.done();
+ }
+ }
+
+ protected IInstallableUnit[] gatherAvailableInstallableUnits(IInstallableUnit[] additionalSource) {
+ IMetadataRepositoryManager repoMgr = (IMetadataRepositoryManager) ServiceHelper.getService(DirectorActivator.context, IMetadataRepositoryManager.class.getName());
+ IMetadataRepository[] repos = repoMgr.getKnownRepositories();
+ List results = new ArrayList();
+ if (additionalSource != null) {
+ for (int i = 0; i < additionalSource.length; i++) {
+ results.add(additionalSource[i]);
+ }
+ }
+
+ for (int i = 0; i < repos.length; i++) {
+ results.addAll(Arrays.asList(repos[i].getInstallableUnits(null)));
+ }
+ return (IInstallableUnit[]) results.toArray(new IInstallableUnit[results.size()]);
+ }
+
+ public IStatus replace(IInstallableUnit[] toUninstall, IInstallableUnit[] toInstall, Profile profile, IProgressMonitor monitor) {
+ SubMonitor sub = SubMonitor.convert(monitor, OperationWork + ExpandWork);
+ sub.setTaskName(Messages.Director_Task_Resolving_Dependencies);
+ try {
+ MultiStatus result = new MultiStatus(DirectorActivator.PI_DIRECTOR, 1, Messages.Director_Replace_Problems, null);
+
+ //TODO Need to worry about the entry points
+
+ //find the things being updated in the profile
+ IInstallableUnit[] alreadyInstalled = toArray(profile.getInstallableUnits());
+ IInstallableUnit[] uninstallRoots = toUninstall;
+
+ //compute the transitive closure and remove them.
+ ResolutionHelper oldStateHelper = new ResolutionHelper(profile.getSelectionContext(), null);
+ Collection oldState = oldStateHelper.attachCUs(Arrays.asList(alreadyInstalled));
+
+ NewDependencyExpander expander = new NewDependencyExpander(uninstallRoots, new IInstallableUnit[0], alreadyInstalled, profile, true);
+ expander.expand(sub.newChild(ExpandWork / 2));
+ Collection toUninstallClosure = new ResolutionHelper(profile.getSelectionContext(), null).attachCUs(expander.getAllInstallableUnits());
+
+ //add the new set.
+ Collection remainingIUs = new HashSet(oldState);
+ remainingIUs.removeAll(toUninstallClosure);
+ // for (int i = 0; i < updateRoots.length; i++) {
+ // remainingIUs.add(updateRoots[i]);
+ // }
+ NewDependencyExpander finalExpander = new NewDependencyExpander(toInstall, (IInstallableUnit[]) remainingIUs.toArray(new IInstallableUnit[remainingIUs.size()]), gatherAvailableInstallableUnits(null), profile, true);
+ finalExpander.expand(sub.newChild(ExpandWork / 2));
+ ResolutionHelper newStateHelper = new ResolutionHelper(profile.getSelectionContext(), null);
+ Collection newState = newStateHelper.attachCUs(finalExpander.getAllInstallableUnits());
+
+ sub.setTaskName(Messages.Director_Task_Updating);
+ IStatus engineResult = engine.perform(profile, new DefaultPhaseSet(), generateOperations(oldState, newState, oldStateHelper.getSorted(), newStateHelper.getSorted()), sub.newChild(OperationWork));
+ if (!engineResult.isOK())
+ result.merge(engineResult);
+
+ return result.isOK() ? Status.OK_STATUS : result;
+ } finally {
+ sub.done();
+ }
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/prov/director/Oracle.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/prov/director/Oracle.java
new file mode 100644
index 000000000..fa7e6a105
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/prov/director/Oracle.java
@@ -0,0 +1,164 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.director;
+
+import java.util.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.internal.prov.director.DirectorActivator;
+import org.eclipse.equinox.internal.prov.director.Messages;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.*;
+import org.eclipse.equinox.prov.resolution.ResolutionHelper;
+import org.eclipse.osgi.service.resolver.VersionRange;
+
+//TODO The "extends" relationship with the director is a hack to get stuffs working
+public class Oracle extends NewSimpleDirector {
+ public Object canInstall(IInstallableUnit[] toAdd, Profile profile, IProgressMonitor monitor) {
+ MultiStatus result = new MultiStatus(DirectorActivator.PI_DIRECTOR, 1, "oracle", null);
+ SubMonitor sub = SubMonitor.convert(monitor, ExpandWork + OperationWork);
+ try {
+ IInstallableUnit[] alreadyInstalled = toArray(profile.getInstallableUnits());
+ if (alreadyIn(alreadyInstalled, toAdd[0])) {
+ return Boolean.FALSE;
+ }
+ //Compute the complete closure of things to install to successfully install the installRoots.
+ NewDependencyExpander expander = new NewDependencyExpander(toAdd, alreadyInstalled, gatherAvailableInstallableUnits(toAdd), profile, true);
+ IStatus expanderResult = expander.expand(sub);
+ sub.worked(ExpandWork);
+ if (expanderResult.isOK()) {
+ return Boolean.TRUE;
+ }
+ Collection resolved = expander.getAllInstallableUnits();
+ Collection entryPoints = new HashSet();
+ for (Iterator iterator = resolved.iterator(); iterator.hasNext();) {
+ IInstallableUnit iu = (IInstallableUnit) iterator.next();
+ // if ("true".equals(iu.getProperty("entryPoint"))) {
+ entryPoints.add(iu);
+ // }
+ }
+ Collection initialEntryPoints = new HashSet();
+ for (int i = 0; i < alreadyInstalled.length; i++) {
+ // if ("true".equals(alreadyInstalled[i].getProperty("entryPoint"))) {
+ initialEntryPoints.add(alreadyInstalled[i]);
+ // }
+ }
+ initialEntryPoints.removeAll(entryPoints);
+ if (initialEntryPoints.size() != 0) {
+ return initialEntryPoints;
+ }
+ return Boolean.FALSE;
+ } finally {
+ sub.done();
+ }
+ }
+
+ public boolean canInstall(IInstallableUnit[] toAdd, IInstallableUnit[] toUpdate, Profile profile, IProgressMonitor monitor) {
+ IInstallableUnit[] replacements = new IInstallableUnit[toUpdate.length + toAdd.length];
+ for (int i = 0; i < toUpdate.length; i++) {
+ replacements[i] = containsUpdate(toUpdate[i]);
+ //TODO We need to be able to deal with multiple updates and even where is none
+ if (replacements[i] == null)
+ return false;
+ }
+ System.arraycopy(toAdd, 0, replacements, toUpdate.length, toAdd.length);
+
+ MultiStatus result = new MultiStatus(DirectorActivator.PI_DIRECTOR, 1, Messages.Director_Uninstall_Problems, null);
+ SubMonitor sub = SubMonitor.convert(monitor, OperationWork);
+
+ IInstallableUnit[] alreadyInstalled = toArray(profile.getInstallableUnits());
+ Collection oldState = new ResolutionHelper(profile.getSelectionContext(), null).attachCUs(Arrays.asList(alreadyInstalled));
+
+ NewDependencyExpander expander = new NewDependencyExpander(toUpdate, new IInstallableUnit[0], alreadyInstalled, profile, true);
+ expander.expand(sub);
+ Collection toUninstallClosure = new ResolutionHelper(profile.getSelectionContext(), null).attachCUs(expander.getAllInstallableUnits());
+
+ Collection remainingIUs = new HashSet(oldState);
+ remainingIUs.removeAll(toUninstallClosure);
+ NewDependencyExpander finalExpander = new NewDependencyExpander(replacements, (IInstallableUnit[]) remainingIUs.toArray(new IInstallableUnit[remainingIUs.size()]), gatherAvailableInstallableUnits(toAdd), profile, true);
+ finalExpander.expand(sub);
+ Collection newState = new ResolutionHelper(profile.getSelectionContext(), null).attachCUs(finalExpander.getAllInstallableUnits());
+
+ return true;
+ }
+
+ private IInstallableUnit containsUpdate(IInstallableUnit iu) {
+ IInstallableUnit[] candidates = gatherAvailableInstallableUnits(null);
+ for (int i = 0; i < candidates.length; i++) {
+ if (iu.getId().equals(candidates[i].getProperty(IInstallableUnitConstants.UPDATE_FROM))) {
+ if (iu.equals(candidates[i]))
+ continue;
+ VersionRange range = new VersionRange(candidates[i].getProperty(IInstallableUnitConstants.UPDATE_RANGE));
+ if (range.isIncluded(iu.getVersion()) && candidates[i].getVersion().compareTo(iu.getVersion()) > 0)
+ return candidates[i];
+ }
+ }
+ return null;
+ }
+
+ private boolean alreadyIn(IInstallableUnit[] ius, IInstallableUnit id) {
+ for (int i = 0; i < ius.length; i++) {
+ if (ius[i].equals(id))
+ return true;
+ }
+ return false;
+ }
+
+ private IInstallableUnit[] toArray(Iterator it) {
+ ArrayList result = new ArrayList();
+ while (it.hasNext()) {
+ result.add(it.next());
+ }
+ return (IInstallableUnit[]) result.toArray(new IInstallableUnit[result.size()]);
+ }
+
+ public Collection hasUpdate(IInstallableUnit toUpdate) {
+ if (toUpdate.getProperty(IInstallableUnitConstants.ENTRYPOINT_IU_KEY) != null)
+ return entryPointProcessing(toUpdate);
+ IInstallableUnit[] allius = gatherAvailableInstallableUnits(null);
+ Set updates = new HashSet();
+ for (int i = 0; i < allius.length; i++) {
+ if (toUpdate.getId().equals(allius[i].getProperty(IInstallableUnitConstants.UPDATE_FROM))) {
+ if (toUpdate.getVersion().compareTo(allius[i].getVersion()) < 0 && new VersionRange(allius[i].getProperty(IInstallableUnitConstants.UPDATE_RANGE)).isIncluded(toUpdate.getVersion()))
+ updates.add(allius[i]);
+ }
+ }
+ return updates;
+ }
+
+ private Collection entryPointProcessing(IInstallableUnit entryPoint) {
+ ArrayList updates = new ArrayList();
+ RequiredCapability[] entries = entryPoint.getRequiredCapabilities();
+ for (int i = 0; i < entries.length; i++) {
+ if (!IInstallableUnit.IU_NAMESPACE.equals(entries[i].getNamespace()))
+ continue;
+ IInstallableUnit[] allius = gatherAvailableInstallableUnits(null);
+ IInstallableUnit match = null;
+ for (int j = 0; j < allius.length; j++) {
+ if (entries[i].getName().equals(allius[j].getProperty(IInstallableUnitConstants.UPDATE_FROM))) {
+ if (new VersionRange(allius[j].getProperty(IInstallableUnitConstants.UPDATE_RANGE)).isIncluded(entries[i].getRange().getMinimum()) && allius[j].getVersion().compareTo(entries[i].getRange().getMinimum()) > 0) {
+ if (match == null || allius[j].getVersion().compareTo(match.getVersion()) > 0)
+ match = allius[j];
+ }
+ }
+ }
+ if (match != null)
+ updates.add(match);
+ }
+ if (updates.size() == 0)
+ return updates;
+ String entryPointName = entryPoint.getProperty(IInstallableUnitConstants.NAME);
+ if (entryPointName == null)
+ entryPointName = entryPoint.getId();
+ InstallableUnit newEntryPoint = createEntryPoint(entryPointName, (IInstallableUnit[]) updates.toArray(new IInstallableUnit[updates.size()]));
+ newEntryPoint.setProperty(IInstallableUnitConstants.UPDATE_FROM, entryPoint.getId());
+ ArrayList result = new ArrayList();
+ result.add(newEntryPoint);
+ return result;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/prov/director/TrackedHashSet.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/prov/director/TrackedHashSet.java
new file mode 100644
index 000000000..5d48690ca
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/prov/director/TrackedHashSet.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.director;
+
+import java.util.*;
+import org.eclipse.equinox.prov.metadata.*;
+
+public class TrackedHashSet extends LinkedHashSet {
+ RecommendationDescriptor recommendations;
+
+ public TrackedHashSet(int initSize, RecommendationDescriptor recommendations) {
+ super(initSize);
+ this.recommendations = recommendations;
+ }
+
+ public boolean add(Object toAdd) {
+ if (toAdd instanceof InstallableUnit) {
+ filter((IInstallableUnit) toAdd);
+ }
+ return super.add(toAdd);
+ }
+
+ private void filter(IInstallableUnit toAdd) {
+ ProvidedCapability[] capabilities = toAdd.getProvidedCapabilities();
+ for (int i = 0; i < capabilities.length; i++) {
+ if (capabilities[i].isSatisfiedBy(new RequiredCapability(IInstallableUnit.IU_KIND_NAMESPACE, "recommendation", null, null, false, false))) {
+ recommendations.merge(RecommendationDescriptor.parse(toAdd.getTouchpointData()[0].getInstructions("recommendations")));
+ }
+ }
+ }
+
+ public boolean addAll(Collection arg0) {
+ for (Iterator iterator = arg0.iterator(); iterator.hasNext();) {
+ filter((IInstallableUnit) iterator.next());
+ }
+ return super.addAll(arg0);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/prov/director/director.txt b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/prov/director/director.txt
new file mode 100644
index 000000000..5fd09d5d5
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/prov/director/director.txt
@@ -0,0 +1,30 @@
+install
+ --> IU, causes an IU to be added to the targeted profile
+ --> ProfileIU, causes the profile IU to be merged in the profile?
+ --> Entry point, causes the entry point entities to be added as an entry point (no nested entry points)
+
+be
+ Put the system in a state we know. The profile may or not be changed.
+ --> IU, create an empty profile with a new ????
+ --> ProfileIU, replace the given profile with the current profile
+ --> EntryPoint, remove everything, and just installs all these IUs from the Entry point into the proi
+
+uninstall
+ It can only uninstall something that is already in the profile.
+ --> IU, causes the IU to be uninstalled, but leave the system in a consistent state. For example uninstall registry will not cause any IU to be uninstalled
+ --> ProfileIU --> nothing to do
+ --> entry point, like for IU
+
+update
+ You can only update a thing that is already in the profile
+ --> IU, causes the IU to be updated.... who decides what to update it to?
+ --> Profile??? --> nothing to do
+ --> Entry point --> we need to check for an update of the children of the entry point
+
+
+
+
+add
+remove
+become
+update \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.engine/.classpath b/bundles/org.eclipse.equinox.p2.engine/.classpath
new file mode 100644
index 000000000..7cdeb7319
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/CDC-1.1%Foundation-1.1"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.equinox.p2.engine/.project b/bundles/org.eclipse.equinox.p2.engine/.project
new file mode 100644
index 000000000..4ca5cad36
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.equinox.prov.engine</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.equinox.p2.engine/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.engine/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..f8c50cc31
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,334 @@
+#Tue Aug 21 09:11:12 EDT 2007
+eclipse.preferences.version=1
+instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
+org.eclipse.jdt.core.builder.cleanOutputFolder=clean
+org.eclipse.jdt.core.builder.duplicateResourceTask=warning
+org.eclipse.jdt.core.builder.invalidClasspath=abort
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
+org.eclipse.jdt.core.circularClasspath=error
+org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
+org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=error
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=false
+org.eclipse.jdt.core.formatter.comment.format_comments=false
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false
+org.eclipse.jdt.core.formatter.comment.format_line_comments=false
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=800
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.incompatibleJDKLevel=ignore
+org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/bundles/org.eclipse.equinox.p2.engine/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.p2.engine/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 000000000..56bcc3e9b
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,57 @@
+#Sun Sep 23 11:58:07 EDT 2007
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_core
+formatter_settings_version=11
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=;
+org.eclipse.jdt.ui.ondemandthreshold=3
+org.eclipse.jdt.ui.staticondemandthreshold=3
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates/>
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.format_source_code=true
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_variable_declarations_final=true
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=false
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/bundles/org.eclipse.equinox.p2.engine/.settings/org.eclipse.pde.core.prefs b/bundles/org.eclipse.equinox.p2.engine/.settings/org.eclipse.pde.core.prefs
new file mode 100644
index 000000000..7913d20db
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/.settings/org.eclipse.pde.core.prefs
@@ -0,0 +1,4 @@
+
+eclipse.preferences.version=1
+pluginProject.extensions=false
+resolve.requirebundle=false
diff --git a/bundles/org.eclipse.equinox.p2.engine/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.engine/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..7f3d1c98d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/META-INF/MANIFEST.MF
@@ -0,0 +1,28 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Engine Plug-in (Incubation)
+Bundle-SymbolicName: org.eclipse.equinox.prov.engine;singleton:=true
+Bundle-Version: 0.1.0.qualifier
+Export-Package: org.eclipse.equinox.internal.prov.engine;x-internal:=true,
+ org.eclipse.equinox.prov.engine,
+ org.eclipse.equinox.prov.engine.phases,
+ org.eclipse.equinox.prov.installregistry
+Import-Package: com.thoughtworks.xstream,
+ org.eclipse.equinox.prov.artifact.repository,
+ org.eclipse.equinox.prov.core.eventbus,
+ org.eclipse.equinox.prov.core.helpers,
+ org.eclipse.equinox.prov.core.location,
+ org.eclipse.equinox.prov.download,
+ org.eclipse.equinox.prov.metadata,
+ org.eclipse.equinox.prov.query,
+ org.eclipse.osgi.service.datalocation;version="1.0.0",
+ org.eclipse.osgi.service.resolver;version="1.1.0",
+ org.eclipse.osgi.util;version="1.0.0",
+ org.osgi.framework;version="1.3.0",
+ org.osgi.util.tracker;version="1.3.3"
+Bundle-Activator: org.eclipse.equinox.internal.prov.engine.EngineActivator
+Eclipse-LazyStart: true
+Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
+ J2SE-1.4
+Require-Bundle: org.eclipse.equinox.common,
+ org.eclipse.equinox.registry
diff --git a/bundles/org.eclipse.equinox.p2.engine/about.html b/bundles/org.eclipse.equinox.p2.engine/about.html
new file mode 100644
index 000000000..460233046
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 2, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.engine/build.properties b/bundles/org.eclipse.equinox.p2.engine/build.properties
new file mode 100644
index 000000000..8917af773
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/build.properties
@@ -0,0 +1,16 @@
+###############################################################################
+# Copyright (c) 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ about.html
diff --git a/bundles/org.eclipse.equinox.p2.engine/plugin.xml b/bundles/org.eclipse.equinox.p2.engine/plugin.xml
new file mode 100644
index 000000000..990388563
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/plugin.xml
@@ -0,0 +1,13 @@
+<plugin>
+<extension-point
+ id="touchpoints"
+ name="Touchpoints"
+ schema="schema/touchpoints.exsd"/>
+
+ <extension point="org.eclipse.equinox.prov.engine.touchpoints" id="null" name="Null Touchpoint">
+ <touchpoint
+ type="null"
+ class="org.eclipse.equinox.internal.prov.engine.NullTouchpoint"
+ version="1.0.0"/>
+ </extension>
+</plugin>
diff --git a/bundles/org.eclipse.equinox.p2.engine/schema/touchpoints.exsd b/bundles/org.eclipse.equinox.p2.engine/schema/touchpoints.exsd
new file mode 100644
index 000000000..e085a524a
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/schema/touchpoints.exsd
@@ -0,0 +1,158 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.equinox.prov.engine">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.equinox.prov.engine" id="touchpoints" name="Touchpoints"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="touchpoint" minOccurs="0" maxOccurs="1"/>
+ <element ref="data" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="touchpoint">
+ <complexType>
+ <attribute name="type" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.equinox.prov.engine.ITouchpoint"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="version" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="data">
+ <complexType>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="type" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="description" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ &lt;p&gt;
+ &lt;pre&gt;
+ &lt;extension point=&quot;org.eclipse.equinox.prov.engine.installAdaptors&quot; id=&quot;eclipse&quot; name=&quot;Eclipse Install Adaptor&quot;&gt;
+ &lt;installAdaptor
+ type=&quot;eclipse&quot;
+ class=&quot;org.eclipse.equinox.internal.prov.eclipseAdaptor.EclipseInstallAdaptor&quot;
+ version=&quot;1.0.0&quot;/&gt;
+ &lt;/extension&gt;
+ &lt;/pre&gt;
+&lt;/p&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/prov/engine/CommonDef.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/prov/engine/CommonDef.java
new file mode 100644
index 000000000..e24937a7f
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/prov/engine/CommonDef.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.engine;
+
+/*
+ * This interface contains global constant definitions.
+ *
+ * Use this interface to define constants that are likely to be used
+ * widely in different contexts with share a common intended meaning.
+ *
+ */
+public interface CommonDef {
+
+ public static final String EmptyString = ""; //$NON-NLS-1$
+ public static final String SpaceString = " "; //$NON-NLS-1$
+ public static final String Underscore = "_"; //$NON-NLS-1$
+ public static final String Dot = "."; //$NON-NLS-1$
+ public static final String DotDot = ".."; //$NON-NLS-1$
+
+ public static final String EncodedSpaceString = "%20"; //$NON-NLS-1$
+
+ public static final String UncPrefix = "\\\\"; //$NON-NLS-1$
+ public static final char ColonChar = ':';
+
+ /*
+ * Strings used as the type for the native and eclipse touchpoints,
+ * including the type in the touchpoints extension point.
+ */
+ public static final String NativeTouchpoint = "native"; //$NON-NLS-1$
+ public static final String EclipseTouchpoint = "eclipse"; //$NON-NLS-1$
+
+ public static final int MaxPathLength_Win32 = 256;
+ public static final int MaxPathLength_Linux = 1024;
+ //
+ // /*
+ // * Different protocols
+ // */
+ // public interface Protocols {
+ // public static final String File = "file"; //$NON-NLS-1$
+ // public static final String Http = "http"; //$NON-NLS-1$
+ // public static final String Https = "https"; //$NON-NLS-1$
+ // public static final String Ftp = "ftp"; //$NON-NLS-1$
+ // public static final String Socks = "SOCKS"; //$NON-NLS-1$
+ // }
+ //
+ // /*
+ // * File name extensions.
+ // */
+ // public interface Extensions {
+ // public static final String Xml = ".xml"; //$NON-NLS-1$
+ // public static final String Zip = ".zip"; //$NON-NLS-1$
+ // public static final String Jar = ".jar"; //$NON-NLS-1$
+ // public static final String Properties = ".properties"; //$NON-NLS-1$
+ // }
+}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/prov/engine/EngineActivator.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/prov/engine/EngineActivator.java
new file mode 100644
index 000000000..ee0b3eeac
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/prov/engine/EngineActivator.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.engine;
+
+import org.osgi.framework.*;
+import org.osgi.util.tracker.ServiceTracker;
+import org.osgi.util.tracker.ServiceTrackerCustomizer;
+import org.eclipse.equinox.prov.core.eventbus.ProvisioningEventBus;
+import org.eclipse.equinox.prov.engine.Engine;
+
+public class EngineActivator implements BundleActivator, ServiceTrackerCustomizer {
+ private static BundleContext context;
+ public static final String ID = "org.eclipse.equinox.prov.engine";
+
+ public static BundleContext getContext() {
+ return context;
+ }
+
+ private ServiceRegistration registration;
+ private ServiceTracker tracker;
+
+ public void start(BundleContext context) throws Exception {
+ EngineActivator.context = context;
+ tracker = new ServiceTracker(context, ProvisioningEventBus.class.getName(), this);
+ tracker.open();
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ tracker.close();
+ tracker = null;
+
+ EngineActivator.context = null;
+ }
+
+ public Object addingService(ServiceReference reference) {
+ if (registration == null) {
+ ProvisioningEventBus eventBus = (ProvisioningEventBus) context.getService(reference);
+ registration = context.registerService(Engine.class.getName(), new Engine(eventBus), null);
+ return eventBus;
+ }
+ return null;
+ }
+
+ public void modifiedService(ServiceReference reference, Object service) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void removedService(ServiceReference reference, Object service) {
+ if (registration != null) {
+ registration.unregister();
+ registration = null;
+ }
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/prov/engine/Messages.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/prov/engine/Messages.java
new file mode 100644
index 000000000..c1dcd38fe
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/prov/engine/Messages.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.engine;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.equinox.internal.prov.engine.messages"; //$NON-NLS-1$
+
+ static {
+ // initialize resource bundles
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ // Do not instantiate
+ }
+
+ public static String Engine_Error_During_Phase;
+ public static String Engine_Operation_Canceled_By_User;
+ public static String Profile_Not_Named_Self;
+ public static String Profile_Duplicate_Profile_Id;
+ public static String TouchpointManager_Null_Touchpoint_Type_Argument;
+ public static String TouchpointManager_Required_Touchpoint_Not_Found;
+ public static String TouchpointManager_No_Extension_Point;
+ public static String TouchpointManager_Incorrectly_Named_Extension;
+ public static String TouchpointManager_Attribute_Not_Specified;
+ public static String TouchpointManager_Conflicting_Touchpoint_Types;
+ public static String TouchpointManager_Touchpoint_Type_Mismatch;
+ public static String TouchpointManager_Exception_Creating_Touchpoint_Extension;
+ public static String TouchpointManager_Null_Creating_Touchpoint_Extension;
+ public static String Install_Operand_Description;
+ public static String Update_Operand_Description;
+ public static String Uninstall_Operand_Description;
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/prov/engine/NullTouchpoint.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/prov/engine/NullTouchpoint.java
new file mode 100644
index 000000000..2b8795770
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/prov/engine/NullTouchpoint.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.engine;
+
+import org.eclipse.equinox.prov.engine.*;
+import org.eclipse.equinox.prov.metadata.TouchpointType;
+
+/**
+ * A touchpoint that performs no processing.
+ */
+public class NullTouchpoint implements ITouchpoint {
+ public static final ITouchpoint INSTANCE = new NullTouchpoint();
+
+ /**
+ * Public constructor only intended to be called by extension registry.
+ */
+ public NullTouchpoint() {
+ super();
+ }
+
+ public TouchpointType getTouchpointType() {
+ return TouchpointType.NONE;
+ }
+
+ public boolean supports(String phaseId) {
+ if (phaseId.equals("install") || phaseId.equals("uninstall"))
+ return true;
+ return false;
+ }
+
+ public ITouchpointAction[] getActions(String phaseID, Profile profile, Operand operand) {
+ return new ITouchpointAction[] {};
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/prov/engine/TouchpointManager.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/prov/engine/TouchpointManager.java
new file mode 100644
index 000000000..ec2cf09a5
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/prov/engine/TouchpointManager.java
@@ -0,0 +1,223 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.engine;
+
+import java.util.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.prov.core.helpers.LogHelper;
+import org.eclipse.equinox.prov.core.helpers.MultiStatus;
+import org.eclipse.equinox.prov.engine.ITouchpoint;
+import org.eclipse.equinox.prov.metadata.TouchpointType;
+import org.eclipse.osgi.util.NLS;
+
+//TODO This needs to support multiple version of each touchpoint and have a lookup that supports version semantics
+public class TouchpointManager implements IRegistryChangeListener {
+
+ private static TouchpointManager instance;
+
+ public static TouchpointManager getInstance() {
+ if (instance == null) {
+ instance = new TouchpointManager();
+ }
+ return instance;
+ }
+
+ private static final String PT_TOUCHPOINTS = "touchpoints"; //$NON-NLS-1$
+ private static final String ELEMENT_TOUCHPOINT = "touchpoint"; //$NON-NLS-1$
+ private static final String ELEMENT_TOUCHPOINT_DATA = "data"; //$NON-NLS-1$
+ private static final String ATTRIBUTE_CLASS = "class"; //$NON-NLS-1$
+ private static final String ATTRIBUTE_TYPE = "type"; //$NON-NLS-1$
+
+ private class TouchpointEntry {
+
+ private IConfigurationElement element;
+ private boolean createdExtension;
+ private ITouchpoint touchpoint;
+
+ public TouchpointEntry(IConfigurationElement element) {
+ super();
+ this.element = element;
+ this.touchpoint = null;
+ this.createdExtension = false;
+ }
+
+ public TouchpointEntry(IConfigurationElement element, ITouchpoint touchpoint) {
+ super();
+ this.element = element;
+ this.touchpoint = touchpoint;
+ this.createdExtension = (touchpoint != null ? true : false);
+ }
+
+ public boolean hasTouchpoint() {
+ return (this.touchpoint != null);
+ }
+
+ public ITouchpoint getTouchpoint() {
+ if (!createdExtension) {
+ String id = element.getAttribute(ATTRIBUTE_TYPE);
+ try {
+ ITouchpoint touchpoint = (ITouchpoint) element.createExecutableExtension(ATTRIBUTE_CLASS);
+ if (touchpoint != null) {
+ if (!id.equals(touchpoint.getTouchpointType().getId())) {
+ reportError(NLS.bind(Messages.TouchpointManager_Touchpoint_Type_Mismatch, id, touchpoint.getTouchpointType().getId()), null);
+ }
+ this.touchpoint = touchpoint;
+ } else {
+ String errorMsg = NLS.bind(Messages.TouchpointManager_Null_Creating_Touchpoint_Extension, id);
+ throw new CoreException(new Status(IStatus.ERROR, EngineActivator.ID, 1, errorMsg, null));
+ }
+ } catch (CoreException cexcpt) {
+ LogHelper.log(new Status(IStatus.ERROR, EngineActivator.ID, NLS.bind(Messages.TouchpointManager_Exception_Creating_Touchpoint_Extension, id), cexcpt));
+ } catch (ClassCastException ccexcpt) {
+ LogHelper.log(new Status(IStatus.ERROR, EngineActivator.ID, NLS.bind(Messages.TouchpointManager_Exception_Creating_Touchpoint_Extension, id), ccexcpt));
+ }
+ // Mark as created even in error cases,
+ // so exceptions are not logged multiple times
+ createdExtension = true;
+ }
+ return this.touchpoint;
+ }
+
+ public String toString() {
+ StringBuffer result = new StringBuffer(element.toString());
+ if (createdExtension) {
+ String touchpointString = touchpoint != null ? touchpoint.toString() : "not created"; //$NON-NLS-1$
+ result.append(" => " + touchpointString); //$NON-NLS-1$
+ }
+ return result.toString();
+ }
+ }
+
+ // TODO: Do we really want to store the touchpoints? The danger is
+ // that if two installations are performed simultaneously, then...
+ // TODO: Figure out locking, concurrency requirements for touchpoints.
+ private Map touchpointEntries;
+
+ private TouchpointManager() {
+ RegistryFactory.getRegistry().addRegistryChangeListener(this, EngineActivator.ID);
+ }
+
+ /*
+ * Return the touchpoint which is registered for the given id,
+ * or <code>null</code> if none are registered.
+ */
+ public ITouchpoint getTouchpoint(TouchpointType id) {
+ if (id == null || CommonDef.EmptyString.equals(id.getId()))
+ throw new IllegalArgumentException(Messages.TouchpointManager_Null_Touchpoint_Type_Argument);
+ if (touchpointEntries == null) {
+ initializeTouchpoints();
+ }
+ TouchpointEntry entry = (TouchpointEntry) touchpointEntries.get(id.getId());
+ return entry == null ? null : entry.getTouchpoint();
+ }
+
+ public ITouchpoint[] getAllTouchpoints() {
+ if (touchpointEntries == null) {
+ initializeTouchpoints();
+ }
+ Collection adapters = touchpointEntries.values();
+
+ ArrayList touchpoints = new ArrayList(adapters.size());
+ for (Iterator iter = adapters.iterator(); iter.hasNext();) {
+ TouchpointEntry entry = (TouchpointEntry) iter.next();
+ ITouchpoint touchpoint = entry.getTouchpoint();
+ if (touchpoint != null) {
+ touchpoints.add(touchpoint);
+ }
+ }
+ return (ITouchpoint[]) touchpoints.toArray(new ITouchpoint[touchpoints.size()]);
+ }
+
+ public ITouchpoint[] getCreatedTouchpoints() {
+ if (touchpointEntries == null)
+ return new ITouchpoint[0];
+ Collection adapters = touchpointEntries.values();
+
+ ArrayList touchpoints = new ArrayList(adapters.size());
+ for (Iterator iter = adapters.iterator(); iter.hasNext();) {
+ TouchpointEntry entry = (TouchpointEntry) iter.next();
+ if (entry.hasTouchpoint()) {
+ ITouchpoint touchpoint = entry.getTouchpoint();
+ if (touchpoint != null) {
+ touchpoints.add(touchpoint);
+ }
+ }
+ }
+ return (ITouchpoint[]) touchpoints.toArray(new ITouchpoint[touchpoints.size()]);
+ }
+
+ public IStatus validateTouchpoints(String[] requiredTypes) {
+ MultiStatus status = (touchpointEntries == null ? initializeTouchpoints() : new MultiStatus());
+
+ for (int i = 0; i < requiredTypes.length; i++) {
+ TouchpointEntry entry = (TouchpointEntry) touchpointEntries.get(requiredTypes[i]);
+ if (entry == null) {
+ reportError(NLS.bind(Messages.TouchpointManager_Required_Touchpoint_Not_Found, requiredTypes[i]), status);
+ }
+ }
+ return status;
+ }
+
+ /*
+ * Construct a map of the extensions that implement the touchpoints extension point.
+ */
+ private MultiStatus initializeTouchpoints() {
+ MultiStatus status = new MultiStatus();
+ IExtensionPoint point = RegistryFactory.getRegistry().getExtensionPoint(EngineActivator.ID, PT_TOUCHPOINTS);
+ if (point == null) {
+ reportError(NLS.bind(Messages.TouchpointManager_No_Extension_Point, EngineActivator.ID, PT_TOUCHPOINTS), status);
+ touchpointEntries = new HashMap(0);
+ return status;
+ }
+
+ IExtension[] extensions = point.getExtensions();
+ touchpointEntries = new HashMap(extensions.length);
+ for (int i = 0; i < extensions.length; i++) {
+ IConfigurationElement[] elements = extensions[i].getConfigurationElements();
+ for (int j = 0; j < elements.length; j++) {
+ String elementName = elements[j].getName();
+ if (!ELEMENT_TOUCHPOINT.equalsIgnoreCase(elements[j].getName())) {
+ if (!ELEMENT_TOUCHPOINT_DATA.equals(elementName)) { // TODO: are 'data' elements still needed?
+ reportError(NLS.bind(Messages.TouchpointManager_Incorrectly_Named_Extension, elements[j].getName(), ELEMENT_TOUCHPOINT), status);
+ }
+ continue;
+ }
+ String id = elements[j].getAttribute(ATTRIBUTE_TYPE);
+ if (id == null) {
+ reportError(NLS.bind(Messages.TouchpointManager_Attribute_Not_Specified, ATTRIBUTE_TYPE), status);
+ continue;
+ }
+ if (touchpointEntries.get(id) == null) {
+ touchpointEntries.put(id, new TouchpointEntry(elements[j]));
+ } else {
+ reportError(NLS.bind(Messages.TouchpointManager_Conflicting_Touchpoint_Types, ATTRIBUTE_TYPE, id), status);
+ }
+ }
+ }
+ return status;
+ }
+
+ private static void reportError(String errorMsg, MultiStatus status) {
+ Status errorStatus = new Status(IStatus.ERROR, EngineActivator.ID, 1, errorMsg, null);
+ if (status != null) {
+ status.add(errorStatus);
+ }
+ LogHelper.log(errorStatus);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IRegistryChangeListener#registryChanged(org.eclipse.core.runtime.IRegistryChangeEvent)
+ */
+ public void registryChanged(IRegistryChangeEvent event) {
+ // just flush the cache when something changed. It will be recomputed on demand.
+ touchpointEntries = null;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/prov/engine/messages.properties b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/prov/engine/messages.properties
new file mode 100644
index 000000000..9b10bd1cb
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/prov/engine/messages.properties
@@ -0,0 +1,29 @@
+###############################################################################
+# Copyright (c) 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+
+Engine_Error_During_Phase=Error during phase: {0}.
+Engine_Operation_Canceled_By_User=Operation canceled by the user.
+
+Profile_Duplicate_Profile_Id=Adding profile with duplicate id: {0}.
+Profile_Not_Named_Self=Can't have a profile named: {0}.
+TouchpointManager_Null_Touchpoint_Type_Argument=A null or empty string was passed as the type of a touchpoint.
+TouchpointManager_Required_Touchpoint_Not_Found=The required {0} touchpoint is not included in the installation manager configuration.
+TouchpointManager_No_Extension_Point=The extension point {0}.{1} was not found in the platform extension registry.
+TouchpointManager_Incorrectly_Named_Extension=A touchpoint extension is incorrectly named {0} instead of {1}.
+TouchpointManager_Attribute_Not_Specified=The required attribute {0} is not specified for the touchpoints extension point.
+TouchpointManager_Conflicting_Touchpoint_Types=Two or more touchpoint extensions of type {0} are defined.
+TouchpointManager_Touchpoint_Type_Mismatch=The touchpoint registered for type {0} reports its type as {1}.
+TouchpointManager_Exception_Creating_Touchpoint_Extension=An exception was thrown and caught when creating the extension point instance for the {0} touchpoint.
+TouchpointManager_Null_Creating_Touchpoint_Extension=A null object was returned when creating the extension point instance for the {0} touchpoint.
+
+Install_Operand_Description=Installing unit {0}.
+Update_Operand_Description=Updating unit {0} with unit {1}.
+Uninstall_Operand_Description=Removing unit {0}.
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/AbstractProvisioningTransaction.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/AbstractProvisioningTransaction.java
new file mode 100644
index 000000000..2f48238a2
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/AbstractProvisioningTransaction.java
@@ -0,0 +1,135 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.engine;
+
+import java.util.ArrayList;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.internal.prov.engine.EngineActivator;
+import org.eclipse.equinox.prov.core.helpers.MultiStatus;
+import org.eclipse.equinox.prov.core.helpers.MultiStatusUtil;
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * An abstract provisioning transaction specifies a simple mechanism
+ * for atomicity of a sequence of actions, based on the ability to
+ * revert the consequences of those actions.
+ *
+ * TODO: Implementation(s) of transactions should be registered via
+ * an extension point by classes that extended this class.
+ * This class should really be abstract.
+ */
+public abstract class AbstractProvisioningTransaction {
+
+ private ArrayList actions = new ArrayList();
+
+ private String description;
+
+ private boolean isUndoable;
+
+ private MultiStatus result;
+
+ private IProgressMonitor progressMonitor;
+
+ public AbstractProvisioningTransaction(String description, boolean isUndoable, MultiStatus result, IProgressMonitor monitor) {
+ this.description = description;
+ this.isUndoable = isUndoable;
+ this.result = (result != null ? result : new MultiStatus());
+ this.progressMonitor = monitor;
+ }
+
+ public IStatus performActions(IProvisioningAction[] ops, int[] weights, IProgressMonitor monitor) {
+ SubMonitor pm = SubMonitor.convert(monitor, weights.length);
+ IStatus status = Status.OK_STATUS;
+ try {
+ for (int i = 0; i < ops.length; i += 1) {
+ IProvisioningAction action = ops[i];
+ IProgressMonitor sub = (i < weights.length ? (IProgressMonitor) pm.newChild(weights[i]) : new NullProgressMonitor());
+ status = performAction(action, sub);
+ if (MultiStatusUtil.isErrorOrCancel(status)) {
+ break;
+ }
+ }
+ } finally {
+ pm.done();
+ }
+ return status;
+ }
+
+ protected IStatus performAction(IProvisioningAction action, IProgressMonitor monitor) {
+ actions.add(action);
+ IStatus opStatus = action.perform(this, monitor);
+ IStatus status = opStatus;
+
+ if (!isUndoable) {
+ result.add(opStatus);
+ status = Status.OK_STATUS;
+ } else if (MultiStatusUtil.isErrorOrCancel(opStatus)) {
+ int length = actions.size();
+ IProvisioningAction lastAction = (IProvisioningAction) actions.get(length - 1);
+ if (!lastAction.shouldRevertOnError()) {
+ actions.remove(length - 1);
+ }
+ } else if (monitor.isCanceled()) {
+ // first time we noticed cancellation
+ opStatus = new Status(IStatus.CANCEL, EngineActivator.ID, 0, ""/*Messages.Engine_Operation_Canceled_By_User*/, null);
+ }
+
+ if (opStatus.matches(IStatus.ERROR) && result.getMessage().length() == 0) {
+ result.setMessage(NLS.bind("Errors occurred during the transaction {0}", //$NON-NLS-1$
+ description));
+ } else if (opStatus.matches(IStatus.CANCEL) && result.getMessage().length() == 0) {
+ result.setMessage(NLS.bind("The transaction {0} was canceled", //$NON-NLS-1$
+ description));
+ }
+
+ monitor.done();
+ return status;
+ }
+
+ public void rollback(IProgressMonitor monitor) {
+ if (!isUndoable)
+ return;
+ isUndoable = false;
+
+ // TODO: is it necessary to allow support rollback that does NOT reverse the order
+ // of the actions? Consider phases.
+
+ SubMonitor pm = SubMonitor.convert(monitor, actions.size());
+ for (int i = actions.size() - 1; i >= 0; i--) {
+ IProvisioningAction action = (IProvisioningAction) actions.get(i);
+ try {
+ IStatus status = action.revert(this, pm.newChild(10));
+ // log.statusNotOK(status);
+ } catch (Exception e) {
+ // log.exception
+ }
+ }
+ }
+
+ public IProgressMonitor getProgressMonitor() {
+ return progressMonitor;
+ }
+
+ public boolean isUndoable() {
+ return isUndoable;
+ }
+
+ public String toString() {
+ StringBuffer sb = new StringBuffer();
+ sb.append("Transaction: "); //$NON-NLS-1$
+ sb.append(description);
+ sb.append(", ").append(actions.size()).append( //$NON-NLS-1$
+ " actions performed"); //$NON-NLS-1$
+ if (!isUndoable) {
+ sb.append(", isUndoable=").append(isUndoable); //$NON-NLS-1$
+ }
+ return sb.toString();
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/BeginOperationEvent.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/BeginOperationEvent.java
new file mode 100644
index 000000000..9acffd2cf
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/BeginOperationEvent.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.engine;
+
+public class BeginOperationEvent extends TransactionEvent {
+
+ private static final long serialVersionUID = 6389318375739324865L;
+
+ public BeginOperationEvent(Profile profile, PhaseSet phaseSet, Operand[] deltas, Engine engine) {
+ super(profile, phaseSet, deltas, engine);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/CommitOperationEvent.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/CommitOperationEvent.java
new file mode 100644
index 000000000..e3bdd998a
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/CommitOperationEvent.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.engine;
+
+public class CommitOperationEvent extends TransactionEvent {
+ private static final long serialVersionUID = -523967775426133720L;
+
+ public CommitOperationEvent(Profile profile, PhaseSet phaseSet, Operand[] deltas, Engine engine) {
+ super(profile, phaseSet, deltas, engine);
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/DefaultPhaseSet.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/DefaultPhaseSet.java
new file mode 100644
index 000000000..ec52bb252
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/DefaultPhaseSet.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.engine;
+
+import org.eclipse.equinox.prov.engine.phases.*;
+
+public class DefaultPhaseSet extends PhaseSet {
+
+ public DefaultPhaseSet() {
+ super(new Phase[] {new Collect(10), new Uninstall(10), new Install(10)});
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/Engine.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/Engine.java
new file mode 100644
index 000000000..4a81eb640
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/Engine.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.engine;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.prov.core.eventbus.ProvisioningEventBus;
+import org.eclipse.equinox.prov.core.helpers.MultiStatus;
+
+public class Engine {
+
+ private final ProvisioningEventBus eventBus;
+ private List lockedProfiles = new ArrayList();
+
+ public Engine(ProvisioningEventBus eventBus) {
+ this.eventBus = eventBus;
+ }
+
+ public MultiStatus perform(Profile profile, PhaseSet phaseSet, Operand[] operands, IProgressMonitor monitor) {
+
+ // TODO -- Messages
+ if (profile == null)
+ throw new IllegalArgumentException("Profile must not be null.");
+
+ if (phaseSet == null)
+ throw new IllegalArgumentException("PhaseSet must not be null.");
+
+ if (operands == null)
+ throw new IllegalArgumentException("Operands must not be null.");
+
+ if (monitor == null)
+ monitor = new NullProgressMonitor();
+
+ if (operands.length == 0)
+ return new MultiStatus(IStatus.OK, null);
+
+ lockProfile(profile);
+ try {
+ eventBus.publishEvent(new BeginOperationEvent(profile, phaseSet, operands, this));
+
+ EngineSession session = new EngineSession();
+ MultiStatus result = phaseSet.perform(session, profile, operands, monitor);
+ if (result.isOK()) {
+ eventBus.publishEvent(new CommitOperationEvent(profile, phaseSet, operands, this));
+ session.commit();
+ }
+
+ if (result.isErrorOrCancel()) {
+ eventBus.publishEvent(new RollbackOperationEvent(profile, phaseSet, operands, this, result));
+ session.rollback();
+ }
+ return result;
+ } finally {
+ unlockProfile(profile);
+ }
+ }
+
+ private synchronized void unlockProfile(Profile profile) {
+ lockedProfiles.remove(profile);
+ notify();
+ }
+
+ private synchronized void lockProfile(Profile profile) {
+ while (lockedProfiles.contains(profile)) {
+ try {
+ wait();
+ } catch (InterruptedException e) {
+ // TODO We should think about how we want to handle blocked engine requests
+ Thread.currentThread().interrupt();
+ }
+ }
+ lockedProfiles.add(profile);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/EngineSession.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/EngineSession.java
new file mode 100644
index 000000000..893e40ec0
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/EngineSession.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.engine;
+
+import java.util.*;
+
+public class EngineSession {
+ List actions = new ArrayList();
+
+ public void record(ITouchpointAction action) {
+ actions.add(action);
+ }
+
+ public void commit() {
+ actions.clear();
+ }
+
+ public void rollback() {
+ for (ListIterator it = actions.listIterator(actions.size()); it.hasPrevious();) {
+ ITouchpointAction action = (ITouchpointAction) it.previous();
+ action.undo();
+ }
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/IProfileRegistry.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/IProfileRegistry.java
new file mode 100644
index 000000000..504ae8651
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/IProfileRegistry.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.engine;
+
+/**
+ * This encapsulates the access to the profile registry.
+ * It deals with persistence in a transparent way.
+ */
+public interface IProfileRegistry {
+ public static final String SELF = "_SELF_"; //$NON-NLS-1$
+
+ /**
+ * Return the profile in the registry that has the given id. If it does not exist,
+ * then return <code>null</code>.
+ *
+ * @param id the profile identifier
+ * @return the profile or <code>null</code>
+ */
+ Profile getProfile(String id);
+
+ /**
+ * Return an array of profiles known to this registry. If there are none, then
+ * return an empty array.
+ *
+ * @return the array of profiles
+ */
+ Profile[] getProfiles();
+
+ /**
+ * Add the given profile to this profile registry.
+ *
+ * @param toAdd the profile to add
+ * @throws IllegalArgumentException if a profile
+ * with the same id is already present in the registry.
+ */
+ void addProfile(Profile toAdd) throws IllegalArgumentException;
+
+ /**
+ * Remove the given profile from this profile registry.
+ *
+ * @param toRemove the profile to remove
+ */
+ void removeProfile(Profile toRemove);
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/IProvisioningAction.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/IProvisioningAction.java
new file mode 100644
index 000000000..7b976aa69
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/IProvisioningAction.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.equinox.prov.engine;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+
+/**
+ * The provisioning action interface represents a unit of work
+ * that can be performed during a provisioning activity.
+ * The granularity of the action can vary from a simple,
+ * indivisible unit of work to a complex, organized collection
+ * of steps.
+ * <p>
+ * The results of an provisioning activity must be revert-able
+ * an error or if a cancellation occurs. A provisioning action
+ * that will return an error or cancel status may choose to revert
+ * any work performed before returning or may indicate that
+ * the caller must explicitly revert.
+ */
+public interface IProvisioningAction {
+
+ public IStatus perform(AbstractProvisioningTransaction transaction, IProgressMonitor monitor);
+
+ public IStatus revert(AbstractProvisioningTransaction transaction, IProgressMonitor monitor);
+
+ public boolean shouldRevertOnError();
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/ITouchpoint.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/ITouchpoint.java
new file mode 100644
index 000000000..838d2a3de
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/ITouchpoint.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.engine;
+
+import org.eclipse.equinox.prov.metadata.TouchpointType;
+
+/**
+ * A touchpoint is responsible for executing a given phase for a given
+ * targeted system (eclipse, native). The order of phases is defined in the {@link PhaseSet}.
+ */
+public interface ITouchpoint {
+
+ public TouchpointType getTouchpointType();
+
+ public boolean supports(String phaseId);
+
+ public ITouchpointAction[] getActions(String phaseId, Profile profile, Operand operand);
+}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/ITouchpointAction.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/ITouchpointAction.java
new file mode 100644
index 000000000..c7a9a78e7
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/ITouchpointAction.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.engine;
+
+public interface ITouchpointAction {
+
+ Object execute();
+
+ Object undo();
+}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/IUPhase.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/IUPhase.java
new file mode 100644
index 000000000..4ac09ee3c
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/IUPhase.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.engine;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.prov.core.helpers.MultiStatus;
+
+// An operation that is applied to a set of IUs.
+public abstract class IUPhase extends Phase {
+ protected int PRE_PERFORM_WORK = 1000;
+ protected int PERFORM_WORK = 10000;
+ protected int POST_PERFORM_WORK = 1000;
+
+ protected IUPhase(String phaseId, int weight, String phaseName) {
+ super(phaseId, weight, phaseName);
+ }
+
+ protected void perform(MultiStatus status, EngineSession session, Profile profile, Operand[] operands, IProgressMonitor monitor) { //TODO Maybe should we do some kind of adaptable
+ SubMonitor subMonitor = SubMonitor.convert(monitor, PRE_PERFORM_WORK + PERFORM_WORK + POST_PERFORM_WORK);
+ prePerform(status, profile, operands, subMonitor.newChild(PRE_PERFORM_WORK));
+ if (status.isErrorOrCancel())
+ return;
+
+ subMonitor.setWorkRemaining(PERFORM_WORK + POST_PERFORM_WORK);
+ mainPerform(status, session, profile, operands, subMonitor.newChild(PERFORM_WORK));
+ if (status.isErrorOrCancel())
+ return;
+
+ subMonitor.setWorkRemaining(POST_PERFORM_WORK);
+ postPerform(status, profile, operands, subMonitor.newChild(POST_PERFORM_WORK));
+ if (status.isErrorOrCancel())
+ return;
+
+ subMonitor.done();
+ }
+
+ protected void mainPerform(MultiStatus status, EngineSession session, Profile profile, Operand[] operands, SubMonitor subMonitor) {
+ int operandWork = PERFORM_WORK / operands.length;
+ for (int i = 0; i < operands.length; ++i) {
+ if (subMonitor.isCanceled())
+ throw new OperationCanceledException();
+ Operand currentOperand = operands[i];
+ if (!isApplicable(currentOperand))
+ continue;
+ IStatus result = performOperand(session, profile, currentOperand, subMonitor.newChild(operandWork));
+ status.add(result);
+ if (status.isErrorOrCancel())
+ return;
+ }
+ }
+
+ protected abstract boolean isApplicable(Operand op);
+
+ // ITouchpoint touchpoint = TouchpointManager.getInstance().getTouchpoint(currentOperand.getTouchpointType());
+ // if (touchpoint == null) { //TODO Should we throw an exception instead?
+ // status.add(new Status(IStatus.ERROR, "org.eclipse.equinox.prov.engine", "The touchpoint " + currentOperand.getTouchpointType() + " is not available."));
+ // return;
+ // }
+ // if (touchpoint.supports(phaseId)) {
+ // status.add(performIU(touchpoint, currentOperand, subMonitor.newChild(operandWork)));
+ // }
+ // if (status.isErrorOrCancel() || sub.isCanceled()) {
+ // undoPerform(status, ius, i, context);
+ // return;
+ // }
+
+ // Error or cancel: undo IUs that were done.
+ // private void undoPerform(MultiStatus status, InstallableUnitPair[] ius, int currentIU, InstallContext context) {
+ // if (!status.isErrorOrCancel()) {
+ // status.setCanceled(); // first time we noticed cancelation
+ // currentIU += 1; // currentIU was completed so it must be undone
+ // }
+ // InstallableUnitPair[] undoIUs = new InstallableUnitPair[currentIU];
+ // for (int i = 0; i < currentIU; i += 1) {
+ // log.debug("Undo {0} phase for {1}", super.phaseName, ius[i]); //$NON-NLS-1$
+ // undoIUs[i] = ius[currentIU - (i + 1)].reverse();
+ // }
+ // // 1 unit to undo this phase, 10 for preceding phases
+ // SplitProgressMonitor pm = new SplitProgressMonitor(getUndoProgressMonitor(), new int[] {1, 10});
+ // doPerform(status, /*undoable*/false, undoIUs, context, pm.next());
+ // setUndoProgressMonitor(pm.next());
+ // }
+ protected abstract IStatus performOperand(EngineSession session, Profile profile, Operand operand, IProgressMonitor monitor);
+
+ protected void prePerform(MultiStatus status, Profile profile, Operand[] deltas, IProgressMonitor monitor) {
+ //Nothing to do.
+ }
+
+ protected void postPerform(MultiStatus status, Profile profile, Operand[] deltas, IProgressMonitor monitor) {
+ //Nothing to do.
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/InstallableUnitEvent.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/InstallableUnitEvent.java
new file mode 100644
index 000000000..6ba45dc09
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/InstallableUnitEvent.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.engine;
+
+import java.util.EventObject;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+
+public class InstallableUnitEvent extends EventObject {
+ private static final long serialVersionUID = 3318712818811459886L;
+
+ private String phaseId;
+ private boolean prePhase;
+
+ private Profile profile;
+ private Operand operand;
+ private ITouchpoint touchpoint;
+ private IStatus result;
+
+ public InstallableUnitEvent(String phaseId, boolean prePhase, Profile profile, Operand operand, ITouchpoint touchpoint) {
+ this(phaseId, prePhase, profile, operand, touchpoint, null);
+ }
+
+ public InstallableUnitEvent(String phaseId, boolean prePhase, Profile profile, Operand operand, ITouchpoint touchpoint, IStatus result) {
+ super(touchpoint); //TODO not sure if the touchpoint should be the source
+ this.phaseId = phaseId;
+ this.prePhase = prePhase;
+ this.profile = profile;
+ this.operand = operand;
+ this.result = result;
+ }
+
+ public ITouchpoint getTouchpoint() {
+ return touchpoint;
+ }
+
+ public Profile getProfile() {
+ return profile;
+ }
+
+ public Operand getOperand() {
+ return operand;
+ }
+
+ public String getPhase() {
+ return phaseId;
+ }
+
+ public boolean isPre() {
+ return prePhase;
+ }
+
+ public boolean isPost() {
+ return !prePhase;
+ }
+
+ public IStatus getResult() {
+ return (result != null ? result : Status.OK_STATUS);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/Operand.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/Operand.java
new file mode 100644
index 000000000..5a4ac821e
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/Operand.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.engine;
+
+import org.eclipse.equinox.prov.metadata.IResolvedInstallableUnit;
+
+public class Operand {
+ private final IResolvedInstallableUnit first;
+ private final IResolvedInstallableUnit second;
+
+ public Operand(IResolvedInstallableUnit first, IResolvedInstallableUnit second) {
+ this.first = first;
+ this.second = second;
+ }
+
+ public IResolvedInstallableUnit first() {
+ return first;
+ }
+
+ public IResolvedInstallableUnit second() {
+ return second;
+ }
+
+ public String toString() {
+ return first + " --> " + second; //$NON-NLS-1$
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/Phase.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/Phase.java
new file mode 100644
index 000000000..19729096f
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/Phase.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.engine;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.equinox.internal.prov.engine.Messages;
+import org.eclipse.equinox.prov.core.helpers.MultiStatus;
+import org.eclipse.osgi.util.NLS;
+
+public abstract class Phase {
+ protected final String phaseId;
+ protected final int weight;
+ protected final String phaseName;
+
+ protected Phase(String phaseId, int weight, String phaseName) {
+ if (phaseId == null || phaseId.length() == 0) {
+ throw new IllegalArgumentException("Phase id must be set.");
+ }
+
+ if (weight <= 0) {
+ throw new IllegalArgumentException("Phase weight must be positive.");
+ }
+
+ if (phaseName == null || phaseName.length() == 0) {
+ throw new IllegalArgumentException("Phase name must be set.");
+ }
+
+ this.weight = weight;
+ this.phaseName = phaseName;
+ this.phaseId = phaseId;
+ }
+
+ public String toString() {
+ return "Phase: " + this.phaseName + " - " + this.weight; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ protected MultiStatus perform(EngineSession session, Profile profile, Operand[] deltas, IProgressMonitor monitor) {
+ MultiStatus status = new MultiStatus();
+ // log.start(log.info(Messages2.Engine_Performing_Phase, this.phaseName));
+ perform(status, session, profile, deltas, monitor);
+ // log.stop();
+ if (status.matches(IStatus.CANCEL)) {
+ status.setMessage(Messages.Engine_Operation_Canceled_By_User);
+ } else if (status.matches(IStatus.ERROR)) {
+ status.setMessage(NLS.bind(Messages.Engine_Error_During_Phase, this.phaseName));
+ }
+ return status;
+ }
+
+ protected abstract void perform(MultiStatus status, EngineSession session, Profile profile, Operand[] deltas, IProgressMonitor monitor);
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/PhaseSet.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/PhaseSet.java
new file mode 100644
index 000000000..f5d85a2b4
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/PhaseSet.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.engine;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.equinox.prov.core.helpers.MultiStatus;
+
+public abstract class PhaseSet {
+ private final Phase[] phases;
+
+ public PhaseSet(Phase[] phases) {
+ if (phases == null)
+ throw new IllegalArgumentException("Phases must not be null");
+
+ this.phases = phases;
+ }
+
+ public MultiStatus perform(EngineSession session, Profile profile, Operand[] deltas, IProgressMonitor monitor) {
+ MultiStatus result = new MultiStatus();
+ int[] weights = getProgressWeights();
+ int totalWork = getTotalWork(weights);
+ SubMonitor pm = SubMonitor.convert(monitor, totalWork);
+ try {
+ for (int i = 0; i < phases.length; i++) {
+ if (pm.isCanceled()) {
+ result.setCanceled();
+ return result;
+ }
+ Phase phase = phases[i];
+ result.add(phase.perform(session, profile, deltas, pm.newChild(weights[i])));
+ if (result.isErrorOrCancel())// || sub.isCanceled()) {
+ //TODO Need to perform the undo if we don't we use transactions
+ return result;
+ }
+ } finally {
+ pm.done();
+ }
+ return result;
+ }
+
+ private int getTotalWork(int[] weights) {
+ int sum = 0;
+ for (int i = 0; i < weights.length; i++)
+ sum += weights[i];
+ return sum;
+ }
+
+ private int[] getProgressWeights() {
+ int[] weights = new int[phases.length];
+ for (int i = 0; i < phases.length; i += 1) {
+ weights[i] = phases[i].weight;
+ }
+ return weights;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/Profile.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/Profile.java
new file mode 100644
index 000000000..1894f375d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/Profile.java
@@ -0,0 +1,142 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.engine;
+
+import java.util.*;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.equinox.internal.prov.engine.EngineActivator;
+import org.eclipse.equinox.prov.core.helpers.ServiceHelper;
+import org.eclipse.equinox.prov.installregistry.IInstallRegistry;
+import org.eclipse.equinox.prov.installregistry.IProfileInstallRegistry;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.metadata.RequiredCapability;
+import org.eclipse.equinox.prov.query.IQueryable;
+import org.eclipse.equinox.prov.query.QueryableArray;
+import org.eclipse.osgi.service.resolver.VersionRange;
+
+public class Profile implements IQueryable {
+
+ /**
+ * Profile property constant indicating the flavor for the profile.
+ */
+ public static String PROP_FLAVOR = "eclipse.prov.flavor"; //$NON-NLS-1$
+
+ /**
+ * Profile property constant indicating the install folder for the profile.
+ */
+ public static final String PROP_INSTALL_FOLDER = "eclipse.prov.installFolder"; //$NON-NLS-1$
+
+ /**
+ * Profile property constant indicating the installed language(s) for the profile.
+ */
+ public static final String PROP_NL = "eclipse.prov.nl"; //$NON-NLS-1$
+
+ /**
+ * Profile property constant for a string property indicating a user visible short
+ * textual description of this profile. May be empty or <code>null</code>, and
+ * generally will be for non-top level install contexts.
+ */
+ public static final String PROP_DESCRIPTION = "eclipse.prov.description"; //$NON-NLS-1$
+
+ /**
+ * Profile property constant for a string property indicating a user visible name of this profile.
+ * May be empty or <code>null</code>, and generally will be for non-top level
+ * install contexts.
+ */
+ public static final String PROP_NAME = "eclipse.prov.name"; //$NON-NLS-1$
+
+ /**
+ * Profile property constant indicating the list of environments
+ * (e.g., OS, WS, ...) in which a profile can operate. The value of the property
+ * is a comma-delimited string of key/value pairs.
+ */
+ public static final String PROP_ENVIRONMENTS = "eclipse.prov.environments"; //$NON-NLS-1$
+
+ /**
+ * Profile property constant for a boolean property indicating if the profiling
+ * is roaming. A roaming profile is one whose physical install location varies
+ * and is updated whenever it runs.
+ */
+ public static final String PROP_ROAMING = "eclipse.prov.roaming"; //$NON-NLS-1$
+
+ /**
+ * Profile property constant indicating the bundle pool cache location.
+ */
+ public static final String PROP_CACHE = "eclipse.prov.cache"; //$NON-NLS-1$
+
+ //Internal id of the profile
+ private String profileId;
+
+ private Profile parentProfile;
+
+ /**
+ * This storage is to be used by the touchpoints to store data. The data must be serializable
+ */
+ private Properties storage = new Properties();
+
+ public Profile(String profileId) {
+ if (profileId == null || profileId.length() == 0) {
+ throw new IllegalArgumentException("Profile id must be set.");
+ }
+ this.profileId = profileId;
+ }
+
+ public String getProfileId() {
+ return profileId;
+ }
+
+ public Profile getParentProfile() {
+ return parentProfile;
+ }
+
+ public String getValue(String key) {
+ return storage.getProperty(key);
+ }
+
+ public void setValue(String key, String value) {
+ storage.setProperty(key, value);
+ }
+
+ public Dictionary getSelectionContext() {
+ Properties result = new Properties(storage);
+ String environments = storage.getProperty(PROP_ENVIRONMENTS);
+ if (environments == null)
+ return result;
+ for (StringTokenizer tokenizer = new StringTokenizer(environments, ","); tokenizer.hasMoreElements();) {
+ String entry = tokenizer.nextToken();
+ int i = entry.indexOf('=');
+ String key = entry.substring(0, i).trim();
+ String value = entry.substring(i + 1).trim();
+ result.put(key, value);
+ }
+ return result;
+ }
+
+ private IInstallableUnit[] getAllInstallableUnits() {
+ IInstallRegistry registry = (IInstallRegistry) ServiceHelper.getService(EngineActivator.getContext(), IInstallRegistry.class.getName());
+ if (registry == null)
+ return null;
+ IProfileInstallRegistry profile = registry.getProfileInstallRegistry(new Profile(profileId));
+ if (profile == null)
+ return null;
+ return profile.getInstallableUnits();
+ }
+
+ public Iterator getIterator(String id, VersionRange range, RequiredCapability[] requirements, boolean and) {
+ return new QueryableArray(getAllInstallableUnits()).getIterator(id, range, requirements, and);
+ }
+
+ public IInstallableUnit[] query(String id, VersionRange range, RequiredCapability[] requirements, boolean and, IProgressMonitor progress) {
+ return new QueryableArray(getAllInstallableUnits()).query(id, range, requirements, and, progress);
+ }
+
+ public Iterator getInstallableUnits() {
+ return Arrays.asList(getAllInstallableUnits()).iterator();
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/ProfileEvent.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/ProfileEvent.java
new file mode 100644
index 000000000..cbb120e67
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/ProfileEvent.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.engine;
+
+import java.util.EventObject;
+
+public class ProfileEvent extends EventObject {
+ private static final long serialVersionUID = 3082402920617281765L;
+
+ public static byte ADDED = 0;
+ public static byte REMOVED = 1;
+
+ private byte reason;
+
+ public ProfileEvent(Profile source, byte reason) {
+ super(source);
+ this.reason = reason;
+ }
+
+ public byte getReason() {
+ return reason;
+ }
+
+ public Profile getProfile() {
+ return (Profile) getSource();
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/ProvisioningConfigurationException.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/ProvisioningConfigurationException.java
new file mode 100644
index 000000000..4c2496080
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/ProvisioningConfigurationException.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.engine;
+
+public class ProvisioningConfigurationException extends RuntimeException {
+
+ private static final long serialVersionUID = -712627437440533809L;
+
+ public ProvisioningConfigurationException(String name) {
+ super(name);
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/RollbackOperationEvent.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/RollbackOperationEvent.java
new file mode 100644
index 000000000..9de0d51c1
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/RollbackOperationEvent.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.engine;
+
+import org.eclipse.core.runtime.IStatus;
+
+public class RollbackOperationEvent extends TransactionEvent {
+
+ private static final long serialVersionUID = -2076492953949691215L;
+ private IStatus cause;
+
+ public RollbackOperationEvent(Profile profile, PhaseSet phaseSet, Operand[] deltas, Engine engine, IStatus cause) {
+ super(profile, phaseSet, deltas, engine);
+ this.cause = cause;
+ }
+
+ public IStatus getStatus() {
+ return cause;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/SimpleProfileRegistry.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/SimpleProfileRegistry.java
new file mode 100644
index 000000000..ae4c4c622
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/SimpleProfileRegistry.java
@@ -0,0 +1,184 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.engine;
+
+import com.thoughtworks.xstream.XStream;
+import java.io.*;
+import java.net.URL;
+import java.util.LinkedHashMap;
+import java.util.Properties;
+import org.eclipse.equinox.internal.prov.engine.EngineActivator;
+import org.eclipse.equinox.internal.prov.engine.Messages;
+import org.eclipse.equinox.prov.core.eventbus.ProvisioningEventBus;
+import org.eclipse.equinox.prov.core.helpers.ServiceHelper;
+import org.eclipse.equinox.prov.core.location.AgentLocation;
+import org.eclipse.osgi.service.datalocation.Location;
+import org.eclipse.osgi.util.NLS;
+
+public class SimpleProfileRegistry implements IProfileRegistry {
+ private static String STORAGE = "profileRegistry.xml"; //$NON-NLS-1$
+
+ /**
+ * Map of String(Profile id)->Profile.
+ */
+ private LinkedHashMap profiles = new LinkedHashMap(8);
+
+ private Properties properties = new Properties();
+
+ private String self;
+
+ public SimpleProfileRegistry() {
+ self = EngineActivator.getContext().getProperty("eclipse.prov.profile"); //$NON-NLS-1$
+ restore();
+ updateRoamingProfile();
+ }
+
+ /**
+ * If the current profile for self is marked as a roaming profile, we need
+ * to update its install and bundle pool locations.
+ */
+ private void updateRoamingProfile() {
+ Profile selfProfile = getProfile(SELF);
+ if (selfProfile == null)
+ return;
+ //only update if self is a roaming profile
+ if (!Boolean.valueOf(selfProfile.getValue(Profile.PROP_ROAMING)).booleanValue())
+ return;
+ Location installLocation = (Location) ServiceHelper.getService(EngineActivator.getContext(), Location.class.getName(), Location.INSTALL_FILTER);
+ String locationString = installLocation.getURL().getPath();
+ boolean changed = false;
+ if (!locationString.equals(selfProfile.getValue(Profile.PROP_INSTALL_FOLDER))) {
+ selfProfile.setValue(Profile.PROP_INSTALL_FOLDER, locationString);
+ changed = true;
+ }
+ if (!locationString.equals(selfProfile.getValue(Profile.PROP_CACHE))) {
+ selfProfile.setValue(Profile.PROP_CACHE, locationString);
+ changed = true;
+ }
+ if (changed)
+ persist();
+ }
+
+ public String toString() {
+ return this.profiles.toString();
+ }
+
+ public Profile getProfile(String id) {
+ if (SELF.equals(id))
+ id = self;
+ return (Profile) profiles.get(id);
+ }
+
+ public Profile[] getProfiles() {
+ return (Profile[]) profiles.values().toArray(new Profile[profiles.size()]);
+ }
+
+ public void addProfile(Profile toAdd) throws IllegalArgumentException {
+ if (isNamedSelf(toAdd))
+ throw new IllegalArgumentException(NLS.bind(Messages.Profile_Not_Named_Self, toAdd.getProfileId()));
+ String id = toAdd.getProfileId();
+ if (getProfile(id) == null) {
+ profiles.put(id, toAdd);
+ } else
+ throw new IllegalArgumentException(NLS.bind(Messages.Profile_Duplicate_Profile_Id, id));
+ broadcastChangeEvent(toAdd, ProfileEvent.ADDED);
+ persist(); //TODO This is not enough to keep track of the changes that are being done in a profile. This will likely have to be based on some event like commit
+ }
+
+ private void broadcastChangeEvent(Profile profile, byte reason) {
+ ((ProvisioningEventBus) ServiceHelper.getService(EngineActivator.getContext(), ProvisioningEventBus.class.getName())).publishEvent(new ProfileEvent(profile, reason));
+ }
+
+ private void restore() {
+ try {
+ BufferedInputStream bif = null;
+ try {
+ Location agent = (Location) ServiceHelper.getService(EngineActivator.getContext(), AgentLocation.class.getName());
+ if (agent == null)
+ // TODO should likely do something here since we failed to restore.
+ return;
+ bif = new BufferedInputStream(new URL(agent.getURL(), STORAGE).openStream());
+ XStream xml = new XStream();
+ Object[] read = (Object[]) xml.fromXML(bif);
+ properties = (Properties) read[0];
+ profiles = (LinkedHashMap) read[1];
+ } finally {
+ if (bif != null)
+ bif.close();
+ }
+ } catch (FileNotFoundException e) {
+ //This is ok.
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ private void persist() {
+ OutputStream os;
+ try {
+ Location agent = (Location) ServiceHelper.getService(EngineActivator.getContext(), AgentLocation.class.getName());
+ if (agent == null)
+ // TODO should likely do something here since we failed to persist.
+ return;
+ if (!agent.getURL().getProtocol().equals("file"))
+ throw new IOException("can't write at the given location");
+
+ File outputFile = new File(agent.getURL().getFile(), STORAGE);
+ if (!outputFile.getParentFile().exists() && !outputFile.getParentFile().mkdirs())
+ throw new RuntimeException("can't persist profile registry at: " + outputFile);
+ os = new BufferedOutputStream(new FileOutputStream(outputFile));
+ try {
+ XStream xstream = new XStream();
+ xstream.toXML(new Object[] {properties, profiles}, os);
+ } finally {
+ os.close();
+ }
+ } catch (FileNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ public void removeProfile(Profile toRemove) {
+ if (isNamedSelf(toRemove))
+ throw new IllegalArgumentException(NLS.bind(Messages.Profile_Not_Named_Self, toRemove.getProfileId()));
+ if (profiles.remove(toRemove.getProfileId()) == null)
+ return;
+ broadcastChangeEvent(toRemove, ProfileEvent.REMOVED);
+ persist();
+ }
+
+ private boolean isNamedSelf(Profile p) {
+ if (SELF.equals(p.getParentProfile()))
+ return true;
+ return false;
+ }
+
+ public Properties getProperties() {
+ return properties;
+ }
+
+ public String getProperty(String key) {
+ return properties.getProperty(key);
+ }
+
+ public void setProperty(String key, String value) {
+ properties.setProperty(key, value);
+ }
+
+ public void removeProperty(String key) {
+ properties.remove(key);
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/TransactionEvent.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/TransactionEvent.java
new file mode 100644
index 000000000..9249735a1
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/TransactionEvent.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.engine;
+
+import java.util.EventObject;
+
+public abstract class TransactionEvent extends EventObject {
+ protected Profile profile;
+ protected PhaseSet phaseSet;
+ protected Operand[] deltas;
+
+ public TransactionEvent(Profile profile, PhaseSet phaseSet, Operand[] deltas, Engine engine) {
+ super(engine);
+ this.profile = profile;
+ this.phaseSet = phaseSet;
+ this.deltas = deltas;
+ }
+
+ public Profile getProfile() {
+ return profile;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/Utils.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/Utils.java
new file mode 100644
index 000000000..949119d6b
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/Utils.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.engine;
+
+import org.eclipse.core.runtime.IAdaptable;
+
+public class Utils {
+
+ //This method will return the adapter, or will throw an exception
+ public static Object getAdapter(IAdaptable toAdapt, Class toAdaptType) throws ProvisioningConfigurationException {
+ Object result = toAdapt.getAdapter(toAdaptType);
+ if (result == null)
+ throw new ProvisioningConfigurationException("Adaptation failure. Can't adapt :" + toAdapt.getClass().getName() + " into a" + toAdaptType.getName());
+ return result;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/phases/Collect.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/phases/Collect.java
new file mode 100644
index 000000000..e0cff6d83
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/phases/Collect.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.engine.phases;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.internal.prov.engine.TouchpointManager;
+import org.eclipse.equinox.prov.artifact.repository.IArtifactRequest;
+import org.eclipse.equinox.prov.core.helpers.MultiStatus;
+import org.eclipse.equinox.prov.download.DownloadManager;
+import org.eclipse.equinox.prov.engine.*;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * The goal of the collect phase is to ask the touchpoints if the artifacts associated with an IU need to be downloaded.
+ */
+public class Collect extends IUPhase {
+ private static final String PHASE_ID = "collect"; //$NON-NLS-1$
+ private DownloadManager dm = null;
+
+ public Collect(int weight) {
+ super(PHASE_ID, weight, Messages.Engine_Collect_Phase);
+ //re-balance work since postPerform will do almost all the time-consuming work
+ PRE_PERFORM_WORK = 0;
+ PERFORM_WORK = 100;
+ POST_PERFORM_WORK = 1000;
+ }
+
+ protected IStatus performOperand(EngineSession session, Profile profile, Operand operand, IProgressMonitor monitor) {
+ IInstallableUnit unit = operand.second();
+
+ if (unit != null) {
+ monitor.subTask(NLS.bind(Messages.Engine_Collecting_For_IU, unit.getId()));
+
+ // TODO: Need do progress reporting
+
+ // Ask all the touchpoints if they need to download an artifact
+ ITouchpoint touchpoint = TouchpointManager.getInstance().getTouchpoint(unit.getTouchpointType());
+ if (touchpoint.supports(PHASE_ID)) {
+ ITouchpointAction[] actions = touchpoint.getActions(PHASE_ID, profile, operand);
+ for (int i = 0; i < actions.length; i++) {
+ Object result = actions[i].execute();
+ if (result != null)
+ dm.add((IArtifactRequest[]) result);
+ session.record(actions[i]);
+ }
+ }
+
+ if (monitor.isCanceled())
+ return Status.CANCEL_STATUS;
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ protected void postPerform(MultiStatus status, Profile profile, Operand[] deltas, IProgressMonitor monitor) {
+ // Start the download
+ status.add(dm.start(monitor));
+ }
+
+ protected void prePerform(MultiStatus status, Profile profile, Operand[] deltas, IProgressMonitor monitor) {
+ dm = new DownloadManager();
+ }
+
+ protected boolean isApplicable(Operand op) {
+ if (op.second() != null)
+ return true;
+ return false;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/phases/Install.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/phases/Install.java
new file mode 100644
index 000000000..660d2f74e
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/phases/Install.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.engine.phases;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.equinox.internal.prov.engine.EngineActivator;
+import org.eclipse.equinox.internal.prov.engine.TouchpointManager;
+import org.eclipse.equinox.prov.core.eventbus.ProvisioningEventBus;
+import org.eclipse.equinox.prov.core.helpers.MultiStatus;
+import org.eclipse.equinox.prov.core.helpers.ServiceHelper;
+import org.eclipse.equinox.prov.engine.*;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.osgi.util.NLS;
+
+public class Install extends IUPhase {
+
+ private static final String PHASE_ID = "install"; //$NON-NLS-1$
+
+ public Install(int weight) {
+ super(PHASE_ID, weight, Messages.Engine_Install_Phase);
+ }
+
+ protected IStatus performOperand(EngineSession session, Profile profile, Operand operand, IProgressMonitor monitor) {
+ IInstallableUnit unit = operand.second();
+
+ monitor.subTask(NLS.bind(Messages.Engine_Installing_IU, unit.getId()));
+
+ ITouchpoint touchpoint = TouchpointManager.getInstance().getTouchpoint(unit.getTouchpointType());
+ if (!touchpoint.supports(PHASE_ID))
+ ((ProvisioningEventBus) ServiceHelper.getService(EngineActivator.getContext(), ProvisioningEventBus.class.getName())).publishEvent(new InstallableUnitEvent(PHASE_ID, true, profile, operand, touchpoint));
+
+ ITouchpointAction[] actions = touchpoint.getActions(PHASE_ID, profile, operand);
+ MultiStatus result = new MultiStatus();
+ for (int i = 0; i < actions.length; i++) {
+ IStatus actionStatus = (IStatus) actions[i].execute();
+ result.add(actionStatus);
+ if (!actionStatus.isOK())
+ return result;
+
+ session.record(actions[i]);
+ }
+ ((ProvisioningEventBus) ServiceHelper.getService(EngineActivator.getContext(), ProvisioningEventBus.class.getName())).publishEvent(new InstallableUnitEvent(PHASE_ID, false, profile, operand, touchpoint, result));
+ return result;
+ }
+
+ protected boolean isApplicable(Operand op) {
+ if (op.second() != null)
+ return true;
+ return false;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/phases/Messages.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/phases/Messages.java
new file mode 100644
index 000000000..f35b810e0
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/phases/Messages.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.engine.phases;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.equinox.prov.engine.phases.messages"; //$NON-NLS-1$
+
+ static {
+ // initialize resource bundles
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ // Do not instantiate
+ }
+
+ public static String Engine_Collect_Phase;
+ public static String Engine_Collecting_For_IU;
+ public static String Engine_Install_Phase;
+ public static String Engine_Installing_IU;
+ public static String Engine_Uninstall_Phase;
+ public static String Engine_Uninstalling_IU;
+}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/phases/Uninstall.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/phases/Uninstall.java
new file mode 100644
index 000000000..0732680e1
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/phases/Uninstall.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.engine.phases;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.equinox.internal.prov.engine.EngineActivator;
+import org.eclipse.equinox.internal.prov.engine.TouchpointManager;
+import org.eclipse.equinox.prov.core.eventbus.ProvisioningEventBus;
+import org.eclipse.equinox.prov.core.helpers.MultiStatus;
+import org.eclipse.equinox.prov.core.helpers.ServiceHelper;
+import org.eclipse.equinox.prov.engine.*;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.osgi.util.NLS;
+
+public class Uninstall extends IUPhase {
+
+ private static final String PHASE_ID = "uninstall"; //$NON-NLS-1$
+
+ public Uninstall(int weight) {
+ super(PHASE_ID, weight, Messages.Engine_Uninstall_Phase);
+ }
+
+ protected IStatus performOperand(EngineSession session, Profile profile, Operand operand, IProgressMonitor monitor) {
+ IInstallableUnit unit = operand.first();
+
+ monitor.subTask(NLS.bind(Messages.Engine_Uninstalling_IU, unit.getId()));
+
+ ITouchpoint touchpoint = TouchpointManager.getInstance().getTouchpoint(unit.getTouchpointType());
+ if (touchpoint.supports(PHASE_ID))
+ ((ProvisioningEventBus) ServiceHelper.getService(EngineActivator.getContext(), ProvisioningEventBus.class.getName())).publishEvent(new InstallableUnitEvent(PHASE_ID, true, profile, operand, touchpoint));
+
+ //TODO need to protect the actual operation on a try / catch to ensure the delivery of event.
+ ITouchpointAction[] actions = touchpoint.getActions(PHASE_ID, profile, operand);
+ MultiStatus result = new MultiStatus();
+ for (int i = 0; i < actions.length; i++) {
+ result.add((IStatus) actions[i].execute());
+ session.record(actions[i]);
+ }
+
+ ((ProvisioningEventBus) ServiceHelper.getService(EngineActivator.getContext(), ProvisioningEventBus.class.getName())).publishEvent(new InstallableUnitEvent(PHASE_ID, false, profile, operand, touchpoint, result));
+ return result;
+ }
+
+ protected boolean isApplicable(Operand op) {
+ if (op.first() != null)
+ return true;
+ return false;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/phases/messages.properties b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/phases/messages.properties
new file mode 100644
index 000000000..9e644e32f
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/engine/phases/messages.properties
@@ -0,0 +1,17 @@
+###############################################################################
+# Copyright (c) 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+
+Engine_Collect_Phase=collect
+Engine_Install_Phase=install
+Engine_Uninstall_Phase=uninstall
+Engine_Collecting_For_IU=Collecting for {0}
+Engine_Installing_IU=Installing {0}
+Engine_Uninstalling_IU=Uninstalling {0} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/installregistry/IInstallRegistry.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/installregistry/IInstallRegistry.java
new file mode 100644
index 000000000..3cbc8b8f5
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/installregistry/IInstallRegistry.java
@@ -0,0 +1,171 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.installregistry;
+
+import java.util.Collection;
+import org.eclipse.equinox.prov.engine.Profile;
+
+public interface IInstallRegistry {
+
+ /**
+ * Save the registry as XML. If exception is thrown, no change was made.
+ */
+ // public void saveXML() throws IOException {
+ // checkMetadata();
+ // File xmlFile = getLocation();
+ // plog.start(plog.debug("Saving {0}", xmlFile)); //$NON-NLS-1$
+ // if (isEmpty()) { // delete when empty
+ // xmlFile.delete();
+ // if (xmlFile.exists()) {
+ // throw new IOException(NLS.bind(Messages.InstallRegistry_Failed_To_Delete_Install_Registry, xmlFile));
+ // }
+ // } else {
+ // new FileUtil.SafeUpdate(xmlFile) {
+ // public void write(FileOutputStream stream) throws IOException {
+ // XMLWriter writer = new XMLWriter(stream, XML.getProcessingInstruction());
+ // XML.write(writer);
+ // writer.flush();
+ // stream.getFD().sync();
+ // writer.close();
+ // }
+ // }.write();
+ // }
+ // plog.stop();
+ // }
+ // private static class XML implements InstallRegistryXML {
+ // public static XMLWriter.ProcessingInstruction getProcessingInstruction() {
+ // return new XMLWriter.ProcessingInstruction(PI.INSTALL_REGISTRY, MetaInfo.formatVersion(MetaInfo.INSTALL_REGISTRY_VERSION));
+ // }
+ //
+ // public static void write(XMLWriter writer) {
+ // InstallRegistry ir = InstallRegistry.getInstance();
+ // writer.start(Elements.INSTALL_REGISTRY);
+ // writer.write(ir.profileRegistry.getProperties());
+ // for (Iterator i = ir.getProfileInstallRegistries().iterator(); i.hasNext();) {
+ // ProfileInstallRegistry registry = (ProfileInstallRegistry) i.next();
+ // if (!registry.isEmpty()) {
+ // writer.start(Elements.PROFILE);
+ // Profile profile = registry.getProfile();
+ // writer.attribute(Attrs.ID, profile.getProfileId());
+ // writer.attribute(Attrs.KIND, profile.getProfileKind());
+ // writer.writeProperty(Profile.INSTALL_LOCATION, profile.getInstallLocation());
+ // writer.write(profile.getAllData());
+ // InstallContext rootContext = profile.getRootContext();
+ // if (rootContext != null) {
+ // write(writer, rootContext);
+ // }
+ // registry.emitXML(writer);
+ // writer.end(Elements.PROFILE);
+ // }
+ // }
+ // writer.end(Elements.INSTALL_REGISTRY);
+ // }
+ //
+ // private static void write(XMLWriter writer, InstallContext installContext) {
+ // writer.start(Elements.INSTALL_CONTEXT);
+ // writer.attribute(Attrs.ID, installContext.getId());
+ // writer.attribute(Attrs.NAME, installContext.getName());
+ // writer.attribute(Attrs.DESCRIPTION, installContext.getDescription());
+ // writer.attribute(Attrs.SHAREABLE, installContext.isShareable(), true);
+ // writer.attribute(Attrs.QUALIFIABLE, installContext.isQualifiable(), false);
+ // InstallationContextScope scope = installContext.getScope();
+ // if (scope != InstallationContextScope.NONE_SCOPE) {
+ // writer.attribute(Attrs.SCOPE, scope.getName());
+ // }
+ // writer.write(installContext.getLocalProperties());
+ // String[] adapterTypes = installContext.getAdaptorTypes();
+ // for (int i = 0; i < adapterTypes.length; i += 1) {
+ // writer.start(Elements.ADAPTER);
+ // writer.attribute(Attrs.TYPE, adapterTypes[i]);
+ // writer.end();
+ // }
+ // InstallContext[] subcontexts = installContext.getSubcontexts();
+ // for (int i = 0; i < subcontexts.length; i += 1) {
+ // write(writer, subcontexts[i]);
+ // }
+ // writer.end(Elements.INSTALL_CONTEXT);
+ // }
+ // }
+ // /**
+ // * The file of the install registry.
+ // */
+ // public File getLocation() {
+ // return this.location;
+ // }
+ // // The location of the old install registry directory.
+ // // This is where the metadata is still stored.
+ // private File getLegacyLocation(String subdir) {
+ // String path = getLocation().getPath();
+ // if (path.endsWith(CommonDef.Extensions.Xml)) {
+ // path = path.substring(0, path.length() - CommonDef.Extensions.Xml.length());
+ // } else {
+ // path += ".dir"; //$NON-NLS-1$
+ // }
+ // return new File(path, subdir);
+ // }
+ public abstract IProfileInstallRegistry getProfileInstallRegistry(Profile profile);
+
+ /**
+ * Open the install registry. It must be open before any operations can be performed.
+ */
+ // public void open() throws IOException {
+ // // openFile(Agent.getInstance().getInstallRegistryLocation());
+ // }
+ //
+ // // This form is for AbstractAgentTestCase because the preferences aren't set correctly
+ // // when it needs the install registry.
+ // public void open(File dir) throws IOException {
+ // openFile(new File(dir, Agent.FILENAME_INSTALL_REGISTRY));
+ // }
+ //
+ // private void openFile(File file) throws IOException {
+ // if (isOpen()) {
+ // throw new InstallRegistryException(Messages2.InstallRegistry_Install_Registry_Is_Already_Open);
+ // }
+ // this.location = file;
+ // if (this.location.isDirectory()) {
+ // throw new InstallRegistryException(NLS.bind(Messages2.InstallRegistry_Install_Registry_Exists_And_Is_A_Directory, this.location));
+ // } else if (!this.location.exists()) {
+ // // verify we can write it
+ // this.location.getParentFile().mkdirs();
+ // new FileOutputStream(this.location).close();
+ // this.location.delete();
+ // }
+ //
+ // // TODO: move to cache
+ // File metadataDir = getLegacyLocation(METADATA_DIR);
+ // try {
+ // this.metadataRepo = StandardRepository.create(this.installedMetadata.getRepositoryGroup(), metadataDir);
+ // } catch (RuntimeException e) {
+ // // report error below
+ // }
+ // if (this.metadataRepo == null) {
+ // throw new InstallRegistryException(NLS.bind(Messages.InstallRegistry_Failed_To_Create_Install_Registry_Repo, metadataDir));
+ // }
+ // this.metadataRepo.setOpen(true);
+ // load();
+ // checkMetadata();
+ // }
+ //
+ // public void close() {
+ // this.installedMetadata.getRepositoryGroup().removeRepository(this.metadataRepo);
+ // this.metadataRepo = null;
+ // if (isEmpty()) {
+ // purge();
+ // }
+ // }
+ // public void purge() {
+ // getLocation().delete();
+ // FileUtil.rm_r(getLegacyLocation(""), /*removeRoot*/true); //$NON-NLS-1$
+ // }
+ public abstract Collection getProfileInstallRegistries();
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/installregistry/IProfileInstallRegistry.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/installregistry/IProfileInstallRegistry.java
new file mode 100644
index 000000000..54f7b01fa
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/installregistry/IProfileInstallRegistry.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.installregistry;
+
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+
+public interface IProfileInstallRegistry {
+
+ public abstract IInstallableUnit[] getInstallableUnits();
+
+ public abstract IInstallableUnit getInstallableUnit(String id, String version);
+
+ public abstract void addInstallableUnits(IInstallableUnit toAdd);
+
+ public abstract void removeInstallableUnits(IInstallableUnit toRemove);
+
+ public abstract String getProfileId();
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/installregistry/InstallRegistry.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/installregistry/InstallRegistry.java
new file mode 100644
index 000000000..2ca377a86
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/prov/installregistry/InstallRegistry.java
@@ -0,0 +1,181 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.installregistry;
+
+import com.thoughtworks.xstream.XStream;
+import java.io.*;
+import java.net.URL;
+import java.util.*;
+import org.eclipse.equinox.internal.prov.engine.EngineActivator;
+import org.eclipse.equinox.prov.core.eventbus.ProvisioningEventBus;
+import org.eclipse.equinox.prov.core.eventbus.SynchronousProvisioningListener;
+import org.eclipse.equinox.prov.core.helpers.ServiceHelper;
+import org.eclipse.equinox.prov.core.location.AgentLocation;
+import org.eclipse.equinox.prov.engine.*;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.osgi.service.datalocation.Location;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.Version;
+
+public class InstallRegistry implements IInstallRegistry {
+ private static String STORAGE = "installRegistry.xml";
+
+ // what is installed in each profile
+ private Map profileRegistries = new HashMap(); // Profile id -> ProfileInstallRegistry
+ // private ProfileRegistry profileRegistry; // the corresponding ProfileRegistry
+ // private File location; // xml file containing install registry
+ // private IRepository metadataRepo;
+ // private final MetadataCache installedMetadata = new MetadataCache(
+ // new RepositoryGroup("InstallRegistry"), //$NON-NLS-1$
+ // MetadataCache.POLICY_NONE);
+
+ private transient ServiceReference busReference;
+ private transient ProvisioningEventBus bus;
+
+ public InstallRegistry() {
+ busReference = EngineActivator.getContext().getServiceReference(ProvisioningEventBus.class.getName());
+ bus = (ProvisioningEventBus) EngineActivator.getContext().getService(busReference);
+ restore();
+ bus.addListener(new SynchronousProvisioningListener() {
+ public void notify(EventObject o) {
+ if (o instanceof InstallableUnitEvent) {
+ InstallableUnitEvent event = (InstallableUnitEvent) o;
+ if (event.isPre() || !event.getResult().isOK())
+ return;
+ IProfileInstallRegistry registry = getProfileInstallRegistry(event.getProfile());
+ if (event.getOperand().second() != null) {
+ registry.addInstallableUnits(event.getOperand().second().getOriginal());
+ }
+ if (event.getOperand().first() != null) {
+ registry.removeInstallableUnits(event.getOperand().first().getOriginal());
+ }
+ } else if (o instanceof CommitOperationEvent) {
+ persist();
+ return;
+ } else if (o instanceof RollbackOperationEvent) {
+ restore();
+ return;
+ } else if (o instanceof ProfileEvent) {
+ ProfileEvent pe = (ProfileEvent) o;
+ if (pe.getReason() == ProfileEvent.REMOVED) {
+ profileRegistries.remove(pe.getProfile().getProfileId());
+ persist();
+ }
+ }
+ }
+
+ });
+ }
+
+ private void persist() {
+ try {
+ BufferedOutputStream bof = null;
+ try {
+ Location agent = (Location) ServiceHelper.getService(EngineActivator.getContext(), AgentLocation.class.getName());
+ if (agent == null)
+ // TODO should likely do something here since we failed to persist.
+ return;
+ if (!agent.getURL().getProtocol().equals("file"))
+ throw new IOException("can't write at the given location");
+
+ File outputFile = new File(agent.getURL().getFile(), STORAGE);
+ if (!outputFile.getParentFile().exists() && !outputFile.getParentFile().mkdirs())
+ throw new RuntimeException("can't persist profile registry");
+ bof = new BufferedOutputStream(new FileOutputStream(outputFile, false));
+ new XStream().toXML(profileRegistries, bof);
+ } finally {
+ if (bof != null)
+ bof.close();
+ }
+ } catch (FileNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ private void restore() {
+ try {
+ BufferedInputStream bif = null;
+ try {
+ Location agent = (Location) ServiceHelper.getService(EngineActivator.getContext(), AgentLocation.class.getName());
+ if (agent == null)
+ // TODO should likely do something here since we failed to restore.
+ return;
+ bif = new BufferedInputStream(new URL(agent.getURL(), STORAGE).openStream());
+ profileRegistries = (HashMap) new XStream().fromXML(bif);
+ } finally {
+ if (bif != null)
+ bif.close();
+ }
+ } catch (FileNotFoundException e) {
+ //This is ok.
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ public IProfileInstallRegistry getProfileInstallRegistry(Profile profile) {
+ String profileId = profile.getProfileId();
+ IProfileInstallRegistry result = (IProfileInstallRegistry) this.profileRegistries.get(profileId);
+ if (result == null) {
+ result = new ProfileInstallRegistry(profileId);
+ this.profileRegistries.put(profileId, result);
+ }
+ return result;
+ }
+
+ public Collection getProfileInstallRegistries() {
+ return this.profileRegistries.values();
+ }
+
+ /**
+ * Install registry for a single profile.
+ */
+ public class ProfileInstallRegistry implements IProfileInstallRegistry {
+ private String profileId; // id profile this data applies to
+ private Set installableUnits; //id
+
+ ProfileInstallRegistry(String profileId) {
+ this.profileId = profileId;
+ this.installableUnits = new HashSet();
+ }
+
+ public IInstallableUnit[] getInstallableUnits() {
+ IInstallableUnit[] result = new IInstallableUnit[installableUnits.size()];
+ return (IInstallableUnit[]) installableUnits.toArray(result);
+ }
+
+ public void addInstallableUnits(IInstallableUnit toAdd) {
+ installableUnits.add(toAdd);
+ }
+
+ public void removeInstallableUnits(IInstallableUnit toRemove) {
+ installableUnits.remove(toRemove);
+ }
+
+ public String getProfileId() {
+ return profileId;
+ }
+
+ public IInstallableUnit getInstallableUnit(String id, String version) {
+ for (Iterator i = installableUnits.iterator(); i.hasNext();) {
+ IInstallableUnit iu = (IInstallableUnit) i.next();
+ if (iu.getId().equals(id) && iu.getVersion().equals(new Version(version)))
+ return iu;
+ }
+ return null;
+ }
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.exemplarysetup/.classpath b/bundles/org.eclipse.equinox.p2.exemplarysetup/.classpath
new file mode 100644
index 000000000..7cdeb7319
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.exemplarysetup/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/CDC-1.1%Foundation-1.1"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.equinox.p2.exemplarysetup/.project b/bundles/org.eclipse.equinox.p2.exemplarysetup/.project
new file mode 100644
index 000000000..3fdc4d960
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.exemplarysetup/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.equinox.prov.examplarysetup</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.equinox.p2.exemplarysetup/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.exemplarysetup/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..b3fb58aaa
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.exemplarysetup/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,339 @@
+#Thu Sep 06 23:48:04 EDT 2007
+eclipse.preferences.version=1
+org.eclipse.jdt.core.builder.cleanOutputFolder=clean
+org.eclipse.jdt.core.builder.duplicateResourceTask=warning
+org.eclipse.jdt.core.builder.invalidClasspath=abort
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
+org.eclipse.jdt.core.circularClasspath=error
+org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
+org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=ignore
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=false
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false
+org.eclipse.jdt.core.formatter.comment.format_line_comments=false
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=800
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.incompatibleJDKLevel=ignore
+org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/bundles/org.eclipse.equinox.p2.exemplarysetup/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.p2.exemplarysetup/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 000000000..bb66afef0
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.exemplarysetup/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,57 @@
+#Sun Sep 23 11:58:11 EDT 2007
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_core
+formatter_settings_version=11
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=;
+org.eclipse.jdt.ui.ondemandthreshold=3
+org.eclipse.jdt.ui.staticondemandthreshold=3
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates/>
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.format_source_code=true
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_variable_declarations_final=true
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=false
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/bundles/org.eclipse.equinox.p2.exemplarysetup/.settings/org.eclipse.pde.core.prefs b/bundles/org.eclipse.equinox.p2.exemplarysetup/.settings/org.eclipse.pde.core.prefs
new file mode 100644
index 000000000..7913d20db
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.exemplarysetup/.settings/org.eclipse.pde.core.prefs
@@ -0,0 +1,4 @@
+
+eclipse.preferences.version=1
+pluginProject.extensions=false
+resolve.requirebundle=false
diff --git a/bundles/org.eclipse.equinox.p2.exemplarysetup/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.exemplarysetup/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..af30e1381
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.exemplarysetup/META-INF/MANIFEST.MF
@@ -0,0 +1,20 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Examplary Plug-in
+Bundle-SymbolicName: org.eclipse.equinox.prov.examplarysetup
+Bundle-Version: 0.1.0.qualifier
+Import-Package: org.eclipse.equinox.internal.prov.artifact.repository,
+ org.eclipse.equinox.internal.prov.metadata.repository,
+ org.eclipse.equinox.prov.artifact.repository,
+ org.eclipse.equinox.prov.core.eventbus,
+ org.eclipse.equinox.prov.director,
+ org.eclipse.equinox.prov.engine,
+ org.eclipse.equinox.prov.installregistry,
+ org.eclipse.equinox.prov.metadata,
+ org.eclipse.equinox.prov.metadata.repository,
+ org.osgi.framework;version="1.3.0"
+Eclipse-LazyStart: true
+Bundle-Activator: org.eclipse.equinox.internal.prov.examplarysetup.Activator
+Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
+ J2SE-1.4
+Require-Bundle: org.eclipse.equinox.common
diff --git a/bundles/org.eclipse.equinox.p2.exemplarysetup/about.html b/bundles/org.eclipse.equinox.p2.exemplarysetup/about.html
new file mode 100644
index 000000000..460233046
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.exemplarysetup/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 2, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.exemplarysetup/build.properties b/bundles/org.eclipse.equinox.p2.exemplarysetup/build.properties
new file mode 100644
index 000000000..475da1dec
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.exemplarysetup/build.properties
@@ -0,0 +1,15 @@
+###############################################################################
+# Copyright (c) 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html
diff --git a/bundles/org.eclipse.equinox.p2.exemplarysetup/src/org/eclipse/equinox/internal/prov/examplarysetup/Activator.java b/bundles/org.eclipse.equinox.p2.exemplarysetup/src/org/eclipse/equinox/internal/prov/examplarysetup/Activator.java
new file mode 100644
index 000000000..13d22889e
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.exemplarysetup/src/org/eclipse/equinox/internal/prov/examplarysetup/Activator.java
@@ -0,0 +1,137 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.examplarysetup;
+
+import org.eclipse.equinox.internal.prov.artifact.repository.ArtifactRepositoryManager;
+import org.eclipse.equinox.internal.prov.metadata.repository.MetadataRepositoryManager;
+import org.eclipse.equinox.prov.artifact.repository.IArtifactRepositoryManager;
+import org.eclipse.equinox.prov.core.eventbus.ProvisioningEventBus;
+import org.eclipse.equinox.prov.director.IDirector;
+import org.eclipse.equinox.prov.director.NewSimpleDirector;
+import org.eclipse.equinox.prov.engine.IProfileRegistry;
+import org.eclipse.equinox.prov.engine.SimpleProfileRegistry;
+import org.eclipse.equinox.prov.installregistry.IInstallRegistry;
+import org.eclipse.equinox.prov.installregistry.InstallRegistry;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepositoryManager;
+import org.osgi.framework.*;
+
+public class Activator implements BundleActivator {
+ public static final String ID = "org.eclipse.equinox.prov.core";
+ public static BundleContext context;
+
+ private ProvisioningEventBus bus;
+ private ServiceRegistration registrationBus;
+
+ private IInstallRegistry installRegistry;
+ private ServiceRegistration registrationInstallRegistry;
+
+ private MetadataRepositoryManager defaultManager;
+ private ServiceRegistration registrationDefaultManager;
+
+ private ArtifactRepositoryManager artifactRepoManager;
+ private ServiceRegistration registrationArtifactRepoManager;
+
+ private IProfileRegistry profileRegistry;
+ private ServiceRegistration registrationProfileRegistry;
+
+ private IDirector director;
+ private ServiceRegistration registrationDirector;
+
+ public void start(BundleContext context) throws Exception {
+ //Need to do the configuration of all the bits and pieces:
+ Activator.context = context;
+
+ registerEventBus();
+ //create the profile registry
+ registerProfileRegistry();
+ //create metadata repositories
+ registerDefaultMetadataRepoManager();
+ registerInstallRegistry();
+
+ //create the director
+ registerDirector();
+
+ //create artifact repositories
+ registerDefaultArtifactRepoManager();
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ unregisterDefaultArtifactRepoManager();
+ unregisterDirector();
+ unregisterInstallRegistry();
+ unregisterDefaultMetadataRepoManager();
+ unregisterProfileRegistry();
+ unregisterEventBus();
+ Activator.context = null;
+
+ }
+
+ private void registerDirector() {
+ director = new NewSimpleDirector();
+ registrationDirector = context.registerService(IDirector.class.getName(), director, null);
+ }
+
+ private void unregisterDirector() {
+ registrationDirector.unregister();
+ director = null;
+ }
+
+ private void registerProfileRegistry() {
+ profileRegistry = new SimpleProfileRegistry();
+ registrationProfileRegistry = context.registerService(IProfileRegistry.class.getName(), profileRegistry, null);
+ }
+
+ private void unregisterProfileRegistry() {
+ registrationProfileRegistry.unregister();
+ profileRegistry = null;
+ }
+
+ private void registerDefaultMetadataRepoManager() {
+ defaultManager = new MetadataRepositoryManager();
+ registrationDefaultManager = context.registerService(IMetadataRepositoryManager.class.getName(), defaultManager, null);
+ }
+
+ private void unregisterDefaultMetadataRepoManager() {
+ registrationDefaultManager.unregister();
+ registrationDefaultManager = null;
+ }
+
+ private void registerDefaultArtifactRepoManager() {
+ artifactRepoManager = new ArtifactRepositoryManager();
+ registrationArtifactRepoManager = context.registerService(IArtifactRepositoryManager.class.getName(), artifactRepoManager, null);
+ }
+
+ private void unregisterDefaultArtifactRepoManager() {
+ registrationArtifactRepoManager.unregister();
+ artifactRepoManager = null;
+ }
+
+ private void registerInstallRegistry() {
+ installRegistry = new InstallRegistry();
+ registrationInstallRegistry = context.registerService(IInstallRegistry.class.getName(), installRegistry, null);
+ }
+
+ private void unregisterInstallRegistry() {
+ registrationInstallRegistry.unregister();
+ registrationInstallRegistry = null;
+ }
+
+ private void registerEventBus() {
+ bus = new ProvisioningEventBus();
+ registrationBus = context.registerService(ProvisioningEventBus.class.getName(), bus, null);
+ }
+
+ private void unregisterEventBus() {
+ registrationBus.unregister();
+ registrationBus = null;
+ bus.close();
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/.classpath b/bundles/org.eclipse.equinox.p2.metadata.generator/.classpath
new file mode 100644
index 000000000..ce7393340
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.generator/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/.cvsignore b/bundles/org.eclipse.equinox.p2.metadata.generator/.cvsignore
new file mode 100644
index 000000000..f2fc20d10
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.generator/.cvsignore
@@ -0,0 +1,2 @@
+org.eclipse.equinox.simpleconfigurator.jar
+org.eclipse.update.configurator.jar
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/.project b/bundles/org.eclipse.equinox.p2.metadata.generator/.project
new file mode 100644
index 000000000..6fc39c431
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.generator/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.equinox.prov.metadata.generator</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.metadata.generator/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..78523cd05
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.generator/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,331 @@
+#Thu Aug 16 11:00:59 EDT 2007
+eclipse.preferences.version=1
+org.eclipse.jdt.core.builder.cleanOutputFolder=clean
+org.eclipse.jdt.core.builder.duplicateResourceTask=warning
+org.eclipse.jdt.core.builder.invalidClasspath=abort
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
+org.eclipse.jdt.core.circularClasspath=error
+org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
+org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=error
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=false
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false
+org.eclipse.jdt.core.formatter.comment.format_line_comments=false
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=800
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.incompatibleJDKLevel=ignore
+org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.p2.metadata.generator/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 000000000..7c9816508
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.generator/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,57 @@
+#Sun Sep 23 11:58:19 EDT 2007
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_core
+formatter_settings_version=11
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=;
+org.eclipse.jdt.ui.ondemandthreshold=3
+org.eclipse.jdt.ui.staticondemandthreshold=3
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates/>
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.format_source_code=true
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_variable_declarations_final=true
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=false
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/.settings/org.eclipse.pde.core.prefs b/bundles/org.eclipse.equinox.p2.metadata.generator/.settings/org.eclipse.pde.core.prefs
new file mode 100644
index 000000000..7913d20db
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.generator/.settings/org.eclipse.pde.core.prefs
@@ -0,0 +1,4 @@
+
+eclipse.preferences.version=1
+pluginProject.extensions=false
+resolve.requirebundle=false
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/CDC-1.0_Foundation-1.0.profile b/bundles/org.eclipse.equinox.p2.metadata.generator/CDC-1.0_Foundation-1.0.profile
new file mode 100644
index 000000000..1157a29bd
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.generator/CDC-1.0_Foundation-1.0.profile
@@ -0,0 +1,19 @@
+###############################################################################
+# Copyright (c) 2005 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+org.osgi.framework.system.packages = \
+ javax.microedition.io
+org.osgi.framework.bootdelegation = \
+ javax.microedition.io
+org.osgi.framework.executionenvironment = \
+ OSGi/Minimum-1.0,\
+ OSGi/Minimum-1.1,\
+ CDC-1.0/Foundation-1.0
+osgi.java.profile.name = CDC-1.0/Foundation-1.0
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/CDC-1.1_Foundation-1.1.profile b/bundles/org.eclipse.equinox.p2.metadata.generator/CDC-1.1_Foundation-1.1.profile
new file mode 100644
index 000000000..374300afc
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.generator/CDC-1.1_Foundation-1.1.profile
@@ -0,0 +1,24 @@
+###############################################################################
+# Copyright (c) 2005 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+org.osgi.framework.system.packages = \
+ javax.microedition.io,\
+ javax.microedition.pki,\
+ javax.security.auth.x500
+org.osgi.framework.bootdelegation = \
+ javax.microedition.io,\
+ javax.microedition.pki,\
+ javax.security.auth.x500
+org.osgi.framework.executionenvironment = \
+ OSGi/Minimum-1.0,\
+ OSGi/Minimum-1.1,\
+ CDC-1.0/Foundation-1.0,\
+ CDC-1.1/Foundation-1.1
+osgi.java.profile.name = CDC-1.1/Foundation-1.1
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/J2SE-1.2.profile b/bundles/org.eclipse.equinox.p2.metadata.generator/J2SE-1.2.profile
new file mode 100644
index 000000000..28f973ad5
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.generator/J2SE-1.2.profile
@@ -0,0 +1,42 @@
+###############################################################################
+# Copyright (c) 2003, 2005 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+org.osgi.framework.system.packages = \
+ javax.accessibility,\
+ javax.swing,\
+ javax.swing.border,\
+ javax.swing.colorchooser,\
+ javax.swing.event,\
+ javax.swing.filechooser,\
+ javax.swing.plaf,\
+ javax.swing.plaf.basic,\
+ javax.swing.plaf.metal,\
+ javax.swing.plaf.multi,\
+ javax.swing.table,\
+ javax.swing.text,\
+ javax.swing.text.html,\
+ javax.swing.text.html.parser,\
+ javax.swing.text.rtf,\
+ javax.swing.tree,\
+ javax.swing.undo,\
+ org.omg.CORBA,\
+ org.omg.CORBA.DynAnyPackage,\
+ org.omg.CORBA.ORBPackage,\
+ org.omg.CORBA.portable,\
+ org.omg.CORBA.TypeCodePackage,\
+ org.omg.CosNaming,\
+ org.omg.CosNaming.NamingContextPackage
+org.osgi.framework.bootdelegation = \
+ sun.*,\
+ com.sun.*
+org.osgi.framework.executionenvironment = \
+ JRE-1.1,\
+ J2SE-1.2
+osgi.java.profile.name = J2SE-1.2
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/J2SE-1.3.profile b/bundles/org.eclipse.equinox.p2.metadata.generator/J2SE-1.3.profile
new file mode 100644
index 000000000..b7dbdfabb
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.generator/J2SE-1.3.profile
@@ -0,0 +1,63 @@
+###############################################################################
+# Copyright (c) 2003, 2005 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+org.osgi.framework.system.packages = \
+ javax.accessibility,\
+ javax.naming,\
+ javax.naming.directory,\
+ javax.naming.event,\
+ javax.naming.ldap,\
+ javax.naming.spi,\
+ javax.rmi,\
+ javax.rmi.CORBA,\
+ javax.sound.midi,\
+ javax.sound.midi.spi,\
+ javax.sound.sampled,\
+ javax.sound.sampled.spi,\
+ javax.swing,\
+ javax.swing.border,\
+ javax.swing.colorchooser,\
+ javax.swing.event,\
+ javax.swing.filechooser,\
+ javax.swing.plaf,\
+ javax.swing.plaf.basic,\
+ javax.swing.plaf.metal,\
+ javax.swing.plaf.multi,\
+ javax.swing.table,\
+ javax.swing.text,\
+ javax.swing.text.html,\
+ javax.swing.text.html.parser,\
+ javax.swing.text.rtf,\
+ javax.swing.tree,\
+ javax.swing.undo,\
+ javax.transaction,\
+ org.omg.CORBA,\
+ org.omg.CORBA_2_3,\
+ org.omg.CORBA_2_3.portable,\
+ org.omg.CORBA.DynAnyPackage,\
+ org.omg.CORBA.ORBPackage,\
+ org.omg.CORBA.portable,\
+ org.omg.CORBA.TypeCodePackage,\
+ org.omg.CosNaming,\
+ org.omg.CosNaming.NamingContextPackage,\
+ org.omg.SendingContext,\
+ org.omg.stub.java.rmi
+org.osgi.framework.bootdelegation = \
+ javax.*,\
+ org.omg.*,\
+ sun.*,\
+ com.sun.*
+org.osgi.framework.executionenvironment = \
+ OSGi/Minimum-1.0,\
+ OSGi/Minimum-1.1,\
+ JRE-1.1,\
+ J2SE-1.2,\
+ J2SE-1.3
+osgi.java.profile.name = J2SE-1.3
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/J2SE-1.4.profile b/bundles/org.eclipse.equinox.p2.metadata.generator/J2SE-1.4.profile
new file mode 100644
index 000000000..b307c978e
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.generator/J2SE-1.4.profile
@@ -0,0 +1,118 @@
+###############################################################################
+# Copyright (c) 2003, 2005 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+org.osgi.framework.system.packages = \
+ javax.accessibility,\
+ javax.crypto,\
+ javax.crypto.interfaces,\
+ javax.crypto.spec,\
+ javax.imageio,\
+ javax.imageio.event,\
+ javax.imageio.metadata,\
+ javax.imageio.plugins.jpeg,\
+ javax.imageio.spi,\
+ javax.imageio.stream,\
+ javax.naming,\
+ javax.naming.directory,\
+ javax.naming.event,\
+ javax.naming.ldap,\
+ javax.naming.spi,\
+ javax.net,\
+ javax.net.ssl,\
+ javax.print,\
+ javax.print.attribute,\
+ javax.print.attribute.standard,\
+ javax.print.event,\
+ javax.rmi,\
+ javax.rmi.CORBA,\
+ javax.security.auth,\
+ javax.security.auth.callback,\
+ javax.security.auth.kerberos,\
+ javax.security.auth.login,\
+ javax.security.auth.spi,\
+ javax.security.auth.x500,\
+ javax.security.cert,\
+ javax.sound.midi,\
+ javax.sound.midi.spi,\
+ javax.sound.sampled,\
+ javax.sound.sampled.spi,\
+ javax.sql,\
+ javax.swing,\
+ javax.swing.border,\
+ javax.swing.colorchooser,\
+ javax.swing.event,\
+ javax.swing.filechooser,\
+ javax.swing.plaf,\
+ javax.swing.plaf.basic,\
+ javax.swing.plaf.metal,\
+ javax.swing.plaf.multi,\
+ javax.swing.table,\
+ javax.swing.text,\
+ javax.swing.text.html,\
+ javax.swing.text.html.parser,\
+ javax.swing.text.rtf,\
+ javax.swing.tree,\
+ javax.swing.undo,\
+ javax.transaction,\
+ javax.transaction.xa,\
+ javax.xml.parsers,\
+ javax.xml.transform,\
+ javax.xml.transform.dom,\
+ javax.xml.transform.sax,\
+ javax.xml.transform.stream,\
+ org.ietf.jgss,\
+ org.omg.CORBA,\
+ org.omg.CORBA_2_3,\
+ org.omg.CORBA_2_3.portable,\
+ org.omg.CORBA.DynAnyPackage,\
+ org.omg.CORBA.ORBPackage,\
+ org.omg.CORBA.portable,\
+ org.omg.CORBA.TypeCodePackage,\
+ org.omg.CosNaming,\
+ org.omg.CosNaming.NamingContextExtPackage,\
+ org.omg.CosNaming.NamingContextPackage,\
+ org.omg.Dynamic,\
+ org.omg.DynamicAny,\
+ org.omg.DynamicAny.DynAnyFactoryPackage,\
+ org.omg.DynamicAny.DynAnyPackage,\
+ org.omg.IOP,\
+ org.omg.IOP.CodecFactoryPackage,\
+ org.omg.IOP.CodecPackage,\
+ org.omg.Messaging,\
+ org.omg.PortableInterceptor,\
+ org.omg.PortableInterceptor.ORBInitInfoPackage,\
+ org.omg.PortableServer,\
+ org.omg.PortableServer.CurrentPackage,\
+ org.omg.PortableServer.POAManagerPackage,\
+ org.omg.PortableServer.POAPackage,\
+ org.omg.PortableServer.portable,\
+ org.omg.PortableServer.ServantLocatorPackage,\
+ org.omg.SendingContext,\
+ org.omg.stub.java.rmi,\
+ org.w3c.dom,\
+ org.xml.sax,\
+ org.xml.sax.ext,\
+ org.xml.sax.helpers
+org.osgi.framework.bootdelegation = \
+ javax.*,\
+ org.ietf.jgss,\
+ org.omg.*,\
+ org.w3c.*,\
+ org.xml.*,\
+ sun.*,\
+ com.sun.*
+org.osgi.framework.executionenvironment = \
+ OSGi/Minimum-1.0,\
+ OSGi/Minimum-1.1,\
+ JRE-1.1,\
+ J2SE-1.2,\
+ J2SE-1.3,\
+ J2SE-1.4
+osgi.java.profile.name = J2SE-1.4
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/J2SE-1.5.profile b/bundles/org.eclipse.equinox.p2.metadata.generator/J2SE-1.5.profile
new file mode 100644
index 000000000..d23d6ca5e
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.generator/J2SE-1.5.profile
@@ -0,0 +1,146 @@
+###############################################################################
+# Copyright (c) 2003, 2005 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+org.osgi.framework.system.packages = \
+ javax.accessibility,\
+ javax.activity,\
+ javax.crypto,\
+ javax.crypto.interfaces,\
+ javax.crypto.spec,\
+ javax.imageio,\
+ javax.imageio.event,\
+ javax.imageio.metadata,\
+ javax.imageio.plugins.bmp,\
+ javax.imageio.plugins.jpeg,\
+ javax.imageio.spi,\
+ javax.imageio.stream,\
+ javax.management,\
+ javax.management.loading,\
+ javax.management.modelmbean,\
+ javax.management.monitor,\
+ javax.management.openmbean,\
+ javax.management.relation,\
+ javax.management.remote,\
+ javax.management.remote.rmi,\
+ javax.management.timer,\
+ javax.naming,\
+ javax.naming.directory,\
+ javax.naming.event,\
+ javax.naming.ldap,\
+ javax.naming.spi,\
+ javax.net,\
+ javax.net.ssl,\
+ javax.print,\
+ javax.print.attribute,\
+ javax.print.attribute.standard,\
+ javax.print.event,\
+ javax.rmi,\
+ javax.rmi.CORBA,\
+ javax.rmi.ssl,\
+ javax.security.auth,\
+ javax.security.auth.callback,\
+ javax.security.auth.kerberos,\
+ javax.security.auth.login,\
+ javax.security.auth.spi,\
+ javax.security.auth.x500,\
+ javax.security.cert,\
+ javax.security.sasl,\
+ javax.servlet,\
+ javax.servlet.http,\
+ javax.sound.midi,\
+ javax.sound.midi.spi,\
+ javax.sound.sampled,\
+ javax.sound.sampled.spi,\
+ javax.sql,\
+ javax.sql.rowset,\
+ javax.sql.rowset.serial,\
+ javax.sql.rowset.spi,\
+ javax.swing,\
+ javax.swing.border,\
+ javax.swing.colorchooser,\
+ javax.swing.event,\
+ javax.swing.filechooser,\
+ javax.swing.plaf,\
+ javax.swing.plaf.basic,\
+ javax.swing.plaf.metal,\
+ javax.swing.plaf.multi,\
+ javax.swing.plaf.synth,\
+ javax.swing.table,\
+ javax.swing.text,\
+ javax.swing.text.html,\
+ javax.swing.text.html.parser,\
+ javax.swing.text.rtf,\
+ javax.swing.tree,\
+ javax.swing.undo,\
+ javax.transaction,\
+ javax.transaction.xa,\
+ javax.xml,\
+ javax.xml.datatype,\
+ javax.xml.namespace,\
+ javax.xml.parsers,\
+ javax.xml.transform,\
+ javax.xml.transform.dom,\
+ javax.xml.transform.sax,\
+ javax.xml.transform.stream,\
+ javax.xml.validation,\
+ javax.xml.xpath,\
+ org.ietf.jgss,\
+ org.omg.CORBA,\
+ org.omg.CORBA_2_3,\
+ org.omg.CORBA_2_3.portable,\
+ org.omg.CORBA.DynAnyPackage,\
+ org.omg.CORBA.ORBPackage,\
+ org.omg.CORBA.portable,\
+ org.omg.CORBA.TypeCodePackage,\
+ org.omg.CosNaming,\
+ org.omg.CosNaming.NamingContextExtPackage,\
+ org.omg.CosNaming.NamingContextPackage,\
+ org.omg.Dynamic,\
+ org.omg.DynamicAny,\
+ org.omg.DynamicAny.DynAnyFactoryPackage,\
+ org.omg.DynamicAny.DynAnyPackage,\
+ org.omg.IOP,\
+ org.omg.IOP.CodecFactoryPackage,\
+ org.omg.IOP.CodecPackage,\
+ org.omg.Messaging,\
+ org.omg.PortableInterceptor,\
+ org.omg.PortableInterceptor.ORBInitInfoPackage,\
+ org.omg.PortableServer,\
+ org.omg.PortableServer.CurrentPackage,\
+ org.omg.PortableServer.POAManagerPackage,\
+ org.omg.PortableServer.POAPackage,\
+ org.omg.PortableServer.portable,\
+ org.omg.PortableServer.ServantLocatorPackage,\
+ org.omg.SendingContext,\
+ org.omg.stub.java.rmi,\
+ org.w3c.dom,\
+ org.w3c.dom.bootstrap,\
+ org.w3c.dom.events,\
+ org.w3c.dom.ls,\
+ org.xml.sax,\
+ org.xml.sax.ext,\
+ org.xml.sax.helpers
+org.osgi.framework.bootdelegation = \
+ javax.*,\
+ org.ietf.jgss,\
+ org.omg.*,\
+ org.w3c.*,\
+ org.xml.*,\
+ sun.*,\
+ com.sun.*
+org.osgi.framework.executionenvironment = \
+ OSGi/Minimum-1.0,\
+ OSGi/Minimum-1.1,\
+ JRE-1.1,\
+ J2SE-1.2,\
+ J2SE-1.3,\
+ J2SE-1.4,\
+ J2SE-1.5
+osgi.java.profile.name = J2SE-1.5
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/JRE-1.1.profile b/bundles/org.eclipse.equinox.p2.metadata.generator/JRE-1.1.profile
new file mode 100644
index 000000000..9a8d8fd51
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.generator/JRE-1.1.profile
@@ -0,0 +1,17 @@
+###############################################################################
+# Copyright (c) 2003, 2005 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+org.osgi.framework.system.packages =
+org.osgi.framework.bootdelegation = \
+ sun.*,\
+ com.sun.*
+org.osgi.framework.executionenvironment = \
+ JRE-1.1
+osgi.java.profile.name = JRE-1.1
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/JavaSE-1.6.profile b/bundles/org.eclipse.equinox.p2.metadata.generator/JavaSE-1.6.profile
new file mode 100644
index 000000000..1c7abcba6
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.generator/JavaSE-1.6.profile
@@ -0,0 +1,145 @@
+###############################################################################
+# Copyright (c) 2003, 2005 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+org.osgi.framework.system.packages = \
+ javax.accessibility,\
+ javax.activity,\
+ javax.crypto,\
+ javax.crypto.interfaces,\
+ javax.crypto.spec,\
+ javax.imageio,\
+ javax.imageio.event,\
+ javax.imageio.metadata,\
+ javax.imageio.plugins.bmp,\
+ javax.imageio.plugins.jpeg,\
+ javax.imageio.spi,\
+ javax.imageio.stream,\
+ javax.management,\
+ javax.management.loading,\
+ javax.management.modelmbean,\
+ javax.management.monitor,\
+ javax.management.openmbean,\
+ javax.management.relation,\
+ javax.management.remote,\
+ javax.management.remote.rmi,\
+ javax.management.timer,\
+ javax.naming,\
+ javax.naming.directory,\
+ javax.naming.event,\
+ javax.naming.ldap,\
+ javax.naming.spi,\
+ javax.net,\
+ javax.net.ssl,\
+ javax.print,\
+ javax.print.attribute,\
+ javax.print.attribute.standard,\
+ javax.print.event,\
+ javax.rmi,\
+ javax.rmi.CORBA,\
+ javax.rmi.ssl,\
+ javax.security.auth,\
+ javax.security.auth.callback,\
+ javax.security.auth.kerberos,\
+ javax.security.auth.login,\
+ javax.security.auth.spi,\
+ javax.security.auth.x500,\
+ javax.security.cert,\
+ javax.security.sasl,\
+ javax.sound.midi,\
+ javax.sound.midi.spi,\
+ javax.sound.sampled,\
+ javax.sound.sampled.spi,\
+ javax.sql,\
+ javax.sql.rowset,\
+ javax.sql.rowset.serial,\
+ javax.sql.rowset.spi,\
+ javax.swing,\
+ javax.swing.border,\
+ javax.swing.colorchooser,\
+ javax.swing.event,\
+ javax.swing.filechooser,\
+ javax.swing.plaf,\
+ javax.swing.plaf.basic,\
+ javax.swing.plaf.metal,\
+ javax.swing.plaf.multi,\
+ javax.swing.plaf.synth,\
+ javax.swing.table,\
+ javax.swing.text,\
+ javax.swing.text.html,\
+ javax.swing.text.html.parser,\
+ javax.swing.text.rtf,\
+ javax.swing.tree,\
+ javax.swing.undo,\
+ javax.transaction,\
+ javax.transaction.xa,\
+ javax.xml,\
+ javax.xml.datatype,\
+ javax.xml.namespace,\
+ javax.xml.parsers,\
+ javax.xml.transform,\
+ javax.xml.transform.dom,\
+ javax.xml.transform.sax,\
+ javax.xml.transform.stream,\
+ javax.xml.validation,\
+ javax.xml.xpath,\
+ org.ietf.jgss,\
+ org.omg.CORBA,\
+ org.omg.CORBA_2_3,\
+ org.omg.CORBA_2_3.portable,\
+ org.omg.CORBA.DynAnyPackage,\
+ org.omg.CORBA.ORBPackage,\
+ org.omg.CORBA.portable,\
+ org.omg.CORBA.TypeCodePackage,\
+ org.omg.CosNaming,\
+ org.omg.CosNaming.NamingContextExtPackage,\
+ org.omg.CosNaming.NamingContextPackage,\
+ org.omg.Dynamic,\
+ org.omg.DynamicAny,\
+ org.omg.DynamicAny.DynAnyFactoryPackage,\
+ org.omg.DynamicAny.DynAnyPackage,\
+ org.omg.IOP,\
+ org.omg.IOP.CodecFactoryPackage,\
+ org.omg.IOP.CodecPackage,\
+ org.omg.Messaging,\
+ org.omg.PortableInterceptor,\
+ org.omg.PortableInterceptor.ORBInitInfoPackage,\
+ org.omg.PortableServer,\
+ org.omg.PortableServer.CurrentPackage,\
+ org.omg.PortableServer.POAManagerPackage,\
+ org.omg.PortableServer.POAPackage,\
+ org.omg.PortableServer.portable,\
+ org.omg.PortableServer.ServantLocatorPackage,\
+ org.omg.SendingContext,\
+ org.omg.stub.java.rmi,\
+ org.w3c.dom,\
+ org.w3c.dom.bootstrap,\
+ org.w3c.dom.events,\
+ org.w3c.dom.ls,\
+ org.xml.sax,\
+ org.xml.sax.ext,\
+ org.xml.sax.helpers
+org.osgi.framework.bootdelegation = \
+ javax.*,\
+ org.ietf.jgss,\
+ org.omg.*,\
+ org.w3c.*,\
+ org.xml.*,\
+ sun.*,\
+ com.sun.*
+org.osgi.framework.executionenvironment = \
+ OSGi/Minimum-1.0,\
+ OSGi/Minimum-1.1,\
+ JRE-1.1,\
+ J2SE-1.2,\
+ J2SE-1.3,\
+ J2SE-1.4,\
+ J2SE-1.5,\
+ JavaSE-1.6
+osgi.java.profile.name = JavaSE-1.6
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.metadata.generator/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..448c7c16f
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.generator/META-INF/MANIFEST.MF
@@ -0,0 +1,26 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Generator Plug-in (Incubation)
+Bundle-SymbolicName: org.eclipse.equinox.prov.metadata.generator;singleton:=true
+Bundle-Version: 0.1.0.qualifier
+Require-Bundle: org.eclipse.equinox.prov.core,
+ org.eclipse.osgi,
+ org.eclipse.equinox.common
+Import-Package: com.thoughtworks.xstream,
+ javax.xml.parsers,
+ org.eclipse.equinox.app;version="1.0.0",
+ org.eclipse.equinox.frameworkadmin,
+ org.eclipse.equinox.internal.prov.artifact.repository,
+ org.eclipse.equinox.internal.prov.metadata,
+ org.eclipse.equinox.internal.prov.metadata.repository,
+ org.eclipse.equinox.prov.artifact.repository,
+ org.eclipse.equinox.prov.metadata,
+ org.eclipse.equinox.prov.metadata.repository,
+ org.xml.sax
+Bundle-Activator: org.eclipse.equinox.internal.prov.metadata.generator.Activator
+Export-Package: org.eclipse.equinox.internal.prov.metadata.generator,
+ org.eclipse.equinox.internal.prov.metadata.generator.features;x-internal:=true,
+ org.eclipse.equinox.prov.metadata.generator
+Eclipse-LazyStart: true
+Bundle-RequiredExecutionEnvironment: J2SE-1.4,
+ CDC-1.1/Foundation-1.1
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/Metadata Generator CDT.launch b/bundles/org.eclipse.equinox.p2.metadata.generator/Metadata Generator CDT.launch
new file mode 100644
index 000000000..c44aa41ce
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.generator/Metadata Generator CDT.launch
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.pde.ui.EquinoxLauncher">
+<booleanAttribute key="automaticAdd" value="false"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="true"/>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/Metadata Generator CDT"/>
+<booleanAttribute key="default_auto_start" value="false"/>
+<intAttribute key="default_start_level" value="4"/>
+<booleanAttribute key="includeOptional" value="true"/>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-console&#13;&#10;-consolelog &#13;&#10;-application org.eclipse.equinox.prov.metadata.generator.EclipseGenerator&#13;&#10;-metadataRepository file:c:/temp/equinox.prov/servers/CDTmetadataRepository/ &#13;&#10;-artifactRepository file:c:/temp/equinox.prov/servers/CDTartifactRepository/ &#13;&#10;-source c:/eclipse/CDT4.0 &#13;&#10;-root cdt&#13;&#10;-flavor tooling&#13;&#10;-publishArtifacts"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Declipse.prov.data.area=c:/temp/equinox.prov/agent/ &#13;&#10;-Declipse.prov.metadataRepository=file:c:/temp/equinox.prov/servers/CDTmetadataRepository/ &#13;&#10;-Declipse.prov.artifactRepository=file:c:/temp/equinox.prov/servers/artifactRepository/&#13;&#10;-Declipse.ignoreApp=false&#13;&#10;-Declipse.application.registerDescriptors=true &#13;&#10;-Declipse.application=org.eclipse.equinox.prov.metadata.generator.EclipseGenerator&#13;&#10;-Declipse.prov.metadataGenerator.eclipseBase=c:/eclipse/CDT4.0/&#13;&#10;-Declipse.prov.rootIUId=cdt &#13;&#10;-Declipse.prov.configurationFlavor=tooling&#13;&#10;-Declipse.prov.appendToRepo=true &#13;&#10;-Declipse.prov.generateArtifacts=true"/>
+<stringAttribute key="target_bundles" value="org.eclipse.core.jobs@default:default,org.eclipse.equinox.app@default:true,org.eclipse.equinox.common@default:default,org.eclipse.equinox.launcher@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.osgi@:,org.eclipse.osgi.services@default:default"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useDefaultConfigArea" value="true"/>
+<stringAttribute key="vminstall" value="jdk"/>
+<stringAttribute key="workspace_bundles" value="com.thoughtworks.xstream@default:default,org.eclipse.ecf@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.equinox.frameworkadmin@default:default,org.eclipse.equinox.frameworkadmin.equinox@default:true,org.eclipse.equinox.prov.artifact.repository@default:default,org.eclipse.equinox.prov.core@default:default,org.eclipse.equinox.prov.download@default:default,org.eclipse.equinox.prov.engine@default:default,org.eclipse.equinox.prov.metadata@default:default,org.eclipse.equinox.prov.metadata.generator@default:default,org.eclipse.equinox.prov.metadata.repository@default:default"/>
+</launchConfiguration>
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/Metadata Generator SDK.launch b/bundles/org.eclipse.equinox.p2.metadata.generator/Metadata Generator SDK.launch
new file mode 100644
index 000000000..23d6ab8c9
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.generator/Metadata Generator SDK.launch
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.pde.ui.EquinoxLauncher">
+<booleanAttribute key="append.args" value="true"/>
+<booleanAttribute key="automaticAdd" value="false"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="false"/>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/Metadata Generator SDK"/>
+<booleanAttribute key="default_auto_start" value="false"/>
+<intAttribute key="default_start_level" value="4"/>
+<booleanAttribute key="includeOptional" value="false"/>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-console &#13;&#10;-consolelog &#13;&#10;-application org.eclipse.equinox.prov.metadata.generator.EclipseGenerator&#13;&#10;-metadataRepository file:d:/tmp/equinox.prov/servers/metadataRepository/ &#13;&#10;-artifactRepository file:d:/tmp/equinox.prov/servers/artifactRepository/ &#13;&#10;-source d:/3.3/eclipse&#13;&#10;-root sdk&#13;&#10;-rootVersion 3.3.0&#13;&#10;-flavor tooling&#13;&#10;-publishArtifacts&#13;&#10;-append"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<stringAttribute key="target_bundles" value="org.eclipse.core.contenttype@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.runtime@default:default,org.eclipse.core.runtime.compatibility.registry@default:default,org.eclipse.equinox.app@default:true,org.eclipse.equinox.common@default:default,org.eclipse.equinox.launcher@default:default,org.eclipse.equinox.launcher.win32.win32.x86@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.osgi@:,org.eclipse.osgi.services@default:default,org.eclipse.update.configurator@default:default"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useDefaultConfigArea" value="true"/>
+<stringAttribute key="vminstall" value="jre1.6.0"/>
+<stringAttribute key="workspace_bundles" value="com.thoughtworks.xstream@default:default,org.eclipse.ecf@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.equinox.frameworkadmin@default:default,org.eclipse.equinox.frameworkadmin.equinox@default:true,org.eclipse.equinox.prov.artifact.repository@default:default,org.eclipse.equinox.prov.core@default:default,org.eclipse.equinox.prov.download@default:default,org.eclipse.equinox.prov.engine@default:default,org.eclipse.equinox.prov.metadata@default:default,org.eclipse.equinox.prov.metadata.generator@default:default,org.eclipse.equinox.prov.metadata.repository@default:default"/>
+</launchConfiguration>
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/OSGi_Minimum-1.0.profile b/bundles/org.eclipse.equinox.p2.metadata.generator/OSGi_Minimum-1.0.profile
new file mode 100644
index 000000000..d8c2d3fdf
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.generator/OSGi_Minimum-1.0.profile
@@ -0,0 +1,17 @@
+###############################################################################
+# Copyright (c) 2003, 2005 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+org.osgi.framework.system.packages =
+org.osgi.framework.bootdelegation = \
+ sun.*,\
+ com.sun.*
+org.osgi.framework.executionenvironment = \
+ OSGi/Minimum-1.0
+osgi.java.profile.name = OSGi/Minimum-1.0
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/OSGi_Minimum-1.1.profile b/bundles/org.eclipse.equinox.p2.metadata.generator/OSGi_Minimum-1.1.profile
new file mode 100644
index 000000000..2d8b661a6
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.generator/OSGi_Minimum-1.1.profile
@@ -0,0 +1,18 @@
+###############################################################################
+# Copyright (c) 2003, 2005 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+org.osgi.framework.system.packages =
+org.osgi.framework.bootdelegation = \
+ sun.*,\
+ com.sun.*
+org.osgi.framework.executionenvironment = \
+ OSGi/Minimum-1.0,\
+ OSGi/Minimum-1.1
+osgi.java.profile.name = OSGi/Minimum-1.1
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/about.html b/bundles/org.eclipse.equinox.p2.metadata.generator/about.html
new file mode 100644
index 000000000..460233046
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.generator/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 2, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/build.properties b/bundles/org.eclipse.equinox.p2.metadata.generator/build.properties
new file mode 100644
index 000000000..5ec9256f4
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.generator/build.properties
@@ -0,0 +1,26 @@
+###############################################################################
+# Copyright (c) 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html,\
+ OSGi_Minimum-1.1.profile,\
+ OSGi_Minimum-1.0.profile,\
+ JavaSE-1.6.profile,\
+ JRE-1.1.profile,\
+ J2SE-1.5.profile,\
+ J2SE-1.4.profile,\
+ J2SE-1.3.profile,\
+ J2SE-1.2.profile,\
+ CDC-1.1_Foundation-1.1.profile,\
+ CDC-1.0_Foundation-1.0.profile,\
+ plugin.xml
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/config.ini b/bundles/org.eclipse.equinox.p2.metadata.generator/config.ini
new file mode 100644
index 000000000..ec1329813
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.generator/config.ini
@@ -0,0 +1,57 @@
+# Eclipse runtime configuration file
+# This file contains a number of key/value pairs that are merged into the
+# System properties on system startup. The values control the way the
+# runtime is structured and runs.
+
+# Note: Only platform:/base/ and file: URLs are supported. In general the
+# URLs given may include a version number (e.g., .../location_1.2.3).
+# If a version is not specified, the system binds
+# to the location which matches exactly or to the versioned location with the
+# latest version number. If a version number is given then only exact matches
+# are considered.
+
+# The URL for the runtime entry point. The default value is
+# platform:/base/plugins/org.eclipse.osgi
+#osgi.framework=platform:/base/plugins/org.eclipse.osgi
+
+# The classpath for the framework found at the osgi.framework location. This
+# comma-separated list contains either URLs or simple element names. Simple
+# names are assumed to be relative to the framework's install directory.
+# Typically this value need not be set as it is initialized by the framework itself.
+# Version match searching is not done for URLs listed here.
+#osgi.frameworkClassPath =
+
+# The comma-separated list of locations to search for the splash screen file (splash.bmp).
+# For each list element a subdirectory structure based on the pattern nl/<locale> is searched.
+# The system binds to the first matching file. There is no default value.
+#osgi.splashPath=
+
+# The location of the splash screen file. If this value is set at system startup it is used
+# in favour of the osgi.splashPath searching outlined above. If the value is not set
+# the searching is done and this key is bound to the result of the search.
+#osgi.splashLocation =
+
+# The comma-separated list of bundles which are automatically installed and optionally started
+# once the system is up and running. Each entry if of the form
+# <URL | simple bundle location>[@ [<startlevel>] [":start"]]
+# If the startlevel is omitted then the framework will use the default start level for the bundle.
+# If the "start" tag is added then the bundle will be marked as started after being installed.
+# Simple bundle locations are interepreted as relative to the framework's parent directory.
+# The startlevel indicates the OSGi start level at which the bundle should run.
+osgi.bundles=org.eclipse.equinox.common@2:start, org.eclipse.update.configurator@3:start, org.eclipse.core.runtime@start,org.eclipse.equinox.frameworkadmin.equinox@start
+
+# The product to run. A given Eclipse configuration may contain many products.
+# The product identified will supply the branding (window icons, title bar text) etc
+# as well as define the default application to run.
+#eclipse.product=
+
+# The application to run. The value specified here is the id of the application extension
+# the runtime will find, instantiate and execute once the system is up. Note that typically
+# the identified eclipse.product defines the default application to run.
+#eclipse.application=
+
+# The build identifier
+eclipse.buildId=@build@
+
+# End of file marker - must be here
+eof=eof \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/generator.product b/bundles/org.eclipse.equinox.p2.metadata.generator/generator.product
new file mode 100644
index 000000000..714a2b139
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.generator/generator.product
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?pde version="3.1"?>
+
+<product name="Equinox Provisioning Metadata Generator" id="org.eclipse.equinox.prov.metadata.generator.product" application="org.eclipse.equinox.prov.metadata.generator.EclipseGenerator" useFeatures="true">
+
+ <configIni use="custom" path="/org.eclipse.equinox.prov.metadata.generator/config.ini"/>
+
+ <launcherArgs>
+ <vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts</vmArgsMac>
+ </launcherArgs>
+
+ <launcher name="eclipse">
+ <solaris/>
+ <win useIco="false">
+ <bmp/>
+ </win>
+ </launcher>
+
+ <vm>
+ </vm>
+
+ <plugins>
+ </plugins>
+
+ <features>
+ <feature id="org.eclipse.equinox.prov.generator.feature" version="0.0.0"/>
+ <feature id="org.eclipse.rcp" version="0.0.0"/>
+ </features>
+
+</product>
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/plugin.xml b/bundles/org.eclipse.equinox.p2.metadata.generator/plugin.xml
new file mode 100644
index 000000000..f8ff83d03
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.generator/plugin.xml
@@ -0,0 +1,22 @@
+<plugin>
+ <extension
+ id="EclipseGenerator"
+ point="org.eclipse.core.runtime.applications">
+ <application
+ cardinality="1"
+ thread="main"
+ visible="true">
+ <run
+ class="org.eclipse.equinox.internal.prov.metadata.generator.EclipseGeneratorApplication">
+ </run>
+ </application>
+ </extension>
+ <extension
+ id="product"
+ point="org.eclipse.core.runtime.products">
+ <product
+ application="org.eclipse.equinox.prov.metadata.generator.EclipseGenerator"
+ name="Equinox Provisioning Metadata Generator">
+ </product>
+ </extension>
+</plugin>
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/prov/metadata/generator/Activator.java b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/prov/metadata/generator/Activator.java
new file mode 100644
index 000000000..d6799e045
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/prov/metadata/generator/Activator.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.metadata.generator;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+ public static BundleContext context = null;
+ public static String ID = "org.eclipse.equinox.prov.metadata.generator";
+
+ public static BundleContext getContext() {
+ return context;
+ }
+
+ public void start(BundleContext context) throws Exception {
+ Activator.context = context;
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ Activator.context = null;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/prov/metadata/generator/EclipseGeneratorApplication.java b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/prov/metadata/generator/EclipseGeneratorApplication.java
new file mode 100644
index 000000000..0f43eda25
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/prov/metadata/generator/EclipseGeneratorApplication.java
@@ -0,0 +1,295 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.metadata.generator;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Map;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.equinox.app.IApplication;
+import org.eclipse.equinox.app.IApplicationContext;
+import org.eclipse.equinox.internal.prov.artifact.repository.ArtifactRepositoryManager;
+import org.eclipse.equinox.internal.prov.metadata.repository.MetadataRepositoryManager;
+import org.eclipse.equinox.prov.artifact.repository.*;
+import org.eclipse.equinox.prov.core.eventbus.ProvisioningEventBus;
+import org.eclipse.equinox.prov.core.helpers.ServiceHelper;
+import org.eclipse.equinox.prov.metadata.generator.EclipseInstallGeneratorInfoProvider;
+import org.eclipse.equinox.prov.metadata.generator.Generator;
+import org.eclipse.equinox.prov.metadata.repository.*;
+import org.osgi.framework.ServiceRegistration;
+
+public class EclipseGeneratorApplication implements IApplication {
+
+ // The mapping rules for in-place generation need to construct paths into the structure
+ // of an eclipse installation; in the future the default artifact mapping declared in
+ // SimpleArtifactRepository may change, for example, to not have a 'bundles' directory
+ // instead of a 'plugins' directory, so a separate constant is defined and used here.
+ static final private String[][] INPLACE_MAPPING_RULES = { {"(& (namespace=eclipse) (classifier=feature))", "${repoUrl}/features/${id}_${version}.jar"}, //$NON-NLS-1$//$NON-NLS-2$
+ {"(& (namespace=eclipse) (classifier=plugin))", "${repoUrl}/plugins/${id}_${version}.jar"}, //$NON-NLS-1$//$NON-NLS-2$
+ {"(& (namespace=eclipse) (classifier=native))", "${repoUrl}/native/${id}_${version}"}}; //$NON-NLS-1$//$NON-NLS-2$
+
+ private ArtifactRepositoryManager defaultArtifactManager;
+ private ServiceRegistration registrationDefaultArtifactManager;
+ private MetadataRepositoryManager defaultMetadataManager;
+ private ServiceRegistration registrationDefaultMetadataManager;
+ private ProvisioningEventBus bus;
+ private ServiceRegistration registrationBus;
+ private String metadataLocation;
+ private String artifactLocation;
+ private String operation;
+ private String argument;
+ private String features;
+ private String bundles;
+ private String base;
+
+ private void registerDefaultMetadataRepoManager() {
+ if (ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.class.getName()) == null) {
+ defaultMetadataManager = new MetadataRepositoryManager();
+ registrationDefaultMetadataManager = Activator.getContext().registerService(IMetadataRepositoryManager.class.getName(), defaultMetadataManager, null);
+ }
+ }
+
+ private void registerDefaultArtifactRepoManager() {
+ if (ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.class.getName()) == null) {
+ defaultArtifactManager = new ArtifactRepositoryManager();
+ registrationDefaultArtifactManager = Activator.getContext().registerService(IArtifactRepositoryManager.class.getName(), defaultArtifactManager, null);
+ }
+ }
+
+ private void registerEventBus() {
+ if (ServiceHelper.getService(Activator.getContext(), ProvisioningEventBus.class.getName()) == null) {
+ bus = new ProvisioningEventBus();
+ registrationBus = Activator.getContext().registerService(ProvisioningEventBus.class.getName(), bus, null);
+ }
+ }
+
+ public Object start(IApplicationContext context) throws Exception {
+ registerEventBus();
+ registerDefaultMetadataRepoManager();
+ registerDefaultArtifactRepoManager();
+ EclipseInstallGeneratorInfoProvider provider = new EclipseInstallGeneratorInfoProvider();
+ Map args = context.getArguments();
+ processCommandLineArguments((String[]) args.get("application.args"), provider);
+ initialize(provider);
+
+ if (provider.getBaseLocation() == null) {
+ System.out.println("Eclipse base location not specified");
+ String[] a = (String[]) args.get("application.args");
+ for (int i = 0; i < a.length; i++)
+ System.out.println(a[i]);
+ return IApplication.EXIT_OK;
+ }
+ System.out.println("Generating metadata for " + provider.getBaseLocation());
+
+ IStatus result = new Generator(provider).generate();
+
+ if (result.isOK()) {
+ System.out.println("Generation completed with success");
+ return IApplication.EXIT_OK;
+ }
+ System.out.println(result);
+ return new Integer(1);
+ }
+
+ private void initialize(EclipseInstallGeneratorInfoProvider provider) {
+ if ("-source".equalsIgnoreCase(operation))
+ provider.initialize(new File(argument));
+ else if ("-inplace".equalsIgnoreCase(operation)) {
+ provider.initialize(new File(argument));
+ initializeForInplace(provider);
+ } else if ("-config".equalsIgnoreCase(operation)) {
+ provider.initialize(new File(argument), new File(argument, "configuration"), getExecutableName(argument, provider), null, null);
+ } else if ("-updateSite".equalsIgnoreCase(operation)) {
+ provider.setAddDefaultIUs(false);
+ provider.initialize(new File(argument), null, null, new File[] {new File(argument, "plugins")}, new File(argument, "features"));
+ initializeForInplace(provider);
+ } else {
+ if (base != null && bundles != null && features != null)
+ provider.initialize(new File(base), null, null, new File[] {new File(bundles)}, new File(features));
+ }
+ initializeRepositories(provider);
+ }
+
+ private File getExecutableName(String base, EclipseInstallGeneratorInfoProvider provider) {
+ File location = provider.getExecutableLocation();
+ if (location == null)
+ return new File(base, EclipseInstallGeneratorInfoProvider.getDefaultExecutableName());
+ if (location.isAbsolute())
+ return location;
+ return new File(base, location.getPath());
+ }
+
+ private void initializeRepositories(EclipseInstallGeneratorInfoProvider provider) {
+ initializeArtifactRepository(provider);
+ initializeMetadataRepository(provider);
+ }
+
+ public void initializeForInplace(EclipseInstallGeneratorInfoProvider provider) {
+ File location = provider.getBaseLocation();
+ if (location == null)
+ location = provider.getBundleLocations()[0];
+ try {
+ metadataLocation = location.toURL().toExternalForm();
+ artifactLocation = location.toURL().toExternalForm();
+ } catch (MalformedURLException e) {
+ // ought not happen...
+ }
+ provider.setPublishArtifactRepository(true);
+ provider.setPublishArtifacts(false);
+ provider.setMappingRules(INPLACE_MAPPING_RULES);
+ }
+
+ public void processCommandLineArguments(String[] args, EclipseInstallGeneratorInfoProvider provider) throws Exception {
+ if (args == null)
+ return;
+ for (int i = 0; i < args.length; i++) {
+ // check for args without parameters (i.e., a flag arg)
+
+ if (args[i].equalsIgnoreCase("-publishArtifacts") || args[i].equalsIgnoreCase("-pa"))
+ provider.setPublishArtifacts(true);
+
+ if (args[i].equalsIgnoreCase("-publishArtifactRepository") || args[i].equalsIgnoreCase("-par"))
+ provider.setPublishArtifactRepository(true);
+
+ if (args[i].equalsIgnoreCase("-append"))
+ provider.setAppend(true);
+
+ if (args[i].equalsIgnoreCase("-noDefaultIUs"))
+ provider.setAddDefaultIUs(false);
+
+ // check for args with parameters. If we are at the last argument or if the next one
+ // has a '-' as the first character, then we can't have an arg with a parm so continue.
+ if (i == args.length - 1 || args[i + 1].startsWith("-")) //$NON-NLS-1$
+ continue;
+ String arg = args[++i];
+
+ if (args[i - 1].equalsIgnoreCase("-source")) {
+ operation = args[i - 1];
+ argument = arg;
+ }
+
+ if (args[i - 1].equalsIgnoreCase("-inplace")) {
+ operation = args[i - 1];
+ argument = arg;
+ }
+
+ if (args[i - 1].equalsIgnoreCase("-config")) {
+ operation = args[i - 1];
+ argument = arg;
+ }
+ if (args[i - 1].equalsIgnoreCase("-updateSite")) {
+ operation = args[i - 1];
+ argument = arg;
+ }
+
+ if (args[i - 1].equalsIgnoreCase("-exe"))
+ provider.setExecutableLocation(arg);
+
+ if (args[i - 1].equalsIgnoreCase("-metadataRepository") || args[i - 1].equalsIgnoreCase("-mr"))
+ metadataLocation = arg;
+
+ if (args[i - 1].equalsIgnoreCase("-artifactRepository") | args[i - 1].equalsIgnoreCase("-ar"))
+ artifactLocation = arg;
+
+ if (args[i - 1].equalsIgnoreCase("-flavor"))
+ provider.setFlavor(arg);
+
+ if (args[i - 1].equalsIgnoreCase("-features"))
+ features = arg;
+
+ if (args[i - 1].equalsIgnoreCase("-bundles"))
+ bundles = arg;
+
+ if (args[i - 1].equalsIgnoreCase("-base"))
+ base = arg;
+
+ if (args[i - 1].equalsIgnoreCase("-root"))
+ provider.setRootId(arg);
+
+ if (args[i - 1].equalsIgnoreCase("-rootVersion"))
+ provider.setRootVersion(arg);
+
+ if (args[i - 1].equalsIgnoreCase("-prov.os"))
+ provider.setOS(arg);
+ }
+ }
+
+ private void initializeArtifactRepository(EclipseInstallGeneratorInfoProvider provider) {
+ IArtifactRepositoryManager manager = (IArtifactRepositoryManager) ServiceHelper.getService(Activator.context, IArtifactRepositoryManager.class.getName());
+ URL location;
+ try {
+ location = new URL(artifactLocation);
+ } catch (MalformedURLException e) {
+ throw new IllegalArgumentException("Artifact repository location not a valid URL:" + artifactLocation); //$NON-NLS-1$
+ }
+ IArtifactRepository repository = manager.loadRepository(location, null);
+ if (repository != null) {
+ IWritableArtifactRepository result = (IWritableArtifactRepository) repository.getAdapter(IWritableArtifactRepository.class);
+ if (result == null)
+ throw new IllegalArgumentException("Artifact repository not writeable: " + location); //$NON-NLS-1$
+ provider.setArtifactRepository(result);
+ if (!provider.append())
+ result.removeAll();
+ return;
+ }
+
+ // the given repo location is not an existing repo so we have to create something
+ // TODO for now create a Simple repo by default.
+ String repositoryName = artifactLocation + " - artifacts"; //$NON-NLS-1$
+ IWritableArtifactRepository result = (IWritableArtifactRepository) manager.createRepository(location, repositoryName, "org.eclipse.equinox.prov.artifact.repository.simpleRepository"); //$NON-NLS-1$
+ if (result != null)
+ provider.setArtifactRepository(result);
+ }
+
+ private void initializeMetadataRepository(EclipseInstallGeneratorInfoProvider provider) {
+ URL location;
+ try {
+ location = new URL(metadataLocation);
+ } catch (MalformedURLException e) {
+ throw new IllegalArgumentException("Metadata repository location not a valid URL:" + artifactLocation); //$NON-NLS-1$
+ }
+ IMetadataRepositoryManager manager = (IMetadataRepositoryManager) ServiceHelper.getService(Activator.context, IMetadataRepositoryManager.class.getName());
+ IMetadataRepository repository = manager.loadRepository(location, null);
+ if (repository != null) {
+ IWritableMetadataRepository result = (IWritableMetadataRepository) repository.getAdapter(IWritableMetadataRepository.class);
+ if (result == null)
+ throw new IllegalArgumentException("Metadata repository not writeable: " + location); //$NON-NLS-1$
+ provider.setMetadataRepository(result);
+ if (!provider.append())
+ result.removeAll();
+ return;
+ }
+
+ // the given repo location is not an existing repo so we have to create something
+ // TODO for now create a random repo by default.
+ String repositoryName = metadataLocation + " - metadata"; //$NON-NLS-1$
+ IWritableMetadataRepository result = (IWritableMetadataRepository) manager.createRepository(location, repositoryName, "org.eclipse.equinox.prov.metadata.repository.simpleRepository"); //$NON-NLS-1$
+ if (result != null)
+ provider.setMetadataRepository(result);
+ }
+
+ public void stop() {
+ if (registrationDefaultMetadataManager != null) {
+ registrationDefaultMetadataManager.unregister();
+ registrationDefaultMetadataManager = null;
+ }
+ if (registrationDefaultArtifactManager != null) {
+ registrationDefaultArtifactManager.unregister();
+ registrationDefaultArtifactManager = null;
+ }
+ if (registrationBus != null) {
+ registrationBus.unregister();
+ registrationBus = null;
+ }
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/prov/metadata/generator/features/FeatureParser.java b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/prov/metadata/generator/features/FeatureParser.java
new file mode 100644
index 000000000..8ef5249d5
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/prov/metadata/generator/features/FeatureParser.java
@@ -0,0 +1,238 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.metadata.generator.features;
+
+import java.io.*;
+import java.net.URL;
+import javax.xml.parsers.*;
+import org.eclipse.equinox.prov.metadata.generator.Feature;
+import org.eclipse.equinox.prov.metadata.generator.FeatureEntry;
+import org.eclipse.osgi.util.NLS;
+import org.xml.sax.*;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * Default feature parser.
+ * Parses the feature manifest file as defined by the platform.
+ *
+ * @since 3.0
+ */
+public class FeatureParser extends DefaultHandler {
+
+ private SAXParser parser;
+ private Feature result;
+ private URL url;
+ private StringBuffer characters = null;
+
+ private final static SAXParserFactory parserFactory = SAXParserFactory.newInstance();
+
+ public FeatureParser() {
+ super();
+ try {
+ parserFactory.setNamespaceAware(true);
+ this.parser = parserFactory.newSAXParser();
+ } catch (ParserConfigurationException e) {
+ System.out.println(e);
+ } catch (SAXException e) {
+ System.out.println(e);
+ }
+ }
+
+ /**
+ * Parses the specified url and constructs a feature
+ */
+ public Feature parse(URL featureURL) {
+ result = null;
+ InputStream in = null;
+ try {
+ url = featureURL;
+ in = featureURL.openStream();
+ parser.parse(new InputSource(in), this);
+ } catch (SAXException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } finally {
+ if (in != null)
+ try {
+ in.close();
+ } catch (IOException e1) {
+ // Utils.log(e1.getLocalizedMessage());
+ }
+ }
+ return result;
+ }
+
+ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+ // Utils.debug("Start Element: uri:" + uri + " local Name:" + localName + " qName:" + qName); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ if ("plugin".equals(localName)) { //$NON-NLS-1$
+ processPlugin(attributes);
+ } else if ("description".equals(localName)) { //$NON-NLS-1$
+ processDescription(attributes);
+ } else if ("license".equals(localName)) { //$NON-NLS-1$
+ processLicense(attributes);
+ } else if ("copyright".equals(localName)) { //$NON-NLS-1$
+ processCopyright(attributes);
+ } else if ("feature".equals(localName)) { //$NON-NLS-1$
+ processFeature(attributes);
+ } else if ("import".equals(localName)) { //$NON-NLS-1$
+ processImport(attributes);
+ } else if ("includes".equals(localName)) { //$NON-NLS-1$
+ processIncludes(attributes);
+ } else if ("install-handler".equals(localName)) { //$NON-NLS-1$
+ processInstallHandler(attributes);
+ } else if ("update".equals(localName)) { //$NON-NLS-1$
+ processUpdateSite(attributes);
+ } else if ("discovery".equals(localName)) { //$NON-NLS-1$
+ processDiscoverySite(attributes);
+ }
+ }
+
+ private void processImport(Attributes attributes) {
+ String id = attributes.getValue("feature"); //$NON-NLS-1$
+ FeatureEntry entry = null;
+ if (id != null) {
+ entry = FeatureEntry.createRequires(id, attributes.getValue("version"), attributes.getValue("match"), attributes.getValue("filter"), false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ } else {
+ id = attributes.getValue("plugin"); //$NON-NLS-1$
+ entry = FeatureEntry.createRequires(id, attributes.getValue("version"), attributes.getValue("match"), attributes.getValue("filter"), true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ result.addEntry(entry);
+ }
+
+ private void processIncludes(Attributes attributes) {
+ FeatureEntry entry = new FeatureEntry(attributes.getValue("id"), attributes.getValue("version"), false); //$NON-NLS-1$ //$NON-NLS-2$
+ String flag = attributes.getValue("unpack"); //$NON-NLS-1$
+ if (flag != null)
+ entry.setOptional(Boolean.valueOf(flag).booleanValue());
+ setEnvironment(attributes, entry);
+ result.addEntry(entry);
+ }
+
+ private void processInstallHandler(Attributes attributes) {
+ result.setInstallHandler(attributes.getValue("handler")); //$NON-NLS-1$
+ result.setInstallHandlerLibrary(attributes.getValue("library")); //$NON-NLS-1$
+ result.setInstallHandlerURL(attributes.getValue("url")); //$NON-NLS-1$
+ }
+
+ private void processUpdateSite(Attributes attributes) {
+ result.setUpdateSiteLabel(attributes.getValue("label")); //$NON-NLS-1$
+ result.setUpdateSiteURL(attributes.getValue("url")); //$NON-NLS-1$
+ }
+
+ private void processDiscoverySite(Attributes attributes) {
+ result.addDiscoverySite(attributes.getValue("url"), attributes.getValue("label")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ private void setEnvironment(Attributes attributes, FeatureEntry entry) {
+ String os = attributes.getValue("os"); //$NON-NLS-1$
+ String ws = attributes.getValue("ws"); //$NON-NLS-1$
+ String nl = attributes.getValue("nl"); //$NON-NLS-1$
+ String arch = attributes.getValue("arch"); //$NON-NLS-1$
+ entry.setEnvironment(os, ws, arch, nl);
+ }
+
+ protected Feature createFeature(String id, String version) {
+ return new Feature(id, version);
+ }
+
+ protected void processFeature(Attributes attributes) {
+ String id = attributes.getValue("id"); //$NON-NLS-1$
+ String ver = attributes.getValue("version"); //$NON-NLS-1$
+
+ if (id == null || id.trim().equals("") //$NON-NLS-1$
+ || ver == null || ver.trim().equals("")) { //$NON-NLS-1$
+ // System.out.println(NLS.bind(Messages.FeatureParser_IdOrVersionInvalid, (new String[] { id, ver})));
+ } else {
+ result = createFeature(id, ver);
+
+ String os = attributes.getValue("os"); //$NON-NLS-1$
+ String ws = attributes.getValue("ws"); //$NON-NLS-1$
+ String nl = attributes.getValue("nl"); //$NON-NLS-1$
+ String arch = attributes.getValue("arch"); //$NON-NLS-1$
+ result.setEnvironment(os, ws, arch, nl);
+
+ //TODO rootURLs
+ if ("file".equals(url.getProtocol())) { //$NON-NLS-1$
+ File f = new File(url.getFile().replace('/', File.separatorChar));
+ result.setURL("features" + "/" + f.getParentFile().getName() + "/");// + f.getName()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ } else {
+ // externalized URLs might be in relative form, ensure they are absolute
+ // feature.setURL(Utils.makeAbsolute(Utils.getInstallURL(), url).toExternalForm());
+ }
+
+ result.setProviderName(attributes.getValue("provider-name")); //$NON-NLS-1$
+ result.setLabel(attributes.getValue("label")); //$NON-NLS-1$
+ result.setImage(attributes.getValue("image")); //$NON-NLS-1$
+
+ // Utils.debug("End process DefaultFeature tag: id:" +id + " ver:" +ver + " url:" + feature.getURL()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ }
+
+ private void processPlugin(Attributes attributes) {
+ String id = attributes.getValue("id"); //$NON-NLS-1$
+ String version = attributes.getValue("version"); //$NON-NLS-1$
+
+ if (id == null || id.trim().equals("") || version == null || version.trim().equals("")) { //$NON-NLS-1$ //$NON-NLS-2$
+ System.out.println(NLS.bind("FeatureParser#processPlugin, ID {0} or version {1} invalid", (new String[] {id, version}))); //$NON-NLS-1$
+ } else {
+ FeatureEntry plugin = new FeatureEntry(id, version, true);
+ setEnvironment(attributes, plugin);
+ String unpack = attributes.getValue("unpack"); //$NON-NLS-1$
+ if (unpack != null)
+ plugin.setUnpack(Boolean.valueOf(unpack).booleanValue());
+ String fragment = attributes.getValue("fragment"); //$NON-NLS-1$
+ if (fragment != null)
+ plugin.setFragment(Boolean.valueOf(fragment).booleanValue());
+ String filter = attributes.getValue("filter"); //$NON-NLS-1$
+ if (filter != null)
+ plugin.setFilter(filter);
+ result.addEntry(plugin);
+
+ // Utils.debug("End process DefaultFeature tag: id:" + id + " ver:" + ver + " url:" + feature.getURL()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ }
+
+ private void processLicense(Attributes attributes) {
+ result.setLicenseURL(attributes.getValue("url")); //$NON-NLS-1$
+ characters = new StringBuffer();
+ }
+
+ private void processCopyright(Attributes attributes) {
+ result.setCopyrightURL(attributes.getValue("url")); //$NON-NLS-1$
+ characters = new StringBuffer();
+ }
+
+ private void processDescription(Attributes attributes) {
+ result.setDescriptionURL(attributes.getValue("url")); //$NON-NLS-1$
+ characters = new StringBuffer();
+ }
+
+ public void characters(char[] ch, int start, int length) throws SAXException {
+ if (characters == null)
+ return;
+ characters.append(ch, start, length);
+ }
+
+ public void endElement(String uri, String localName, String qName) throws SAXException {
+ if (characters != null)
+ return;
+ if ("description".equals(localName)) { //$NON-NLS-1$
+ result.setDescription(characters.toString().trim());
+ } else if ("license".equals(localName)) { //$NON-NLS-1$
+ result.setLicense(characters.toString().trim());
+ } else if ("copyright".equals(localName)) { //$NON-NLS-1$
+ result.setCopyright(characters.toString().trim());
+ }
+ characters = null;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/BundleDescriptionFactory.java b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/BundleDescriptionFactory.java
new file mode 100644
index 000000000..0f0c07611
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/BundleDescriptionFactory.java
@@ -0,0 +1,121 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.metadata.generator;
+
+import java.io.*;
+import java.util.*;
+import java.util.jar.*;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.osgi.service.resolver.*;
+import org.eclipse.osgi.util.ManifestElement;
+import org.osgi.framework.BundleException;
+
+public class BundleDescriptionFactory {
+ static final String DIR = "dir";
+ static final String JAR = "jar";
+ static String BUNDLE_FILE_KEY = "eclipse.prov.bundle.format";
+
+ StateObjectFactory factory;
+ State state;
+
+ public BundleDescriptionFactory(StateObjectFactory factory, State state) {
+ this.factory = factory;
+ this.state = state;
+ //TODO find a state and a factory when not provided
+ }
+
+ public BundleDescription getBundleDescription(File bundleLocation) {
+ Dictionary manifest = loadManifest(bundleLocation);
+ if (manifest == null)
+ return null;
+ return getBundleDescription(manifest, bundleLocation);
+ }
+
+ public BundleDescription getBundleDescription(InputStream manifestStream, File bundleLocation) {
+ Hashtable entries = new Hashtable();
+ try {
+ ManifestElement.parseBundleManifest(manifestStream, entries);
+ return getBundleDescription(entries, bundleLocation);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (BundleException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public Dictionary loadManifest(File bundleLocation) {
+ InputStream manifestStream = null;
+ ZipFile jarFile = null;
+ try {
+ if ("jar".equalsIgnoreCase(new Path(bundleLocation.getName()).getFileExtension()) && bundleLocation.isFile()) { //$NON-NLS-1$
+ jarFile = new ZipFile(bundleLocation, ZipFile.OPEN_READ);
+ ZipEntry manifestEntry = jarFile.getEntry(JarFile.MANIFEST_NAME);
+ if (manifestEntry != null) {
+ manifestStream = jarFile.getInputStream(manifestEntry);
+ }
+ } else {
+ manifestStream = new BufferedInputStream(new FileInputStream(new File(bundleLocation, JarFile.MANIFEST_NAME)));
+ }
+ } catch (IOException e) {
+ //ignore
+ }
+
+ if (manifestStream == null)
+ return null;
+ try {
+ Dictionary manifest = manifestToProperties(new Manifest(manifestStream).getMainAttributes());
+ // remember the format of the bundle as we found it
+ manifest.put(BUNDLE_FILE_KEY, bundleLocation.isDirectory() ? DIR : JAR);
+ return manifest;
+ } catch (IOException ioe) {
+ return null;
+ } finally {
+ try {
+ manifestStream.close();
+ } catch (IOException e1) {
+ //Ignore
+ }
+ try {
+ if (jarFile != null)
+ jarFile.close();
+ } catch (IOException e2) {
+ //Ignore
+ }
+ }
+ }
+
+ private Properties manifestToProperties(Attributes attributes) {
+ Properties result = new Properties();
+ for (Iterator i = attributes.keySet().iterator(); i.hasNext();) {
+ Attributes.Name key = (Attributes.Name) i.next();
+ result.put(key.toString(), attributes.get(key));
+ }
+ return result;
+ }
+
+ public BundleDescription getBundleDescription(Dictionary enhancedManifest, File bundleLocation) {
+ try {
+ BundleDescription descriptor = factory.createBundleDescription(state, enhancedManifest, bundleLocation != null ? bundleLocation.getAbsolutePath() : null, 1); //TODO Do we need to have a real bundle id
+ descriptor.setUserObject(enhancedManifest);
+ return descriptor;
+ } catch (BundleException e) {
+ // IStatus status = new Status(IStatus.WARNING, IPDEBuildConstants.PI_PDEBUILD, EXCEPTION_STATE_PROBLEM, NLS.bind(Messages.exception_stateAddition, enhancedManifest.get(Constants.BUNDLE_NAME)), e);
+ // BundleHelper.getDefault().getLog().log(status);
+ System.err.println("An error has occured while adding the bundle" + bundleLocation != null ? bundleLocation.getAbsoluteFile() : null);
+ return null;
+ }
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/EclipseInstallGeneratorInfoProvider.java b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/EclipseInstallGeneratorInfoProvider.java
new file mode 100644
index 000000000..4117eeda1
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/EclipseInstallGeneratorInfoProvider.java
@@ -0,0 +1,358 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.metadata.generator;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.*;
+import org.eclipse.equinox.frameworkadmin.*;
+import org.eclipse.equinox.internal.prov.metadata.generator.Activator;
+import org.eclipse.equinox.prov.artifact.repository.IWritableArtifactRepository;
+import org.eclipse.equinox.prov.core.helpers.ServiceHelper;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.metadata.InstallableUnit;
+import org.eclipse.equinox.prov.metadata.repository.IWritableMetadataRepository;
+import org.eclipse.osgi.service.environment.EnvironmentInfo;
+import org.osgi.framework.*;
+import org.osgi.util.tracker.ServiceTracker;
+
+public class EclipseInstallGeneratorInfoProvider implements IGeneratorInfo {
+ private static final String ORG_ECLIPSE_EQUINOX_SIMPLECONFIGURATOR = "org.eclipse.equinox.simpleconfigurator";
+
+ private final static String FILTER_OBJECTCLASS = "(" + Constants.OBJECTCLASS + "=" + FrameworkAdmin.class.getName() + ")";
+ private final static String filterFwName = "(" + FrameworkAdmin.SERVICE_PROP_KEY_FW_NAME + "=Equinox)";
+ //String filterFwVersion = "(" + FrameworkAdmin.SERVICE_PROP_KEY_FW_VERSION + "=" + props.getProperty("equinox.fw.version") + ")";
+ private final static String filterLauncherName = "(" + FrameworkAdmin.SERVICE_PROP_KEY_LAUNCHER_NAME + "=Eclipse.exe)";
+ //String filterLauncherVersion = "(" + FrameworkAdmin.SERVICE_PROP_KEY_LAUNCHER_VERSION + "=" + props.getProperty("equinox.launcher.version") + ")";
+ private final static String frameworkAdminFillter = "(&" + FILTER_OBJECTCLASS + filterFwName + filterLauncherName + ")";
+
+ private ServiceTracker frameworkAdminTracker;
+ private Manipulator manipulator;
+ private ArrayList defaultIUs;
+
+ private File baseLocation;
+ private File[] bundleLocations;
+ private File featuresLocation;
+ private File configLocation;
+ private File executableLocation;
+ private String flavor;
+ private String rootId;
+ private String rootVersion;
+ private boolean publishArtifacts = false;
+ private boolean publishArtifactRepo = false;
+ private boolean append = false;
+ private String[][] mappingRules;
+ private boolean addDefaultIUs = true;
+ private IWritableMetadataRepository metadataRepository;
+ private IWritableArtifactRepository artifactRepository;
+ private static String os;
+
+ public EclipseInstallGeneratorInfoProvider() {
+ super();
+ }
+
+ /**
+ * Returns a default name for the executable.
+ */
+ public static String getDefaultExecutableName() {
+ String theOS = os;
+ if (theOS == null) {
+ EnvironmentInfo info = (EnvironmentInfo) ServiceHelper.getService(Activator.getContext(), EnvironmentInfo.class.getName());
+ theOS = info.getOS();
+ }
+ if (theOS.equalsIgnoreCase("win32")) //$NON-NLS-1$
+ return "eclipse.exe"; //$NON-NLS-1$
+ //FIXME Is this a reasonable default for all non-Windows platforms?
+ return "eclipse"; //$NON-NLS-1$
+ }
+
+ public void initialize(File base) {
+ initialize(base, new File(base, "configuration"), new File(base, getDefaultExecutableName()), new File[] {new File(base, "plugins")}, new File(base, "features"));
+ }
+
+ public void initialize(File base, File config, File executable, File[] bundleLocations, File features) {
+ // TODO
+ if (base == null || !base.exists())
+ throw new RuntimeException("Source directory is invalid: " + base.getAbsolutePath());
+ this.baseLocation = base;
+ if (config == null || config.exists())
+ this.configLocation = config;
+ if (executable == null || executable.exists())
+ this.executableLocation = executable;
+ this.bundleLocations = bundleLocations;
+ this.featuresLocation = features;
+
+ expandBundleLocations();
+
+ // if the config or exe are not set then we cannot be generating any data related to the config so
+ // don't bother setting up the manipulator. In fact, the manipulator will likely be invalid without
+ // these locations.
+ if (configLocation == null || executableLocation == null)
+ return;
+
+ createFrameworkManipulator();
+
+ LauncherData launcherData = manipulator.getLauncherData();
+ launcherData.setFwPersistentDataLocation(configLocation, true);
+ launcherData.setLauncher(executableLocation);
+ try {
+ manipulator.load();
+ } catch (IllegalStateException e2) {
+ // TODO Auto-generated catch block
+ e2.printStackTrace();
+ } catch (FrameworkAdminRuntimeException e2) {
+ // TODO Auto-generated catch block
+ e2.printStackTrace();
+ } catch (IOException e2) {
+ // TODO Auto-generated catch block
+ e2.printStackTrace();
+ }
+ }
+
+ private void expandBundleLocations() {
+ ArrayList result = new ArrayList();
+ for (int i = 0; i < bundleLocations.length; i++) {
+ File location = bundleLocations[i];
+ if (location.isDirectory()) {
+ File[] list = location.listFiles();
+ for (int j = 0; j < list.length; j++)
+ result.add(list[j]);
+ } else {
+ result.add(location);
+ }
+ }
+ bundleLocations = (File[]) result.toArray(new File[result.size()]);
+ }
+
+ public ArrayList getDefaultIUs(Set ius) {
+ if (defaultIUs != null)
+ return defaultIUs;
+ defaultIUs = new ArrayList(5);
+ if (addDefaultIUs) {
+ defaultIUs.addAll(createLauncherBundleInfo(ius));
+ defaultIUs.add(createLauncher());
+ defaultIUs.add(createSimpleConfigurator());
+ // defaultIUs.add(createDefaultConfigurationBundleInfo());
+ // defaultIUs.add(createDefaultUnconfigurationBundleInfo());
+ }
+ return defaultIUs;
+ }
+
+ protected GeneratorBundleInfo createDefaultConfigurationBundleInfo() {
+ GeneratorBundleInfo result = new GeneratorBundleInfo();
+ result.setSymbolicName("defaultConfigure");
+ result.setVersion("1.0.0");
+ result.setStartLevel(4);
+ result.setSpecialConfigCommands("manipulator.getConfigData().addBundle(bundleToInstall);");
+ return result;
+ }
+
+ protected GeneratorBundleInfo createDefaultUnconfigurationBundleInfo() {
+ GeneratorBundleInfo result = new GeneratorBundleInfo();
+ result.setSymbolicName("defaultUnconfigure");
+ result.setVersion("1.0.0");
+ result.setSpecialConfigCommands("manipulator.getConfigData().removeBundle(bundleToRemove);");
+ return result;
+ }
+
+ /**
+ * Obtains the framework manipulator instance. Throws an exception
+ * if it could not be created.
+ */
+ private void createFrameworkManipulator() {
+ FrameworkAdmin admin = getFrameworkAdmin();
+ if (admin == null)
+ throw new RuntimeException("Framework admin service not found"); //$NON-NLS-1$
+ manipulator = admin.getManipulator();
+ if (manipulator == null)
+ throw new RuntimeException("Framework manipulator not found"); //$NON-NLS-1$
+ }
+
+ private FrameworkAdmin getFrameworkAdmin() {
+ if (frameworkAdminTracker == null) {
+ try {
+ Filter filter = Activator.getContext().createFilter(frameworkAdminFillter);
+ frameworkAdminTracker = new ServiceTracker(Activator.getContext(), filter, null);
+ frameworkAdminTracker.open();
+ } catch (InvalidSyntaxException e) {
+ // never happens
+ e.printStackTrace();
+ }
+ }
+ // try {
+ // frameworkAdminTracker.waitForService(500);
+ // } catch (InterruptedException e) {
+ // // ignore
+ // }
+ return (FrameworkAdmin) frameworkAdminTracker.getService();
+ }
+
+ public ConfigData getConfigData() {
+ return manipulator == null ? null : manipulator.getConfigData();
+ }
+
+ public LauncherData getLauncherData() {
+ return manipulator == null ? null : manipulator.getLauncherData();
+ }
+
+ private Collection createLauncherBundleInfo(Set ius) {
+ Collection result = new HashSet();
+ Collection launchers = getIUs(ius, "org.eclipse.equinox.launcher.");
+ for (Iterator iterator = launchers.iterator(); iterator.hasNext();) {
+ InstallableUnit object = (InstallableUnit) iterator.next();
+ GeneratorBundleInfo temp = new GeneratorBundleInfo();
+ temp.setSymbolicName(object.getId());
+ temp.setVersion(object.getVersion().toString());
+ temp.setSpecialConfigCommands("manipulator.getLauncherData().addProgramArg('--launcher.library');manipulator.getLauncherData().addProgramArg(artifact);");
+ result.add(temp);
+ }
+ return result;
+ }
+
+ private Collection getIUs(Set ius, String prefix) {
+ Set result = new HashSet();
+ for (Iterator iterator = ius.iterator(); iterator.hasNext();) {
+ IInstallableUnit tmp = (IInstallableUnit) iterator.next();
+ if (tmp.getId().startsWith(prefix))
+ result.add(tmp);
+ }
+ return result;
+ }
+
+ private GeneratorBundleInfo createLauncher() {
+ GeneratorBundleInfo result = new GeneratorBundleInfo();
+ result.setSymbolicName("org.eclipse.equinox.launcher");
+ result.setVersion("0.0.0");
+ //result.setSpecialConfigCommands("manipulator.addProgramArgument('-startup'); manipulator.addProgramArgument(artifact);");
+ result.setSpecialConfigCommands("manipulator.getLauncherData().addProgramArg('-startup');manipulator.getLauncherData().addProgramArg(artifact);");
+ return result;
+ }
+
+ private GeneratorBundleInfo createSimpleConfigurator() {
+ GeneratorBundleInfo result = new GeneratorBundleInfo();
+ result.setSymbolicName(ORG_ECLIPSE_EQUINOX_SIMPLECONFIGURATOR);
+ result.setVersion("0.0.0");
+ result.setStartLevel(1);
+ result.setMarkedAsStarted(true);
+ result.setSpecialConfigCommands("manipulator.getLauncherData().addJvmArg('-Dorg.eclipse.equinox.simpleconfigurator.useReference=true');");
+ return result;
+ }
+
+ public File getBaseLocation() {
+ return baseLocation;
+ }
+
+ public File[] getBundleLocations() {
+ return bundleLocations;
+ }
+
+ public File getFeaturesLocation() {
+ return featuresLocation;
+ }
+
+ public File getConfigurationLocation() {
+ return configLocation;
+ }
+
+ public File getExecutableLocation() {
+ return executableLocation;
+ }
+
+ public boolean publishArtifacts() {
+ return publishArtifacts;
+ }
+
+ public boolean addDefaultIUs() {
+ return addDefaultIUs;
+ }
+
+ public boolean publishArtifactRepository() {
+ return publishArtifactRepo;
+ }
+
+ public String getRootId() {
+ return rootId;
+ }
+
+ public String getRootVersion() {
+ if (rootVersion == null)
+ return "0.0.0"; //$NON-NLS-1$
+ return rootVersion;
+ }
+
+ public String getFlavor() {
+ return flavor;
+ }
+
+ public void setMetadataRepository(IWritableMetadataRepository value) {
+ metadataRepository = value;
+ }
+
+ public void setArtifactRepository(IWritableArtifactRepository value) {
+ artifactRepository = value;
+ }
+
+ public void setFlavor(String value) {
+ flavor = value;
+ }
+
+ public void setRootId(String value) {
+ rootId = value;
+ }
+
+ public void setRootVersion(String value) {
+ rootVersion = value;
+ }
+
+ public void setPublishArtifacts(boolean value) {
+ publishArtifacts = value;
+ }
+
+ public void setPublishArtifactRepository(boolean value) {
+ publishArtifactRepo = value;
+ }
+
+ public boolean append() {
+ return append;
+ }
+
+ public String[][] getMappingRules() {
+ return mappingRules;
+ }
+
+ public void setMappingRules(String[][] value) {
+ mappingRules = value;
+ }
+
+ public void setExecutableLocation(String value) {
+ executableLocation = new File(value);
+ }
+
+ public void setAppend(boolean value) {
+ append = value;
+ }
+
+ public void setAddDefaultIUs(boolean value) {
+ addDefaultIUs = value;
+ }
+
+ public IWritableArtifactRepository getArtifactRepository() {
+ return artifactRepository;
+ }
+
+ public IWritableMetadataRepository getMetadataRepository() {
+ return metadataRepository;
+ }
+
+ public void setOS(String os) {
+ this.os = os;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/Feature.java b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/Feature.java
new file mode 100644
index 000000000..289e1243c
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/Feature.java
@@ -0,0 +1,271 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.metadata.generator;
+
+import java.util.ArrayList;
+
+/**
+ *
+ * Feature information
+ */
+public class Feature implements IPlatformEntry {
+
+ private String id;
+ private String version;
+ private String label;
+ private String image;
+
+ private URLEntry description;
+ private URLEntry license;
+ private URLEntry copyright;
+
+ private String installHandler;
+ private String installHandlerURL;
+ private String installHandlerLibrary;
+
+ private URLEntry updateSite;
+ private ArrayList discoverySites;
+
+ private ArrayList entries;
+ private String name;
+ private String providerName;
+ private String os;
+ private String ws;
+ private String arch;
+ private String nl;
+
+ public Feature(String id, String version) {
+ if (id == null)
+ throw new IllegalArgumentException();
+ this.id = id;
+ this.version = version;
+ }
+
+ public void addEntry(FeatureEntry plugin) {
+ if (entries == null)
+ entries = new ArrayList();
+ entries.add(plugin);
+ }
+
+ public FeatureEntry[] getEntries() {
+ return (FeatureEntry[]) entries.toArray(new FeatureEntry[entries.size()]);
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void setImage(String image) {
+ this.image = image;
+ }
+
+ public String getImage() {
+ return image;
+ }
+
+ public void setDescription(String description) {
+ if (this.description == null)
+ this.description = new URLEntry();
+ this.description.setAnnotation(description);
+ }
+
+ public String getDescription() {
+ if (description != null)
+ return description.getAnnotation();
+ return null;
+ }
+
+ public String getDescriptionURL() {
+ if (description != null)
+ return description.getURL();
+ return null;
+ }
+
+ public void setDescriptionURL(String descriptionURL) {
+ if (this.description == null)
+ this.description = new URLEntry();
+ this.description.setURL(descriptionURL);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getProviderName() {
+ return providerName;
+ }
+
+ public void setProviderName(String value) {
+ providerName = value;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setLicenseURL(String licenseURL) {
+ if (this.license == null)
+ this.license = new URLEntry();
+ this.license.setURL(licenseURL);
+ }
+
+ public String getLicenseURL() {
+ if (license != null)
+ return license.getURL();
+ return null;
+ }
+
+ public void setLicense(String license) {
+ if (this.license == null)
+ this.license = new URLEntry();
+ this.license.setAnnotation(license);
+ }
+
+ public String getLicense() {
+ if (license != null)
+ return license.getAnnotation();
+ return null;
+ }
+
+ public void setCopyright(String copyright) {
+ if (this.copyright == null)
+ this.copyright = new URLEntry();
+ this.copyright.setAnnotation(copyright);
+ }
+
+ public void setCopyrightURL(String copyrightURL) {
+ if (this.copyright == null)
+ this.copyright = new URLEntry();
+ this.copyright.setURL(copyrightURL);
+ }
+
+ public String getCopyright() {
+ if (copyright != null)
+ return copyright.getAnnotation();
+ return null;
+ }
+
+ public String getCopyrightURL() {
+ if (copyright != null)
+ return copyright.getURL();
+ return null;
+ }
+
+ public void setInstallHandler(String installHandler) {
+ this.installHandler = installHandler;
+ }
+
+ public void setInstallHandlerLibrary(String installHandlerLibrary) {
+ this.installHandlerLibrary = installHandlerLibrary;
+ }
+
+ public void setInstallHandlerURL(String installHandlerURL) {
+ this.installHandlerURL = installHandlerURL;
+ }
+
+ public String getInstallHandler() {
+ return installHandler;
+ }
+
+ public String getInstallHandlerLibrary() {
+ return installHandlerLibrary;
+ }
+
+ public String getInstallHandlerURL() {
+ return installHandlerURL;
+ }
+
+ public void setUpdateSiteLabel(String updateSiteLabel) {
+ if (this.updateSite == null)
+ this.updateSite = new URLEntry();
+ this.updateSite.setAnnotation(updateSiteLabel);
+ }
+
+ public void setUpdateSiteURL(String updateSiteURL) {
+ if (this.updateSite == null)
+ this.updateSite = new URLEntry();
+ this.updateSite.setURL(updateSiteURL);
+ }
+
+ public String getUpdateSiteLabel() {
+ if (updateSite != null)
+ return updateSite.getAnnotation();
+ return null;
+ }
+
+ public String getUpdateSiteURL() {
+ if (updateSite != null)
+ return updateSite.getURL();
+ return null;
+ }
+
+ public void addDiscoverySite(String label, String url) {
+ if (label == null && url == null)
+ return;
+
+ if (this.discoverySites == null)
+ this.discoverySites = new ArrayList();
+
+ URLEntry entry = new URLEntry(url, label);
+ this.discoverySites.add(entry);
+ }
+
+ public URLEntry[] getDiscoverySites() {
+ if (discoverySites == null)
+ return new URLEntry[0];
+ return (URLEntry[]) discoverySites.toArray(new URLEntry[discoverySites.size()]);
+ }
+
+ public void setEnvironment(String os, String ws, String arch, String nl) {
+ this.os = os;
+ this.ws = ws;
+ this.arch = arch;
+ this.nl = nl;
+ }
+
+ public String getOS() {
+ return os;
+ }
+
+ public String getWS() {
+ return ws;
+ }
+
+ public String getArch() {
+ return arch;
+ }
+
+ public String getNL() {
+ return nl;
+ }
+
+ public void setURL(String value) {
+ }
+
+ /**
+ * For debugging purposes only.
+ */
+ public String toString() {
+ return "Feature " + id + " version: " + version; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/FeatureEntry.java b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/FeatureEntry.java
new file mode 100644
index 000000000..b7bdfd373
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/FeatureEntry.java
@@ -0,0 +1,175 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2007 IBM Corporation and others. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.metadata.generator;
+
+/**
+ */
+public class FeatureEntry implements IPlatformEntry {
+ private String id;
+ private String version;
+ private String url;
+ private String os;
+ private String ws;
+ private String arch;
+ private String nl;
+ private String match;
+ private boolean isPlugin;
+ private boolean isFragment = false;
+ private boolean isRequires = false;
+ private boolean unpack = true;
+ private boolean optional = false;
+
+ /**
+ * Temporary field to add provisioning filters to features
+ */
+ private String filter;
+
+ public static FeatureEntry createRequires(String id, String version, String match, String filter, boolean isPlugin) {
+ FeatureEntry result = new FeatureEntry(id, version, isPlugin);
+ result.match = match;
+ result.isRequires = true;
+ if (filter != null)
+ result.setFilter(filter);
+ return result;
+ }
+
+ public FeatureEntry(String id, String version, boolean isPlugin) {
+ this.id = id;
+ this.version = version;
+ this.isPlugin = isPlugin;
+ }
+
+ public String getURL() {
+ return url;
+ }
+
+ public void setURL(String value) {
+ url = value;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public boolean isPlugin() {
+ return isPlugin;
+ }
+
+ public boolean isRequires() {
+ return isRequires;
+ }
+
+ public boolean isFragment() {
+ return isFragment;
+ }
+
+ public String toString() {
+ StringBuffer result = new StringBuffer();
+
+ result.append(isPlugin ? "Plugin: " : "Feature: "); //$NON-NLS-1$
+ result.append(id != null ? id.toString() : ""); //$NON-NLS-1$
+ result.append(version != null ? " " + version.toString() : ""); //$NON-NLS-1$ //$NON-NLS-2$
+ return result.toString();
+ }
+
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((id == null) ? 0 : id.hashCode());
+ result = prime * result + ((version == null) ? 0 : version.hashCode());
+ return result;
+ }
+
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ final FeatureEntry other = (FeatureEntry) obj;
+ if (id == null) {
+ if (other.id != null)
+ return false;
+ } else if (!id.equals(other.id))
+ return false;
+ if (version == null) {
+ if (other.version != null)
+ return false;
+ } else if (!version.equals(other.version))
+ return false;
+ return true;
+ }
+
+ public void setEnvironment(String os, String ws, String arch, String nl) {
+ this.os = os;
+ this.ws = ws;
+ this.arch = arch;
+ this.nl = nl;
+ }
+
+ public void setFragment(boolean value) {
+ isFragment = value;
+ }
+
+ public void setUnpack(boolean value) {
+ unpack = value;
+ }
+
+ public boolean isUnpack() {
+ return unpack;
+ }
+
+ public void setOptional(boolean value) {
+ optional = value;
+ }
+
+ /**
+ * Temporary method to add provisioning filters to features
+ */
+ public void setFilter(String filter) {
+ this.filter = filter;
+
+ }
+
+ /**
+ * Temporary method to add provisioning filters to features
+ */
+ public String getFilter() {
+ return filter;
+ }
+
+ public String getMatch() {
+ return match;
+ }
+
+ public boolean isOptional() {
+ return optional;
+ }
+
+ public String getOS() {
+ return os;
+ }
+
+ public String getWS() {
+ return ws;
+ }
+
+ public String getArch() {
+ return arch;
+ }
+
+ public String getNL() {
+ return nl;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/Generator.java b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/Generator.java
new file mode 100644
index 000000000..b2f85fe99
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/Generator.java
@@ -0,0 +1,338 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.metadata.generator;
+
+import java.io.*;
+import java.net.MalformedURLException;
+import java.util.*;
+import java.util.Map.Entry;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.frameworkadmin.*;
+import org.eclipse.equinox.internal.prov.metadata.generator.Activator;
+import org.eclipse.equinox.internal.prov.metadata.generator.features.FeatureParser;
+import org.eclipse.equinox.prov.artifact.repository.IArtifactDescriptor;
+import org.eclipse.equinox.prov.artifact.repository.IWritableArtifactRepository;
+import org.eclipse.equinox.prov.core.helpers.FileUtils;
+import org.eclipse.equinox.prov.core.helpers.ServiceHelper;
+import org.eclipse.equinox.prov.metadata.*;
+import org.eclipse.osgi.service.resolver.*;
+import org.osgi.framework.Version;
+
+public class Generator {
+
+ private static final Version ECLIPSE_TOUCHPOINT_VERSION = new Version(1, 0, 0);
+ private static final String ORG_ECLIPSE_EQUINOX_SIMPLECONFIGURATOR = "org.eclipse.equinox.simpleconfigurator";
+ private static final String ORG_ECLIPSE_UPDATE_CONFIGURATOR = "org.eclipse.update.configurator";
+ // private static String[][] defaultMappingRules = new String[][] { {"(& (namespace=eclipse) (classifier=feature))", "${repoUrl}/feature/${id}_${version}"}, {"(& (namespace=eclipse) (classifier=plugin))", "${repoUrl}/plugin/${id}_${version}"}, {"(& (namespace=eclipse) (classifier=native))", "${repoUrl}/native/${id}_${version}"}};
+
+ private StateObjectFactory stateObjectFactory;
+ private IGeneratorInfo info;
+
+ public Generator(IGeneratorInfo infoProvider) {
+ this.info = infoProvider;
+ // TODO need to figure a better way of configuring the generator...
+ PlatformAdmin platformAdmin = (PlatformAdmin) ServiceHelper.getService(Activator.getContext(), PlatformAdmin.class.getName());
+ if (platformAdmin != null) {
+ stateObjectFactory = platformAdmin.getFactory();
+ }
+ }
+
+ public IStatus generate() {
+ Set ius = new HashSet();
+
+ Feature[] features = getFeatures(info.getFeaturesLocation());
+ generateFeatureIUs(features, ius);
+
+ BundleDescription[] bundles = getBundleDescriptions(info.getBundleLocations());
+ generateBundleIUs(bundles, ius, info.getArtifactRepository());
+
+ generateNativeIUs(info.getExecutableLocation(), ius, info.getArtifactRepository());
+
+ generateConfigIUs(info.getConfigData() == null ? null : info.getConfigData().getBundles(), ius);
+
+ if (info.addDefaultIUs())
+ generateDefaultConfigIU(ius, info);
+
+ generateRootIU(ius, info.getRootId(), info.getRootVersion());
+
+ // persistence.setMappingRules(info.getMappingRules() == null ? defaultMappingRules : info.getMappingRules());
+ // if (info.publishArtifacts() || info.publishArtifactRepository()) {
+ // persistence.saveArtifactRepository();
+ // }
+ info.getMetadataRepository().addInstallableUnits((InstallableUnit[]) ius.toArray(new InstallableUnit[ius.size()]));
+
+ return Status.OK_STATUS;
+ }
+
+ private void generateDefaultConfigIU(Set ius, IGeneratorInfo info) {
+ // TODO this is a bit of a hack. We need to have the default IU fragment generated with code that configures
+ // and unconfigures. the Generator should be decoupled from any particular provider but it is not clear
+ // that we should add the create* methods to IGeneratorInfo...
+ // MockBundleDescription bd1 = new MockBundleDescription("defaultConfigure");
+ // MockBundleDescription bd2 = new MockBundleDescription("defaultUnconfigure");
+ EclipseInstallGeneratorInfoProvider provider = (EclipseInstallGeneratorInfoProvider) info;
+ ius.add(MetadataGeneratorHelper.createEclipseDefaultConfigurationUnit(provider.createDefaultConfigurationBundleInfo(), provider.createDefaultUnconfigurationBundleInfo(), info.getFlavor()));
+ }
+
+ private Feature[] getFeatures(File folder) {
+ if (folder == null || !folder.exists())
+ return new Feature[0];
+ File[] locations = folder.listFiles();
+ ArrayList result = new ArrayList(locations.length);
+ for (int i = 0; i < locations.length; i++) {
+ FeatureParser parser = new FeatureParser();
+ try {
+ result.add(parser.parse(new File(locations[i], "feature.xml").toURL()));
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ }
+ }
+ return (Feature[]) result.toArray(new Feature[result.size()]);
+ }
+
+ protected void generateFeatureIUs(Feature[] features, Set resultantIUs) {
+ for (int i = 0; i < features.length; i++) {
+ Feature feature = features[i];
+ resultantIUs.add(MetadataGeneratorHelper.createGroupIU(feature));
+ }
+ }
+
+ protected BundleDescription[] getBundleDescriptions(File[] bundleLocations) {
+ boolean addSimpleConfigurator = false;
+ for (int i = 0; i < bundleLocations.length; i++) {
+ addSimpleConfigurator = bundleLocations[i].toString().indexOf(ORG_ECLIPSE_UPDATE_CONFIGURATOR) > 0;
+ if (addSimpleConfigurator)
+ break;
+ }
+ BundleDescription[] result = new BundleDescription[bundleLocations.length + (addSimpleConfigurator ? 1 : 0)];
+ BundleDescriptionFactory factory = getBundleFactory();
+ for (int i = 0; i < bundleLocations.length; i++)
+ result[i] = factory.getBundleDescription(bundleLocations[i]);
+ if (addSimpleConfigurator) {
+ //Add simple configurator to the list of bundles
+ try {
+ File location = new File(FileLocator.toFileURL(Activator.getContext().getBundle().getEntry(ORG_ECLIPSE_EQUINOX_SIMPLECONFIGURATOR + ".jar")).getFile());
+ result[result.length - 1] = factory.getBundleDescription(location);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ return result;
+ }
+
+ protected BundleDescriptionFactory getBundleFactory() {
+ BundleDescriptionFactory factory = new BundleDescriptionFactory(stateObjectFactory, null);
+ return factory;
+ }
+
+ protected void generateRootIU(Set resultantIUs, String rootIUId, String rootIUVersion) {
+ if (rootIUId == null)
+ return;
+ resultantIUs.add(createTopLevelIU(resultantIUs, rootIUId, rootIUVersion));
+ }
+
+ protected void generateNativeIUs(File executableLocation, Set resultantIUs, IWritableArtifactRepository destination) {
+ if (executableLocation == null)
+ return;
+ HashSet newArtifacts = new HashSet();
+
+ //generate data for JRE
+ File jreLocation = new File(executableLocation.getParentFile(), "jre");
+ MetadataGeneratorHelper.createJREData(jreLocation, resultantIUs, newArtifacts);
+ publishArtifact(jreLocation, newArtifacts);
+ newArtifacts.clear();
+
+ //generate data for executable launcher
+ MetadataGeneratorHelper.createLauncherData(executableLocation, info.getFlavor(), resultantIUs, newArtifacts);
+ publishArtifact(executableLocation, newArtifacts);
+ }
+
+ private void publishArtifact(File location, Set artifacts) {
+ if (!info.publishArtifacts() || artifacts.isEmpty())
+ return;
+ for (Iterator i = artifacts.iterator(); i.hasNext();) {
+ IArtifactDescriptor descriptor = (IArtifactDescriptor) i.next();
+ publishArtifact(descriptor, location, info.getArtifactRepository(), false, true);
+ }
+ }
+
+ protected void generateConfigIUs(BundleInfo[] infos, Set resultantIUs) {
+ if (infos == null)
+ return;
+ for (int i = 0; i < infos.length; i++) {
+ GeneratorBundleInfo bundle = new GeneratorBundleInfo(infos[i]);
+ if (bundle.getSymbolicName().equals(ORG_ECLIPSE_UPDATE_CONFIGURATOR)) {
+ bundle.setStartLevel(BundleInfo.NO_LEVEL);
+ bundle.setMarkedAsStarted(false);
+ bundle.setSpecialConfigCommands("manipulator.getLauncherData().addJvmArg('-Dorg.eclipse.update.reconcile=false');");
+ }
+ if (bundle.getSymbolicName().equals(ORG_ECLIPSE_EQUINOX_SIMPLECONFIGURATOR)) {
+ bundle.setSpecialConfigCommands("manipulator.getLauncherData().addJvmArg('-Dorg.eclipse.equinox.simpleconfigurator.useReference=true');");
+ }
+ IInstallableUnit cu = MetadataGeneratorHelper.createEclipseConfigurationUnit(bundle.getSymbolicName(), new Version(bundle.getVersion()), false, bundle, info.getFlavor());
+ if (cu != null)
+ resultantIUs.add(cu);
+ }
+
+ if (info.addDefaultIUs()) {
+ for (Iterator iterator = info.getDefaultIUs(resultantIUs).iterator(); iterator.hasNext();) {
+ GeneratorBundleInfo bundle = (GeneratorBundleInfo) iterator.next();
+ InstallableUnit configuredIU = getIU(resultantIUs, bundle.getSymbolicName());
+ if (configuredIU != null)
+ bundle.setVersion(configuredIU.getVersion().toString());
+ IInstallableUnit cu = MetadataGeneratorHelper.createEclipseConfigurationUnit(bundle.getSymbolicName(), new Version(bundle.getVersion()), false, bundle, info.getFlavor());
+ if (cu != null)
+ resultantIUs.add(cu);
+ }
+ }
+ }
+
+ private InstallableUnit getIU(Set ius, String id) {
+ for (Iterator iterator = ius.iterator(); iterator.hasNext();) {
+ InstallableUnit tmp = (InstallableUnit) iterator.next();
+ if (tmp.getId().equals(id))
+ return tmp;
+ }
+ return null;
+ }
+
+ protected void generateBundleIUs(BundleDescription[] bundles, Set resultantIUs, IWritableArtifactRepository destination) {
+ for (int i = 0; i < bundles.length; i++) {
+ BundleDescription bd = bundles[i];
+ // A bundle may be null if the associated plug-in does not have a manifest file -
+ // for example, org.eclipse.jdt.launching.j9
+ if (bd != null) {
+ String format = (String) ((Dictionary) bd.getUserObject()).get(BundleDescriptionFactory.BUNDLE_FILE_KEY);
+ boolean isDir = format.equals(BundleDescriptionFactory.DIR) ? true : false;
+ IArtifactKey key = MetadataGeneratorHelper.createEclipseArtifactKey(bd.getSymbolicName(), bd.getVersion().toString());
+ IArtifactDescriptor ad = MetadataGeneratorHelper.createArtifactDescriptor(key, new File(bd.getLocation()), true, false);
+ if (info.publishArtifacts())
+ // publishArtifact(info.getArtifactRepoLocation().getParentFile(), new File(bd.getLocation()), key.getClassifier(), key.getId() + "_" + key.getVersion().toString(), !isDir, true);
+ publishArtifact(ad, new File(bd.getLocation()), destination, !isDir, true);
+ else
+ destination.addDescriptor(ad);
+
+ IInstallableUnit iu = MetadataGeneratorHelper.createEclipseIU(bd, (Map) bd.getUserObject(), isDir, key);
+ resultantIUs.add(iu);
+ }
+ }
+ }
+
+ protected InstallableUnit createTopLevelIU(Set resultantIUs, String configurationIdentification, String configurationVersion) {
+ InstallableUnit iu = new InstallableUnit();
+ iu.setSingleton(true);
+ iu.setId(configurationIdentification);
+ iu.setVersion(new Version(configurationVersion));
+
+ ArrayList reqsConfigurationUnits = new ArrayList(resultantIUs.size());
+ for (Iterator iterator = resultantIUs.iterator(); iterator.hasNext();) {
+ InstallableUnit tmp = (InstallableUnit) iterator.next();
+ reqsConfigurationUnits.add(RequiredCapability.createRequiredCapabilityForName(tmp.getId(), new VersionRange(tmp.getVersion(), true, tmp.getVersion(), true), false));
+ }
+ iu.setRequiredCapabilities((RequiredCapability[]) reqsConfigurationUnits.toArray(new RequiredCapability[reqsConfigurationUnits.size()]));
+ iu.setApplicabilityFilter("");
+ iu.setArtifacts(new IArtifactKey[0]);
+
+ iu.setProperty("lineUp", "true");
+ iu.setProperty(IInstallableUnitConstants.UPDATE_FROM, configurationIdentification);
+ iu.setProperty(IInstallableUnitConstants.UPDATE_RANGE, VersionRange.emptyRange.toString());
+ ProvidedCapability groupCapability = new ProvidedCapability(IInstallableUnit.IU_KIND_NAMESPACE, "group", new Version("1.0.0"));
+ iu.setCapabilities(new ProvidedCapability[] {groupCapability});
+ iu.setTouchpointType(new TouchpointType("eclipse", ECLIPSE_TOUCHPOINT_VERSION));
+ Map touchpointData = new HashMap();
+
+ String configurationData = "";
+
+ ConfigData configData = info.getConfigData();
+ if (configData != null) {
+ for (Iterator iterator = configData.getFwDependentProps().entrySet().iterator(); iterator.hasNext();) {
+ Entry aProperty = (Entry) iterator.next();
+ String key = ((String) aProperty.getKey());
+ if (key.equals("osgi.frameworkClassPath") || key.equals("osgi.framework") || key.equals("osgi.bundles") || key.equals("eof"))
+ continue;
+ configurationData += "manipulator.getConfigData().setFwDependentProp('" + key + "', '" + ((String) aProperty.getValue()) + "');";
+ }
+ for (Iterator iterator = configData.getFwIndependentProps().entrySet().iterator(); iterator.hasNext();) {
+ Entry aProperty = (Entry) iterator.next();
+ String key = ((String) aProperty.getKey());
+ if (key.equals("osgi.frameworkClassPath") || key.equals("osgi.framework") || key.equals("osgi.bundles") || key.equals("eof"))
+ continue;
+ configurationData += "manipulator.getConfigData().setFwIndependentProp('" + key + "', '" + ((String) aProperty.getValue()) + "');";
+ }
+ }
+
+ LauncherData launcherData = info.getLauncherData();
+ if (launcherData != null) {
+ final String[] jvmArgs = launcherData.getJvmArgs();
+ for (int i = 0; i < jvmArgs.length; i++)
+ configurationData += "manipulator.getLauncherData().addJvmArg('" + jvmArgs[i] + "');";
+
+ final String[] programArgs = launcherData.getProgramArgs();
+ for (int i = 0; i < programArgs.length; i++) {
+ String programArg = programArgs[i];
+ if (programArg.equals("--launcher.library") || programArg.equals("-startup") || programArg.equals("-configuration"))
+ i++;
+ configurationData += "manipulator.getLauncherData().addProgramArg('" + programArg + "');";
+ }
+ }
+ touchpointData.put("configurationData", configurationData);
+ iu.setImmutableTouchpointData(new TouchpointData(touchpointData));
+ return iu;
+ }
+
+ // Put the artifact on the server
+ protected void publishArtifact(IArtifactDescriptor descriptor, File bundlePath, IWritableArtifactRepository destination, boolean asIs, boolean recurse) {
+ // key.getClassifier(), key.getId() + '_' + key.getVersion().toString()
+ if (asIs) {
+ try {
+ if (!destination.contains(descriptor)) {
+ OutputStream output = destination.getOutputStream(descriptor);
+ if (output == null)
+ throw new IOException("unable to open output stream for " + descriptor);
+ FileUtils.copyStream(new BufferedInputStream(new FileInputStream(bundlePath)), true, new BufferedOutputStream(output), true);
+ }
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ } else {
+ File tempFile = null;
+ try {
+ tempFile = File.createTempFile("work", "");
+ if (recurse)
+ FileUtils.zip(new File[] {bundlePath}, tempFile);
+ else
+ FileUtils.zip(bundlePath.listFiles(new FileFilter() {
+ public boolean accept(File pathname) {
+ if (pathname.isFile())
+ return true;
+ return false;
+ }
+ }), tempFile);
+ if (!destination.contains(descriptor)) {
+ OutputStream output = destination.getOutputStream(descriptor);
+ if (output == null)
+ throw new IOException("unable to open output stream for " + descriptor);
+ FileUtils.copyStream(new BufferedInputStream(new FileInputStream(tempFile)), true, new BufferedOutputStream(output), true);
+ }
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } finally {
+ if (tempFile != null)
+ tempFile.delete();
+ }
+ }
+ }
+
+ protected IGeneratorInfo getGeneratorInfo() {
+ return info;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/GeneratorBundleInfo.java b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/GeneratorBundleInfo.java
new file mode 100644
index 000000000..11009c567
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/GeneratorBundleInfo.java
@@ -0,0 +1,150 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.metadata.generator;
+
+import java.io.ByteArrayInputStream;
+import org.eclipse.equinox.frameworkadmin.BundleInfo;
+import org.eclipse.equinox.prov.core.helpers.Headers;
+import org.eclipse.osgi.util.ManifestElement;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Constants;
+
+public class GeneratorBundleInfo extends BundleInfo {
+ // public static final int NO_LEVEL = -1;
+
+ // private String symbolicName;
+ // private String version;
+ // private String location;
+ // private int expectedState;
+ // private int startLevel = NO_LEVEL;
+ // private String manifest;
+
+ private String specialConfigCommands;
+
+ public GeneratorBundleInfo(BundleInfo bInfo) {
+ super.setBundleId(bInfo.getBundleId());
+ super.setLocation(bInfo.getLocation());
+ super.setManifest(bInfo.getManifest());
+ super.setMarkedAsStarted(bInfo.isMarkedAsStarted());
+ super.setResolved(bInfo.isResolved());
+ super.setStartLevel(bInfo.getStartLevel());
+ super.setSymbolicName(bInfo.getSymbolicName());
+ super.setVersion(bInfo.getVersion());
+ }
+
+ public GeneratorBundleInfo() {
+ // TODO Auto-generated constructor stub
+ }
+
+ // /* (non-Javadoc)
+ // * @see java.lang.Object#hashCode()
+ // */
+ // public int hashCode() {
+ // int result = symbolicName == null ? 0 : symbolicName.hashCode();
+ // result = result + (version == null ? 0 : version.hashCode());
+ // result = result + (location == null ? 0 : location.hashCode());
+ // return result;
+ // }
+ //
+ // public String getSymbolicName() {
+ // return symbolicName;
+ // }
+ //
+ // public String getVersion() {
+ // return version;
+ // }
+ //
+ // public int expectedState() {
+ // return expectedState;
+ // }
+ //
+ // public int getStartLevel() {
+ // return startLevel;
+ // }
+ //
+ // public String getLocation() {
+ // return location;
+ // }
+ //
+ // public void setSymbolicName(String id) {
+ // symbolicName = id;
+ // }
+ //
+ // public void setVersion(String version) {
+ // this.version = version;
+ // }
+ //
+ // public void setExpectedState(int state) {
+ // expectedState = state;
+ // }
+ //
+ // public void setStartLevel(int level) {
+ // this.startLevel = level;
+ // }
+ //
+ // public void setLocation(String location) {
+ // this.location = location;
+ // }
+ //
+ // public void setManifest(String manifest) {
+ // this.manifest = manifest;
+ // }
+ //
+ // public String getManifest() {
+ // return manifest;
+ // }
+ //
+ public String getSpecialConfigCommands() {
+ return specialConfigCommands;
+ }
+
+ public void setSpecialConfigCommands(String specialConfigCommands) {
+ this.specialConfigCommands = specialConfigCommands;
+ }
+
+ // /* (non-Javadoc)
+ // * @see java.lang.Object#equals(java.lang.Object)
+ // */
+ // public boolean equals(Object toCompare) {
+ // if (toCompare instanceof GeneratorBundleInfo) {
+ // GeneratorBundleInfo info = (GeneratorBundleInfo) toCompare;
+ // if (info.symbolicName.equals(symbolicName) && info.version.equals(version) && (info.location == null || location == null ? true : info.location.equals(location)))
+ // return true;
+ // }
+ // return false;
+ // }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ StringBuffer buffer = new StringBuffer();
+ String superSt = super.toString();
+ buffer.append(superSt.substring(superSt.length() - 1));
+ buffer.append(", this.specialConfigCommands="); //$NON-NLS-1$
+ buffer.append(this.specialConfigCommands);
+ buffer.append(')');
+ return buffer.toString();
+ }
+
+ public void initFromManifest(String manifest) {
+ try {
+ super.setManifest(manifest);
+ Headers headers = Headers.parseManifest(new ByteArrayInputStream(manifest.getBytes()));
+ ManifestElement[] element = ManifestElement.parseHeader("bsn", (String) headers.get(Constants.BUNDLE_SYMBOLICNAME));
+ super.setSymbolicName(element[0].getValue());
+ super.setVersion((String) headers.get(Constants.BUNDLE_VERSION));
+ } catch (BundleException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/IGeneratorInfo.java b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/IGeneratorInfo.java
new file mode 100644
index 000000000..72af1ead7
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/IGeneratorInfo.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.metadata.generator;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Set;
+import org.eclipse.equinox.frameworkadmin.ConfigData;
+import org.eclipse.equinox.frameworkadmin.LauncherData;
+import org.eclipse.equinox.prov.artifact.repository.IWritableArtifactRepository;
+import org.eclipse.equinox.prov.metadata.repository.IWritableMetadataRepository;
+
+public interface IGeneratorInfo {
+ public boolean addDefaultIUs();
+
+ public boolean append();
+
+ public IWritableArtifactRepository getArtifactRepository();
+
+ public File[] getBundleLocations();
+
+ public ConfigData getConfigData();
+
+ public File getConfigurationLocation();
+
+ public ArrayList getDefaultIUs(Set ius);
+
+ public File getExecutableLocation();
+
+ public File getFeaturesLocation();
+
+ public String getFlavor();
+
+ public LauncherData getLauncherData();
+
+ public String[][] getMappingRules();
+
+ public IWritableMetadataRepository getMetadataRepository();
+
+ public String getRootId();
+
+ public String getRootVersion();
+
+ public boolean publishArtifactRepository();
+
+ public boolean publishArtifacts();
+
+ public void setArtifactRepository(IWritableArtifactRepository value);
+
+ public void setFlavor(String value);
+
+ public void setMetadataRepository(IWritableMetadataRepository value);
+
+ public void setPublishArtifacts(boolean value);
+
+ public void setRootId(String value);
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/IPlatformEntry.java b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/IPlatformEntry.java
new file mode 100644
index 000000000..132eecca3
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/IPlatformEntry.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.prov.metadata.generator;
+
+public interface IPlatformEntry {
+ public String getOS();
+
+ public String getWS();
+
+ public String getArch();
+
+ public String getNL();
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/MetadataGeneratorHelper.java b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/MetadataGeneratorHelper.java
new file mode 100644
index 000000000..e315d5ba5
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/MetadataGeneratorHelper.java
@@ -0,0 +1,504 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.metadata.generator;
+
+import java.io.*;
+import java.util.*;
+import org.eclipse.equinox.frameworkadmin.BundleInfo;
+import org.eclipse.equinox.internal.prov.metadata.ArtifactKey;
+import org.eclipse.equinox.internal.prov.metadata.generator.Activator;
+import org.eclipse.equinox.prov.artifact.repository.ArtifactDescriptor;
+import org.eclipse.equinox.prov.artifact.repository.IArtifactDescriptor;
+import org.eclipse.equinox.prov.core.helpers.ServiceHelper;
+import org.eclipse.equinox.prov.metadata.*;
+import org.eclipse.osgi.service.environment.EnvironmentInfo;
+import org.eclipse.osgi.service.resolver.*;
+import org.eclipse.osgi.util.ManifestElement;
+import org.osgi.framework.*;
+
+public class MetadataGeneratorHelper {
+ private static final String ECLIPSE_EXTENSIBLE_API = "Eclipse-ExtensibleAPI"; //$NON-NLS-1$
+
+ private static final String CAPABILITY_TYPE_OSGI_PACKAGES = "osgi.packages"; //$NON-NLS-1$
+
+ private static final Version versionMax = new Version(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE);
+
+ private static final String ECLIPSE_TOUCHPOINT = "eclipse"; //$NON-NLS-1$
+ private static final Version ECLIPSE_TOUCHPOINT_VERSION = new Version(1, 0, 0);
+
+ private static final String NATIVE_TOUCHPOINT = "native"; //$NON-NLS-1$
+ private static final Version NATIVE_TOUCHPOINT_VERSION = new Version(1, 0, 0);
+
+ private static final String ECLIPSE_ARTIFACT_NAMESPACE = "eclipse"; //$NON-NLS-1$
+ private static final String ECLIPSE_ARTIFACT_CLASSIFIER = "plugin"; //$NON-NLS-1$
+
+ private static final String ORG_ECLIPSE_EXECUTABLE = "org.eclipse.executable"; //$NON-NLS-1$
+ private static final Version ORG_ECLIPSE_EXECUTABLE_VERSION = new Version(1, 0, 0);
+ private static final String IU_NAMESPACE = IInstallableUnit.IU_NAMESPACE;
+
+ private static final String[] BUNDLE_IU_PROPERTY_MAP = {Constants.BUNDLE_NAME, IInstallableUnitConstants.NAME, Constants.BUNDLE_DESCRIPTION, IInstallableUnitConstants.DESCRIPTION, Constants.BUNDLE_VENDOR, IInstallableUnitConstants.PROVIDER, Constants.BUNDLE_CONTACTADDRESS, IInstallableUnitConstants.CONTACT, Constants.BUNDLE_COPYRIGHT, IInstallableUnitConstants.COPYRIGHT, Constants.BUNDLE_DOCURL, IInstallableUnitConstants.DOC_URL, Constants.BUNDLE_UPDATELOCATION, IInstallableUnitConstants.UPDATE_SITE};
+
+ private static final Version DEFAULT_JRE_VERSION = new Version("1.5"); //$NON-NLS-1$
+
+ /**
+ * Creates IUs and artifact descriptors for the JRE, and adds them to the given sets.
+ * if the jreLocation is <code>null</code>, default information is generated.
+ */
+ public static void createJREData(File jreLocation, Set resultantIUs, Set resultantArtifactDescriptors) {
+ InstallableUnit iu = new InstallableUnit();
+ iu.setSingleton(false);
+ iu.setId("a.jre"); //$NON-NLS-1$
+ iu.setTouchpointType(new TouchpointType(NATIVE_TOUCHPOINT, NATIVE_TOUCHPOINT_VERSION));
+ if (jreLocation == null || !jreLocation.exists()) {
+ //set some reasonable defaults
+ iu.setVersion(DEFAULT_JRE_VERSION);
+ iu.setCapabilities(generateJRECapability(null));
+ resultantIUs.add(iu);
+ return;
+ }
+ generateJREIUData(iu, jreLocation);
+
+ //Generate artifact for JRE
+ IArtifactKey key = new ArtifactKey(ECLIPSE_ARTIFACT_NAMESPACE, NATIVE_TOUCHPOINT, iu.getId(), iu.getVersion());
+ iu.setArtifacts(new IArtifactKey[] {key});
+ iu.setTouchpointType(new TouchpointType(NATIVE_TOUCHPOINT, new Version(1, 0, 0)));
+ resultantIUs.add(iu);
+
+ //Create the CU
+ InstallableUnitFragment cu = new InstallableUnitFragment();
+ cu.setId("config." + iu.getId()); //$NON-NLS-1$
+ cu.setVersion(iu.getVersion());
+ cu.setHost(iu.getId(), new VersionRange(iu.getVersion(), true, versionMax, true));
+
+ cu.setTouchpointType(new TouchpointType(NATIVE_TOUCHPOINT, NATIVE_TOUCHPOINT_VERSION));
+ Map touchpointData = new HashMap();
+ String configurationData = "Zip.unzip(artifact, currentDir, null);";
+ EnvironmentInfo info = (EnvironmentInfo) ServiceHelper.getService(Activator.getContext(), EnvironmentInfo.class.getName());
+ touchpointData.put("configurationData", configurationData);
+ cu.setImmutableTouchpointData(new TouchpointData(touchpointData));
+ resultantIUs.add(cu);
+
+ //Create the artifact descriptor
+ IArtifactDescriptor descriptor = createArtifactDescriptor(key, jreLocation, false, true);
+ resultantArtifactDescriptors.add(descriptor);
+ }
+
+ private static void generateJREIUData(InstallableUnit iu, File jreLocation) {
+ //Look for a JRE profile file to set version and capabilities
+ File[] profiles = jreLocation.listFiles(new FileFilter() {
+ public boolean accept(File pathname) {
+ return pathname.getAbsolutePath().endsWith(".profile"); //$NON-NLS-1$
+ }
+ });
+ if (profiles.length != 1) {
+ iu.setVersion(DEFAULT_JRE_VERSION);
+ iu.setCapabilities(generateJRECapability(null));
+ return;
+ }
+ String profileName = profiles[0].getAbsolutePath().substring(profiles[0].getAbsolutePath().lastIndexOf('/'));
+ Version version = DEFAULT_JRE_VERSION;
+ //TODO Find a better way to determine JRE version
+ if (profileName.indexOf("1.5") > 0) { //$NON-NLS-1$
+ version = new Version("1.5"); //$NON-NLS-1$
+ } else if (profileName.indexOf("1.4") > 0) { //$NON-NLS-1$
+ version = new Version("1.4"); //$NON-NLS-1$
+ }
+ iu.setVersion(version);
+ try {
+ iu.setCapabilities(generateJRECapability(new FileInputStream(profiles[0])));
+ } catch (FileNotFoundException e) {
+ //Shouldn't happen, but ignore and fall through to use default
+ }
+ }
+
+ /**
+ * Creates IUs and artifacts for the Eclipse executable, and adds them to the given
+ * sets.
+ */
+ public static void createLauncherData(File launcher, String configurationFlavor, Set resultantIUs, Set resultantArtifactDescriptors) {
+ if (launcher == null || !launcher.exists())
+ return;
+
+ //Create the IU
+ InstallableUnit iu = new InstallableUnit();
+ iu.setSingleton(true);
+ iu.setId(ORG_ECLIPSE_EXECUTABLE);
+ iu.setVersion(ORG_ECLIPSE_EXECUTABLE_VERSION);
+
+ IArtifactKey key = new ArtifactKey(ECLIPSE_ARTIFACT_NAMESPACE, NATIVE_TOUCHPOINT, ORG_ECLIPSE_EXECUTABLE, ORG_ECLIPSE_EXECUTABLE_VERSION);
+ iu.setArtifacts(new IArtifactKey[] {key});
+ iu.setTouchpointType(new TouchpointType(NATIVE_TOUCHPOINT, new Version(1, 0, 0)));
+ resultantIUs.add(iu);
+
+ //Create the CU
+ InstallableUnitFragment cu = new InstallableUnitFragment();
+ cu.setId(configurationFlavor + iu.getId());
+ cu.setVersion(iu.getVersion());
+ cu.setHost(iu.getId(), new VersionRange(iu.getVersion(), true, versionMax, true));
+
+ cu.setTouchpointType(new TouchpointType(NATIVE_TOUCHPOINT, NATIVE_TOUCHPOINT_VERSION));
+ Map touchpointData = new HashMap();
+ String configurationData = "Zip.unzip(artifact, currentDir, null);";
+ EnvironmentInfo info = (EnvironmentInfo) ServiceHelper.getService(Activator.getContext(), EnvironmentInfo.class.getName());
+ if (!info.getOS().equals(org.eclipse.osgi.service.environment.Constants.OS_WIN32))
+ // FIXME: is this correct? do all non-Windows platforms need execute permissions on the launcher?
+ configurationData += " Permissions.chmod(currentDir, \"" + launcher.getName() + "\", 755);";
+ touchpointData.put("configurationData", configurationData);
+ cu.setImmutableTouchpointData(new TouchpointData(touchpointData));
+ resultantIUs.add(cu);
+
+ //Create the artifact descriptor
+ IArtifactDescriptor descriptor = createArtifactDescriptor(new ArtifactKey(ECLIPSE_ARTIFACT_NAMESPACE, NATIVE_TOUCHPOINT, ORG_ECLIPSE_EXECUTABLE, ORG_ECLIPSE_EXECUTABLE_VERSION), launcher, false, true);
+ resultantArtifactDescriptors.add(descriptor);
+ }
+
+ private static ProvidedCapability[] generateJRECapability(InputStream profileStream) {
+ if (profileStream == null) {
+ //use the 1.5 profile stored in the generator bundle
+ try {
+ profileStream = Activator.getContext().getBundle().getEntry("J2SE-1.5.profile").openStream();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ Properties p = new Properties();
+ try {
+ p.load(profileStream);
+ ManifestElement[] jrePackages = ManifestElement.parseHeader("org.osgi.framework.system.packages", (String) p.get("org.osgi.framework.system.packages"));
+ ProvidedCapability[] exportedPackageAsCapabilities = new ProvidedCapability[jrePackages.length];
+ for (int i = 0; i < jrePackages.length; i++) {
+ exportedPackageAsCapabilities[i] = new ProvidedCapability("osgi.packages", jrePackages[i].getValue(), null);
+ }
+ return exportedPackageAsCapabilities;
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (BundleException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } finally {
+ if (profileStream != null) {
+ try {
+ profileStream.close();
+ } catch (IOException e) {
+ //ignore secondary failure
+ }
+ }
+ }
+ return new ProvidedCapability[0];
+ }
+
+ public static IInstallableUnit createEclipseConfigurationUnit(String iuId, Version iuVersion, boolean isBundleFragment, GeneratorBundleInfo configInfo, String configurationFlavor) {
+ if (configInfo == null)
+ return null;
+
+ InstallableUnitFragment cu = new InstallableUnitFragment();
+ cu.setId(configurationFlavor + iuId);
+ cu.setVersion(iuVersion);
+
+ //Indicate the IU to which this CU apply
+ cu.setHost(iuId, new VersionRange(iuVersion, true, versionMax, true));
+
+ //Add a capability describing the flavor supported
+ cu.setCapabilities(new ProvidedCapability[] {new ProvidedCapability(IInstallableUnit.FLAVOR_NAMESPACE, configurationFlavor, Version.emptyVersion)});
+
+ cu.setTouchpointType(new TouchpointType(ECLIPSE_TOUCHPOINT, ECLIPSE_TOUCHPOINT_VERSION)); //TODO Is this necessary? I think we get that from the IU
+
+ Map touchpointData = new HashMap();
+ touchpointData.put("configurationData", createConfigScript(configInfo, isBundleFragment));
+ touchpointData.put("unconfigurationData", createUnconfigScript(configInfo, isBundleFragment));
+ cu.setImmutableTouchpointData(new TouchpointData(touchpointData));
+
+ return cu;
+ }
+
+ public static IInstallableUnit createEclipseDefaultConfigurationUnit(GeneratorBundleInfo configInfo, GeneratorBundleInfo unconfigInfo, String configurationFlavor) {
+ InstallableUnitFragment cu = new InstallableUnitFragment();
+ cu.setId(configurationFlavor + "default");
+ cu.setVersion(new Version(1, 0, 0));
+
+ //Add a capability describing the flavor supported
+ cu.setCapabilities(new ProvidedCapability[] {new ProvidedCapability(IInstallableUnit.FLAVOR_NAMESPACE, configurationFlavor, Version.emptyVersion)});
+
+ //Create a capability on bundles
+ RequiredCapability[] reqs = new RequiredCapability[] {new RequiredCapability(IInstallableUnit.CAPABILITY_ECLIPSE_TYPES, IInstallableUnit.CAPABILITY_ECLIPSE_BUNDLE, VersionRange.emptyRange, null, false, true)};
+ cu.setRequiredCapabilities(reqs);
+ cu.setTouchpointType(new TouchpointType(ECLIPSE_TOUCHPOINT, ECLIPSE_TOUCHPOINT_VERSION)); //TODO Is this necessary? I think we get that from the IU
+ Map touchpointData = new HashMap();
+
+ touchpointData.put("configurationData", createDefaultConfigScript(configInfo));
+ touchpointData.put("unconfigurationData", createDefaultUnconfigScript(unconfigInfo));
+
+ cu.setImmutableTouchpointData(new TouchpointData(touchpointData));
+ return cu;
+ }
+
+ private static String createDefaultConfigScript(GeneratorBundleInfo configInfo) {
+ String configScript = "";//$NON-NLS-1$
+ if (configInfo != null) {
+ if (configInfo.getStartLevel() != BundleInfo.NO_LEVEL) {
+ configScript += "bundleToInstall.setStartLevel(" + configInfo.getStartLevel() + ");";
+ }
+ if (configInfo.isMarkedAsStarted()) {
+ configScript += "bundleToInstall.setMarkedAsStarted(true);";
+ }
+ if (configInfo.getSpecialConfigCommands() != null) {
+ configScript += configInfo.getSpecialConfigCommands();
+ }
+ }
+ return configScript;
+ }
+
+ private static String createDefaultUnconfigScript(GeneratorBundleInfo unconfigInfo) {
+ String unconfigScript = ""; //$NON-NLS-1$
+ if (unconfigInfo != null) {
+ if (unconfigInfo.getSpecialConfigCommands() != null) {
+ unconfigScript += unconfigInfo.getSpecialConfigCommands();
+ }
+ }
+ return unconfigScript;
+ }
+
+ private static String createConfigScript(GeneratorBundleInfo configInfo, boolean isBundleFragment) {
+ String configScript = "manipulator.getConfigData().addBundle(bundleToInstall);";
+ if (configInfo != null) {
+ if (!isBundleFragment && configInfo.getStartLevel() != BundleInfo.NO_LEVEL) {
+ configScript += "bundleToInstall.setStartLevel(" + configInfo.getStartLevel() + ");";
+ }
+ if (!isBundleFragment && configInfo.isMarkedAsStarted()) {
+ configScript += "bundleToInstall.setMarkedAsStarted(true);";
+ }
+ if (configInfo.getSpecialConfigCommands() != null) {
+ configScript += configInfo.getSpecialConfigCommands();
+ }
+ }
+ return configScript;
+ }
+
+ private static String createUnconfigScript(GeneratorBundleInfo configInfo, boolean isBundleFragment) {
+ String unconfigScript = "";
+ if (configInfo != null) {
+ if (!isBundleFragment && configInfo.getStartLevel() != BundleInfo.NO_LEVEL) {
+ unconfigScript += "bundleToRemove.setStartLevel(" + BundleInfo.NO_LEVEL + ");";
+ }
+ if (!isBundleFragment && configInfo.isMarkedAsStarted()) {
+ unconfigScript += "bundleToRemove.setMarkedAsStarted(false);";
+ }
+ if (configInfo.getSpecialConfigCommands() != null) {
+ // TODO: how should special config commands be removed
+ // unconfigScript += "foobar.remove(" + configInfo.getSpecialConfigCommands() + ");";
+ }
+ }
+ unconfigScript += "manipulator.getConfigData().removeBundle(bundleToRemove);";
+ return unconfigScript;
+ }
+
+ private static boolean requireAFragment(BundleDescription bd, Map manifest) {
+ if (manifest == null)
+ return false;
+ if (manifest.get(ECLIPSE_EXTENSIBLE_API) == null)
+ return false;
+ if (bd.getSymbolicName().equals("org.eclipse.osgi")) //Special case for OSGi
+ return false;
+ String classpath = (String) ((Map) bd.getUserObject()).get(Constants.BUNDLE_CLASSPATH);
+ if (classpath == null)
+ return true;
+ ManifestElement[] classpathEntries;
+ try {
+ classpathEntries = ManifestElement.parseHeader(Constants.BUNDLE_CLASSPATH, classpath);
+ if (classpathEntries.length != 0 && classpathEntries[0].getValue().equals("."))
+ return true;
+ } catch (BundleException e) {
+ //If we are here, it is that we have already parsed the bundle manifest and it contains no error
+ }
+ return false;
+ }
+
+ public static IInstallableUnit createEclipseIU(BundleDescription bd, Map manifest, boolean isFolderPlugin, IArtifactKey key) {
+ InstallableUnit iu = new InstallableUnit();
+ iu.setSingleton(bd.isSingleton());
+ iu.setId(bd.getSymbolicName());
+ iu.setVersion(bd.getVersion());
+ iu.setFilter(bd.getPlatformFilter());
+ iu.setProperty(IInstallableUnitConstants.UPDATE_FROM, bd.getSymbolicName());
+ iu.setProperty(IInstallableUnitConstants.UPDATE_RANGE, VersionRange.emptyRange.toString());
+
+ boolean isFragment = bd.getHost() != null;
+ boolean requiresAFragment = isFragment ? false : requireAFragment(bd, manifest);
+
+ //Process the required bundles
+ BundleSpecification requiredBundles[] = bd.getRequiredBundles();
+ ArrayList reqsDeps = new ArrayList();
+ if (requiresAFragment)
+ reqsDeps.add(new RequiredCapability("fragment", iu.getId(), VersionRange.emptyRange, null, false, false));
+ if (isFragment)
+ reqsDeps.add(RequiredCapability.createRequiredCapabilityForName(bd.getHost().getName(), bd.getHost().getVersionRange(), false));
+ for (int j = 0; j < requiredBundles.length; j++)
+ reqsDeps.add(RequiredCapability.createRequiredCapabilityForName(requiredBundles[j].getName(), requiredBundles[j].getVersionRange() == VersionRange.emptyRange ? null : requiredBundles[j].getVersionRange(), requiredBundles[j].isOptional()));
+
+ //Process the import package
+ ImportPackageSpecification osgiImports[] = bd.getImportPackages();
+ for (int i = 0; i < osgiImports.length; i++) {
+ // TODO we need to sort out how we want to handle wild-carded dynamic imports - for now we ignore them
+ ImportPackageSpecification importSpec = osgiImports[i];
+ String importPackageName = importSpec.getName();
+ if (importPackageName.indexOf('*') != -1)
+ continue;
+
+ VersionRange versionRange = importSpec.getVersionRange() == VersionRange.emptyRange ? null : importSpec.getVersionRange();
+
+ //TODO this needs to be refined to take into account all the attribute handled by imports
+ reqsDeps.add(new RequiredCapability(CAPABILITY_TYPE_OSGI_PACKAGES, importPackageName, versionRange, null, isOptional(importSpec), false));
+ }
+ iu.setRequiredCapabilities((RequiredCapability[]) reqsDeps.toArray(new RequiredCapability[reqsDeps.size()]));
+
+ //Process the export package
+ ExportPackageDescription exports[] = bd.getExportPackages();
+ ProvidedCapability[] exportedPackageAsCapabilities = new ProvidedCapability[exports.length + 1 + (isFragment ? 1 : 0)];
+ exportedPackageAsCapabilities[exports.length] = new ProvidedCapability(IInstallableUnit.CAPABILITY_ECLIPSE_TYPES, IInstallableUnit.CAPABILITY_ECLIPSE_BUNDLE, new Version(1, 0, 0)); //Here we add a bundle capability to identify bundles
+ for (int i = 0; i < exports.length; i++) {
+ exportedPackageAsCapabilities[i] = new ProvidedCapability(CAPABILITY_TYPE_OSGI_PACKAGES, exports[i].getName(), exports[i].getVersion() == Version.emptyVersion ? null : exports[i].getVersion()); //TODO make sure that we support all the refinement on the exports
+ }
+ if (isFragment)
+ exportedPackageAsCapabilities[exportedPackageAsCapabilities.length - 1] = new ProvidedCapability("fragment", bd.getHost().getName(), bd.getVersion());
+ iu.setCapabilities(exportedPackageAsCapabilities);
+ iu.setApplicabilityFilter("");
+
+ iu.setArtifacts(new IArtifactKey[] {key});
+
+ iu.setTouchpointType(new TouchpointType(ECLIPSE_TOUCHPOINT, ECLIPSE_TOUCHPOINT_VERSION));
+
+ // Set IU properties from the manifest header attributes
+ // TODO The values of the attributes may be localized. Metadata generation
+ // should construct property files for the IU based on the bundle/plug-in
+ // property files in whatever locales are provided.
+ if (manifest != null) {
+ int i = 0;
+ while (i < BUNDLE_IU_PROPERTY_MAP.length) {
+ if (manifest.containsKey(BUNDLE_IU_PROPERTY_MAP[i])) {
+ String value = (String) manifest.get(BUNDLE_IU_PROPERTY_MAP[i]);
+ if (value != null) {
+ iu.setProperty(BUNDLE_IU_PROPERTY_MAP[i + 1], value);
+ }
+ }
+ i += 2;
+ }
+ }
+
+ //Define the immutable metadata for this IU. In this case immutable means that this is something that will not impact the configuration
+ Map touchpointData = new HashMap();
+ if (isFolderPlugin)
+ touchpointData.put("zipped", "true");
+ touchpointData.put("manifest", toManifestString(manifest));
+ iu.setImmutableTouchpointData(new TouchpointData(touchpointData));
+ return iu;
+ }
+
+ public static VersionRange getVersionRange(FeatureEntry entry) {
+ String versionSpec = entry.getVersion();
+ if (versionSpec == null)
+ // TODO should really be returning VersionRange.emptyRange here...
+ return null;
+ Version version = new Version(versionSpec);
+ if (!entry.isRequires())
+ return new VersionRange(version, true, version, true);
+ String match = entry.getMatch();
+ if (match == null)
+ // TODO should really be returning VersionRange.emptyRange here...
+ return null;
+ if (match.equals("perfect"))
+ return new VersionRange(version, true, version, true);
+ if (match.equals("equivalent")) {
+ Version upper = new Version(version.getMajor(), version.getMinor() + 1, 0);
+ return new VersionRange(version, true, upper, false);
+ }
+ if (match.equals("compatible")) {
+ Version upper = new Version(version.getMajor() + 1, 0, 0);
+ return new VersionRange(version, true, upper, false);
+ }
+ if (match.equals("greaterOrEqual"))
+ return new VersionRange(version, true, new VersionRange(null).getMaximum(), true);
+ return null;
+ }
+
+ private static String getTransformedId(String original, boolean isPlugin) {
+ return isPlugin ? original : original + ".featureIU";
+ }
+
+ public static IInstallableUnit createGroupIU(Feature feature) {
+ InstallableUnit iu = new InstallableUnit();
+ iu.setId(getTransformedId(feature.getId(), false));
+ iu.setVersion(new Version(feature.getVersion()));
+ iu.setProperty(IInstallableUnitConstants.UPDATE_FROM, iu.getId());
+ iu.setProperty(IInstallableUnitConstants.UPDATE_RANGE, VersionRange.emptyRange.toString());
+
+ FeatureEntry entries[] = feature.getEntries();
+ RequiredCapability[] required = new RequiredCapability[entries.length];
+ for (int i = 0; i < entries.length; i++) {
+ VersionRange range = getVersionRange(entries[i]);
+ required[i] = new RequiredCapability(IU_NAMESPACE, getTransformedId(entries[i].getId(), entries[i].isPlugin()), range, getFilter(entries[i]), entries[i].isOptional(), false);
+ }
+ iu.setRequiredCapabilities(required);
+ iu.setTouchpointType(TouchpointType.NONE);
+ ProvidedCapability groupCapability = new ProvidedCapability(IInstallableUnit.IU_KIND_NAMESPACE, "group", new Version("1.0.0"));
+ iu.setCapabilities(new ProvidedCapability[] {groupCapability});
+ return iu;
+ }
+
+ public static String getFilter(FeatureEntry entry) {
+ StringBuffer result = new StringBuffer();
+ result.append("(&"); //$NON-NLS-1$
+ if (entry.getFilter() != null)
+ result.append(entry.getFilter());
+ if (entry.getOS() != null)
+ result.append("(osgi.os=" + entry.getOS() + ')');//$NON-NLS-1$
+ if (entry.getWS() != null)
+ result.append("(osgi.ws=" + entry.getWS() + ')');//$NON-NLS-1$
+ if (entry.getArch() != null)
+ result.append("(osgi.arch=" + entry.getArch() + ')');//$NON-NLS-1$
+ if (entry.getNL() != null)
+ result.append("(osgi.nl=" + entry.getNL() + ')');//$NON-NLS-1$
+ if (result.length() == 2)
+ return null;
+ result.append(')');
+ return result.toString();
+ }
+
+ private static boolean isOptional(ImportPackageSpecification importedPackage) {
+ if (importedPackage.getDirective(Constants.RESOLUTION_DIRECTIVE).equals(ImportPackageSpecification.RESOLUTION_DYNAMIC) || importedPackage.getDirective(Constants.RESOLUTION_DIRECTIVE).equals(ImportPackageSpecification.RESOLUTION_OPTIONAL))
+ return true;
+ return false;
+ }
+
+ private static String toManifestString(Map p) {
+ if (p == null)
+ return null;
+ Collection properties = p.entrySet();
+ StringBuffer result = new StringBuffer();
+ for (Iterator iterator = properties.iterator(); iterator.hasNext();) {
+ Map.Entry aProperty = (Map.Entry) iterator.next();
+ result.append(aProperty.getKey()).append(": ").append(aProperty.getValue()).append('\n');
+ }
+ return result.toString();
+ }
+
+ public static IArtifactKey createEclipseArtifactKey(String bsn, String version) {
+ return new ArtifactKey(ECLIPSE_ARTIFACT_NAMESPACE, ECLIPSE_ARTIFACT_CLASSIFIER, bsn, new Version(version));
+ }
+
+ public static IArtifactDescriptor createArtifactDescriptor(IArtifactKey key, File pathOnDisk, boolean asIs, boolean recurse) {
+ //TODO this size calculation is bogus
+ ArtifactDescriptor result = new ArtifactDescriptor(key);
+ if (pathOnDisk != null)
+ result.setProperty(IArtifactDescriptor.ARTIFACT_SIZE, Long.toString(pathOnDisk.length()));
+ return result;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/URLEntry.java b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/URLEntry.java
new file mode 100644
index 000000000..fb628f82d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/prov/metadata/generator/URLEntry.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.equinox.prov.metadata.generator;
+
+public class URLEntry {
+ private String annotation;
+ private String url;
+
+ public URLEntry() {
+ }
+
+ public URLEntry(String url, String annotation) {
+ this.url = url;
+ this.annotation = annotation;
+ }
+
+ public void setAnnotation(String annotation) {
+ this.annotation = annotation;
+ }
+
+ public String getAnnotation() {
+ return annotation;
+ }
+
+ public void setURL(String url) {
+ this.url = url;
+ }
+
+ public String getURL() {
+ return url;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/.classpath b/bundles/org.eclipse.equinox.p2.metadata.repository/.classpath
new file mode 100644
index 000000000..7cdeb7319
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/CDC-1.1%Foundation-1.1"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/.project b/bundles/org.eclipse.equinox.p2.metadata.repository/.project
new file mode 100644
index 000000000..4920152f0
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.equinox.prov.metadata.repository</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.metadata.repository/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..78523cd05
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,331 @@
+#Thu Aug 16 11:00:59 EDT 2007
+eclipse.preferences.version=1
+org.eclipse.jdt.core.builder.cleanOutputFolder=clean
+org.eclipse.jdt.core.builder.duplicateResourceTask=warning
+org.eclipse.jdt.core.builder.invalidClasspath=abort
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
+org.eclipse.jdt.core.circularClasspath=error
+org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
+org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=error
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=false
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false
+org.eclipse.jdt.core.formatter.comment.format_line_comments=false
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=800
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.incompatibleJDKLevel=ignore
+org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.p2.metadata.repository/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 000000000..6b7580c4a
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,57 @@
+#Sun Sep 23 11:58:22 EDT 2007
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_core
+formatter_settings_version=11
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=;
+org.eclipse.jdt.ui.ondemandthreshold=3
+org.eclipse.jdt.ui.staticondemandthreshold=3
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates/>
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.format_source_code=true
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_variable_declarations_final=true
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=false
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/.settings/org.eclipse.pde.core.prefs b/bundles/org.eclipse.equinox.p2.metadata.repository/.settings/org.eclipse.pde.core.prefs
new file mode 100644
index 000000000..7913d20db
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/.settings/org.eclipse.pde.core.prefs
@@ -0,0 +1,4 @@
+
+eclipse.preferences.version=1
+pluginProject.extensions=false
+resolve.requirebundle=false
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.metadata.repository/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..2bf58ea42
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/META-INF/MANIFEST.MF
@@ -0,0 +1,27 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Metadata Repository Plug-in (Incubation)
+Bundle-SymbolicName: org.eclipse.equinox.prov.metadata.repository;singleton:=true
+Bundle-Version: 0.1.0.qualifier
+Export-Package: org.eclipse.equinox.internal.prov.metadata.repository;x-friends:="org.eclipse.equinox.prov.metadata.generator",
+ org.eclipse.equinox.prov.metadata.repository
+Import-Package: com.thoughtworks.xstream,
+ org.eclipse.core.runtime.preferences,
+ org.eclipse.equinox.prov.core.eventbus,
+ org.eclipse.equinox.prov.core.helpers,
+ org.eclipse.equinox.prov.core.location,
+ org.eclipse.equinox.prov.core.repository,
+ org.eclipse.equinox.prov.engine,
+ org.eclipse.equinox.prov.metadata,
+ org.eclipse.equinox.prov.query,
+ org.eclipse.osgi.service.datalocation;version="1.0.0",
+ org.eclipse.osgi.service.resolver;version="1.1.0",
+ org.eclipse.osgi.util;version="1.1.0",
+ org.osgi.framework;version="1.3.0",
+ org.osgi.service.prefs;version="1.1.0"
+Bundle-Activator: org.eclipse.equinox.internal.prov.metadata.repository.Activator
+Eclipse-LazyStart: true
+Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
+ J2SE-1.4
+Require-Bundle: org.eclipse.equinox.common,
+ org.eclipse.equinox.registry
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/about.html b/bundles/org.eclipse.equinox.p2.metadata.repository/about.html
new file mode 100644
index 000000000..460233046
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 2, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/build.properties b/bundles/org.eclipse.equinox.p2.metadata.repository/build.properties
new file mode 100644
index 000000000..3c0365f46
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/build.properties
@@ -0,0 +1,16 @@
+###############################################################################
+# Copyright (c) 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html,\
+ plugin.xml
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/plugin.xml b/bundles/org.eclipse.equinox.p2.metadata.repository/plugin.xml
new file mode 100644
index 000000000..1f0220749
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/plugin.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension-point id="metadataRepositories" name="Metadata Repositories" schema="schema/metadataRepositories.exsd"/>
+ <extension id="simpleRepository" point="org.eclipse.equinox.prov.metadata.repository.metadataRepositories">
+ <filter suffix="content.xml"/>
+ <factory class="org.eclipse.equinox.internal.prov.metadata.repository.SimpleMetadataRepositoryFactory"/>
+ </extension>
+</plugin>
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/schema/metadataRepositories.exsd b/bundles/org.eclipse.equinox.p2.metadata.repository/schema/metadataRepositories.exsd
new file mode 100644
index 000000000..e010ff809
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/schema/metadataRepositories.exsd
@@ -0,0 +1,124 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.equinox.prov.metadata.repository">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.equinox.prov.metadata.repository" id="metadataRepositories" name="Metadata Repositories"/>
+ </appInfo>
+ <documentation>
+ This extension point is used to provide artifact repository implementations
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="factory"/>
+ <element ref="filter" minOccurs="0" maxOccurs="1"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="factory">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ the fully-qualified name of a class which implements
+&lt;samp&gt;org.eclipse.equinox.prov.artifact.repository.IArtifactRepository&lt;/samp&gt;.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.equinox.prov.artifact.repository.IArtifactRepository"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="filter">
+ <complexType>
+ <attribute name="suffix" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ org.eclipse.equinox.prov.artifact.repository 0.1.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ The value of the class attribute must represent an
+implementor of &lt;tt&gt;org.eclipse.equinox.prov.artifact.repository.IArtifactRepository&lt;/tt&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2007 IBM Corporation and others.&lt;br&gt;
+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 &lt;a
+href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/prov/metadata/repository/AbstractMetadataRepository.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/prov/metadata/repository/AbstractMetadataRepository.java
new file mode 100644
index 000000000..11600a73c
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/prov/metadata/repository/AbstractMetadataRepository.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.metadata.repository;
+
+import java.util.HashSet;
+import org.eclipse.equinox.prov.core.helpers.OrderedProperties;
+import org.eclipse.equinox.prov.core.helpers.UnmodifiableProperties;
+import org.eclipse.equinox.prov.core.repository.IRepositoryInfo;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepository;
+
+public abstract class AbstractMetadataRepository implements IMetadataRepository, IRepositoryInfo {
+
+ protected String name;
+ protected String type;
+ protected String version;
+ protected String description;
+ protected String provider;
+ protected OrderedProperties properties = new OrderedProperties();
+ protected HashSet units = new HashSet();
+
+ protected AbstractMetadataRepository(String name, String type, String version) {
+ super();
+ this.name = name;
+ this.type = type;
+ this.version = version;
+ this.description = ""; //$NON-NLS-1$
+ this.provider = ""; //$NON-NLS-1$
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public String getProvider() {
+ return provider;
+ }
+
+ public UnmodifiableProperties getProperties() {
+ return new UnmodifiableProperties(properties);
+ }
+
+ public Object getAdapter(Class adapter) {
+ if (adapter == AbstractMetadataRepository.class || adapter == IMetadataRepository.class || adapter == IRepositoryInfo.class)
+ return this;
+ else
+ return null;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/prov/metadata/repository/Activator.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/prov/metadata/repository/Activator.java
new file mode 100644
index 000000000..7aebe0eb0
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/prov/metadata/repository/Activator.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.metadata.repository;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+ public static final String ID = "org.eclipse.equinox.prov.metadata.repository";
+ public static final String REPO_PROVIDER_XPT = ID + '.' + "metadataRepositories";
+ public static final String PI_METADATA_REPOSITORY = "org.eclipse.equinox.prov.metadata.repository"; //$NON-NLS-1$
+ private static BundleContext context;
+
+ public static BundleContext getContext() {
+ return context;
+ }
+
+ public void start(BundleContext context) throws Exception {
+ Activator.context = context;
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ Activator.context = null;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/prov/metadata/repository/LocalMetadataRepository.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/prov/metadata/repository/LocalMetadataRepository.java
new file mode 100644
index 000000000..68b8729cd
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/prov/metadata/repository/LocalMetadataRepository.java
@@ -0,0 +1,150 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Prashant Deva - Bug 194674 [prov] Provide write access to metadata repository
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.metadata.repository;
+
+import java.io.*;
+import java.net.URL;
+import java.util.Arrays;
+import java.util.Iterator;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.equinox.prov.core.helpers.OrderedProperties;
+import org.eclipse.equinox.prov.core.repository.IWritableRepositoryInfo;
+import org.eclipse.equinox.prov.core.repository.RepositoryCreationException;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.metadata.RequiredCapability;
+import org.eclipse.equinox.prov.metadata.repository.IWritableMetadataRepository;
+import org.eclipse.equinox.prov.query.CompoundIterator;
+import org.eclipse.osgi.service.resolver.VersionRange;
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * A metadata repository that resides in the local file system. If the repository
+ * location is a directory, this implementation will traverse the directory structure
+ * and combine any metadata repository files that are found.
+ */
+public class LocalMetadataRepository extends AbstractMetadataRepository implements IWritableMetadataRepository {
+
+ static final private String REPOSITORY_TYPE = LocalMetadataRepository.class.getName();
+ static final private Integer REPOSITORY_VERSION = new Integer(1);
+ static final private String CONTENT_FILENAME = "content.xml"; //$NON-NLS-1$
+
+ transient private URL location;
+
+ public static File getActualLocation(URL location) {
+ String spec = location.getFile();
+ if (spec.endsWith(CONTENT_FILENAME))
+ return new File(spec);
+ if (spec.endsWith("/")) //$NON-NLS-1$
+ spec += CONTENT_FILENAME;
+ else
+ spec += "/" + CONTENT_FILENAME; //$NON-NLS-1$
+ return new File(spec);
+ }
+
+ public LocalMetadataRepository(URL location, String name) throws RepositoryCreationException {
+ super(name == null ? (location != null ? location.toExternalForm() : "") : name, REPOSITORY_TYPE, REPOSITORY_VERSION.toString());
+ if (!location.getProtocol().equals("file")) //$NON-NLS-1$
+ throw new IllegalArgumentException("Invalid local repository location: " + location);
+ this.location = location;
+ }
+
+ public IInstallableUnit[] getInstallableUnits(IProgressMonitor monitor) {
+ if (monitor == null) {
+ monitor = new NullProgressMonitor();
+ }
+ monitor.beginTask(NLS.bind(Messages.REPO_LOADING, location.toExternalForm()), 5);
+ IInstallableUnit[] result = query(null, null, null, false, monitor);
+ monitor.done();
+ return result;
+ }
+
+ public Iterator getIterator(String id, VersionRange range, RequiredCapability[] requirements, boolean and) {
+ return new CompoundIterator(new Iterator[] {units.iterator()}, id, range, requirements, and);
+ }
+
+ public URL getLocation() {
+ return location;
+ }
+
+ public IInstallableUnit[] query(String id, VersionRange range, RequiredCapability[] requirements, boolean and, IProgressMonitor monitor) {
+ return CompoundIterator.asArray(new CompoundIterator(new Iterator[] {units.iterator()}, id, range, requirements, and), null);
+ }
+
+ public void addInstallableUnits(IInstallableUnit[] installableUnits) {
+ units.addAll(Arrays.asList(installableUnits));
+ save();
+ }
+
+ private void save() {
+ File file = getActualLocation(location);
+ try {
+ if (!file.exists()) {
+ if (!file.getParentFile().exists())
+ file.getParentFile().mkdirs();
+ file.createNewFile();
+ }
+ MetadataRepositoryIO.write(this, new FileOutputStream(file));
+ } catch (FileNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ public void removeInstallableUnits(IInstallableUnit[] installableUnits) {
+ units.remove(Arrays.asList(installableUnits));
+ save();
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setType(String type) throws UnsupportedOperationException {
+ throw new UnsupportedOperationException("The type of a local metadata repository cannot be changed."); //$NON-NLS-1$
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public void setProvider(String provider) {
+ this.provider = provider;
+ }
+
+ public OrderedProperties getModifiableProperties() {
+ return properties;
+ }
+
+ public Object getAdapter(Class adapter) {
+ if (adapter == LocalMetadataRepository.class || adapter == IWritableMetadataRepository.class || adapter == IWritableRepositoryInfo.class)
+ return this;
+ return super.getAdapter(adapter);
+ }
+
+ public void removeAll() {
+ units.clear();
+ save();
+ }
+
+ // use this method to setup any transient fields etc after the object has been restored from a stream
+ public void initializeAfterLoad(URL location) {
+ this.location = location;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/prov/metadata/repository/Messages.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/prov/metadata/repository/Messages.java
new file mode 100644
index 000000000..4a95ec0ce
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/prov/metadata/repository/Messages.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.internal.prov.metadata.repository;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.equinox.internal.prov.metadata.repository.messages"; //$NON-NLS-1$
+
+ static {
+ // initialize resource bundles
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ // Do not instantiate
+ }
+
+ public static String REPO_LOADING;
+ public static String REPOMGR_ADDING_REPO;
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/prov/metadata/repository/MetadataCache.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/prov/metadata/repository/MetadataCache.java
new file mode 100644
index 000000000..f1916b8c8
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/prov/metadata/repository/MetadataCache.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.metadata.repository;
+
+import java.io.*;
+import java.net.URL;
+import java.util.EventObject;
+import org.eclipse.equinox.prov.core.eventbus.ProvisioningEventBus;
+import org.eclipse.equinox.prov.core.eventbus.ProvisioningListener;
+import org.eclipse.equinox.prov.core.repository.RepositoryCreationException;
+import org.eclipse.equinox.prov.engine.*;
+import org.eclipse.equinox.prov.metadata.IResolvedInstallableUnit;
+import org.osgi.framework.ServiceReference;
+
+public class MetadataCache extends URLMetadataRepository {
+
+ static final private String REPOSITORY_NAME = "Agent Metadata Cache"; //$NON-NLS-1$
+ static final private String REPOSITORY_TYPE = MetadataCache.class.getName();
+ static final private Integer REPOSITORY_VERSION = new Integer(1);
+
+ transient private ServiceReference busReference;
+ transient private ProvisioningEventBus bus;
+
+ // These are always created with file: URLs. At least for now...
+ public MetadataCache(URL repoPath) throws RepositoryCreationException {
+ super(REPOSITORY_NAME, REPOSITORY_TYPE, REPOSITORY_VERSION.toString());
+ this.location = repoPath;
+ content = getActualLocation(location);
+ new SimpleMetadataRepositoryFactory().load(location);
+ // Set property indicating that the metadata cache is an implementation detail.
+ this.properties.setProperty(IMPLEMENTATION_ONLY_KEY, Boolean.valueOf(true).toString());
+
+ // TODO: We should check for writing permission here, otherwise it may be too late
+ busReference = Activator.getContext().getServiceReference(ProvisioningEventBus.class.getName());
+ bus = (ProvisioningEventBus) Activator.getContext().getService(busReference);
+ bus.addListener(new ProvisioningListener() {
+ public void notify(EventObject o) {
+ if (o instanceof InstallableUnitEvent) { //TODO This dependency on InstallableUnitEvent is not great
+ InstallableUnitEvent event = (InstallableUnitEvent) o;
+ if (event.isPre())
+ return;
+ //TODO what about update and uninstall??
+ if (event.isPost() && event.getResult().isOK()) {
+ IResolvedInstallableUnit installedIU = event.getOperand().second();
+ if (installedIU != null)
+ units.add(installedIU.getOriginal());
+ return;
+ }
+ }
+ if (o instanceof CommitOperationEvent)
+ persist();
+ if (o instanceof RollbackOperationEvent)
+ new SimpleMetadataRepositoryFactory().restore(MetadataCache.this, location);
+ }
+ });
+ }
+
+ protected void persist() {
+ if (!getContentURL().getProtocol().equals("file"))
+ throw new IllegalStateException("only file: URLs are supported for the metadata cache");
+ File contentFile = new File(getContentURL().getFile());
+ if (!contentFile.getParentFile().exists() && !contentFile.getParentFile().mkdirs())
+ throw new RuntimeException("can't persist the metadata cache");
+ try {
+ OutputStream outputStream = new BufferedOutputStream(new FileOutputStream(contentFile, false));;
+ MetadataRepositoryIO.write(this, outputStream);
+ } catch (FileNotFoundException e) {
+ throw new RuntimeException("can't persist the metadata cache");
+ }
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/prov/metadata/repository/MetadataRepositoryIO.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/prov/metadata/repository/MetadataRepositoryIO.java
new file mode 100644
index 000000000..b76f1f401
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/prov/metadata/repository/MetadataRepositoryIO.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Prashant Deva - Bug 194674 [prov] Provide write access to metadata repository
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.metadata.repository;
+
+import com.thoughtworks.xstream.XStream;
+import java.io.*;
+import org.eclipse.equinox.prov.core.repository.RepositoryCreationException;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepository;
+
+/**
+ * This class reads and writes provisioning metadata.
+ * The implementation currently uses XStream.
+ */
+class MetadataRepositoryIO {
+
+ /**
+ * Reads metadata from the given stream, and returns the contained array
+ * of abstract metadata repositories.
+ * This method performs buffering, and closes the stream when finished.
+ */
+ public static IMetadataRepository read(InputStream input) throws RepositoryCreationException {
+ XStream stream = new XStream();
+ BufferedInputStream bufferedInput = null;
+ try {
+ try {
+ bufferedInput = new BufferedInputStream(input);
+ return (IMetadataRepository) stream.fromXML(bufferedInput);
+ } finally {
+ if (bufferedInput != null)
+ bufferedInput.close();
+ }
+ } catch (IOException e) {
+ throw new RepositoryCreationException(e);
+ }
+ }
+
+ public static void write(AbstractMetadataRepository repository, OutputStream output) {
+ XStream stream = new XStream();
+ OutputStream bufferedOutput = null;
+ try {
+ try {
+ bufferedOutput = new BufferedOutputStream(output);
+ stream.toXML(repository, bufferedOutput);
+ } finally {
+ if (bufferedOutput != null)
+ bufferedOutput.close();
+ }
+ } catch (FileNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/prov/metadata/repository/MetadataRepositoryManager.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/prov/metadata/repository/MetadataRepositoryManager.java
new file mode 100644
index 000000000..8c9651e5f
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/prov/metadata/repository/MetadataRepositoryManager.java
@@ -0,0 +1,294 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.internal.prov.metadata.repository;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.preferences.ConfigurationScope;
+import org.eclipse.equinox.prov.core.helpers.*;
+import org.eclipse.equinox.prov.core.location.AgentLocation;
+import org.eclipse.equinox.prov.core.repository.RepositoryCreationException;
+import org.eclipse.equinox.prov.metadata.repository.*;
+import org.eclipse.osgi.util.NLS;
+import org.osgi.service.prefs.BackingStoreException;
+import org.osgi.service.prefs.Preferences;
+
+public class MetadataRepositoryManager implements IMetadataRepositoryManager {
+ private static final String FACTORY = "factory"; //$NON-NLS-1$
+
+ private static final String NODE_REPOSITORIES = "repositories"; //$NON-NLS-1$
+ private static final String KEY_DESCRIPTION = "description"; //$NON-NLS-1$
+ private static final String KEY_NAME = "name"; //$NON-NLS-1$
+ private static final String KEY_PROVIDER = "provider"; //$NON-NLS-1$
+ private static final String KEY_TYPE = "type"; //$NON-NLS-1$
+ private static final String KEY_URL = "url"; //$NON-NLS-1$
+ private static final String KEY_VERSION = "version"; //$NON-NLS-1$
+
+ private List repositories = Collections.synchronizedList(new ArrayList());
+
+ public MetadataRepositoryManager() {
+ restoreRepositories();
+ }
+
+ public void addRepository(IMetadataRepository repository) {
+ repositories.add(repository);
+ // save the given repository in the preferences.
+ remember(repository);
+ }
+
+ /*
+ * Restore the list of repositories from the preference store.
+ */
+ private void restoreFromPreferences() {
+ // restore the list of repositories from the preference store
+ Preferences node = getPreferences();
+ String[] children;
+ try {
+ children = node.childrenNames();
+ } catch (BackingStoreException e) {
+ log("Error restoring repositories from preferences", e); //$NON-NLS-1$
+ return;
+ }
+ for (int i = 0; i < children.length; i++) {
+ Preferences child = node.node(children[i]);
+ String url = child.get(KEY_URL, null);
+ if (url == null)
+ continue;
+ try {
+ IMetadataRepository repository = loadRepository(new URL(url), (IProgressMonitor) null);
+ // If we could not restore the repo then remove it from the preferences.
+ if (repository == null)
+ child.removeNode();
+ } catch (MalformedURLException e) {
+ log("Error while restoring repository: " + url, e); //$NON-NLS-1$
+ } catch (BackingStoreException e) {
+ log("Error while restoring repository: " + url, e); //$NON-NLS-1$
+ }
+ }
+ }
+
+ /*
+ * Save the list of repositories in the preference store.
+ */
+ private void remember(IMetadataRepository repository) {
+ Preferences node = getPreferences().node(getKey(repository));
+ String value = repository.getLocation().toExternalForm();
+ node.put(KEY_URL, value);
+ value = repository.getDescription();
+ if (value != null)
+ node.put(KEY_DESCRIPTION, value);
+ value = repository.getName();
+ if (value != null)
+ node.put(KEY_NAME, value);
+ value = repository.getProvider();
+ if (value != null)
+ node.put(KEY_PROVIDER, value);
+ value = repository.getType();
+ if (value != null)
+ node.put(KEY_TYPE, value);
+ value = repository.getVersion();
+ if (value != null)
+ node.put(KEY_VERSION, value);
+ saveRepositoryList();
+ }
+
+ /*
+ * Return a string key suitable based on the given repository which
+ * is suitable for use as a preference node name.
+ */
+ private String getKey(IMetadataRepository repository) {
+ return repository.getLocation().toExternalForm().replace('/', '_');
+ }
+
+ public IMetadataRepository loadRepository(URL location, IProgressMonitor progress) {
+ // TODO do some thing with the monitor
+ IMetadataRepository result = getRepository(location);
+ if (result != null)
+ return result;
+ String[] suffixes = getAllSuffixes();
+ if (progress == null)
+ progress = new NullProgressMonitor();
+ progress.beginTask(NLS.bind(Messages.REPOMGR_ADDING_REPO, location.toExternalForm()), 1);
+ for (int i = 0; i < suffixes.length; i++) {
+ result = loadRepository(location, suffixes[i]);
+ if (result != null) {
+ addRepository(result);
+ progress.done();
+ return result;
+ }
+ }
+ progress.done();
+ return null;
+ }
+
+ private String[] getAllSuffixes() {
+ IConfigurationElement[] elements = RegistryFactory.getRegistry().getConfigurationElementsFor(Activator.REPO_PROVIDER_XPT);
+ ArrayList result = new ArrayList(elements.length);
+ for (int i = 0; i < elements.length; i++)
+ if (elements[i].getName().equals("filter"))
+ result.add(elements[i].getAttribute("suffix"));
+ return (String[]) result.toArray(new String[result.size()]);
+ }
+
+ // TODO This method really should not be here. There could be lots of different kinds of
+ // repositories and many different ways to create them.
+ // for now discriminate by the type of URL but this is bogus.
+ public IMetadataRepository createRepository(URL location, String name, String type) {
+ IMetadataRepository result = loadRepository(location, (IProgressMonitor) null);
+ if (result != null)
+ return result;
+ IExtension extension = RegistryFactory.getRegistry().getExtension(Activator.REPO_PROVIDER_XPT, type);
+ if (extension == null)
+ return null;
+ try {
+ IMetadataRepositoryFactory factory = (IMetadataRepositoryFactory) createExecutableExtension(extension, FACTORY);
+ if (factory == null)
+ return null;
+ result = factory.create(location, name, type);
+ if (result != null)
+ addRepository(result);
+ return result;
+ } catch (CoreException e) {
+ return null;
+ }
+ }
+
+ /**
+ * Try to load a pre-existing repo at the given location
+ */
+ // TODO this method should do some repo type discovery something like is done with
+ // the artifact repos. For now just discriminate on the type of URL
+ private IMetadataRepository loadRepository(URL location, String suffix) {
+ IExtension[] providers = findMatchingRepositoryExtensions(suffix);
+ // Loop over the candidates and return the first one that successfully loads
+ for (int i = 0; i < providers.length; i++)
+ try {
+ IMetadataRepositoryFactory factory = (IMetadataRepositoryFactory) createExecutableExtension(providers[i], FACTORY);
+ if (factory != null)
+ return factory.load(location);
+ } catch (CoreException e) {
+ log("Error loading repository extension: " + providers[i].getUniqueIdentifier(), e); //$NON-NLS-1$
+ }
+ return null;
+ }
+
+ public IMetadataRepository[] getKnownRepositories() {
+ return (IMetadataRepository[]) repositories.toArray(new IMetadataRepository[repositories.size()]);
+ }
+
+ public IMetadataRepository getRepository(URL location) {
+ if (repositories == null)
+ restoreRepositories();
+ for (Iterator iterator = repositories.iterator(); iterator.hasNext();) {
+ IMetadataRepository match = (IMetadataRepository) iterator.next();
+ if (Utils.sameURL(match.getLocation(), location))
+ return match;
+ }
+ return null;
+ }
+
+ protected void log(String message, Throwable t) {
+ LogHelper.log(new Status(IStatus.ERROR, Activator.PI_METADATA_REPOSITORY, message, t));
+ }
+
+ public void removeRepository(IMetadataRepository toRemove) {
+ repositories.remove(toRemove);
+ // remove the repository from the preference store
+ try {
+ getPreferences().node(getKey(toRemove)).removeNode();
+ saveRepositoryList();
+ } catch (BackingStoreException e) {
+ log("Error saving preferences", e); //$NON-NLS-1$
+ }
+ }
+
+ public void restoreRepositories() {
+ //TODO we may want to have proxies on repo instead of the real repo object to limit what is activated.
+ URL path = null;
+ try {
+ AgentLocation location = (AgentLocation) ServiceHelper.getService(Activator.getContext(), AgentLocation.class.getName());
+ if (location == null)
+ // TODO should do something here since we are failing to restore.
+ return;
+ path = location.getMetadataRepositoryURL();
+ repositories.add(new MetadataCache(path));
+ } catch (RepositoryCreationException e) {
+ log("Error while restoring repository " + path, e);
+ }
+ try {
+ String locationString = Activator.getContext().getProperty("eclipse.prov.metadataRepository");
+ if (locationString != null) {
+ StringTokenizer tokenizer = new StringTokenizer(locationString, ",");
+ while (tokenizer.hasMoreTokens()) {
+ try {
+ path = new URL(tokenizer.nextToken());
+ loadRepository(path, (IProgressMonitor) null);
+ } catch (MalformedURLException e) {
+ throw new RepositoryCreationException(e);
+ }
+ }
+ }
+ } catch (RepositoryCreationException e) {
+ log("Error while restoring repository " + path, e);
+ }
+ // load the list which is stored in the preferences
+ restoreFromPreferences();
+ }
+
+ /*
+ * Return the preference node which is the root for where we store the repository information.
+ */
+ private Preferences getPreferences() {
+ return new ConfigurationScope().getNode(Activator.PI_METADATA_REPOSITORY).node(NODE_REPOSITORIES);
+ }
+
+ /*
+ * Save the repository list in the file-system
+ */
+ private void saveRepositoryList() {
+ try {
+ getPreferences().flush();
+ } catch (BackingStoreException e) {
+ log("Error while saving repositories in preferences", e);
+ }
+ }
+
+ private Object createExecutableExtension(IExtension extension, String element) throws CoreException {
+ IConfigurationElement[] elements = extension.getConfigurationElements();
+ for (int i = 0; i < elements.length; i++) {
+ if (elements[i].getName().equals(element))
+ return elements[i].createExecutableExtension("class");
+ }
+ throw new CoreException(new Status(IStatus.ERROR, Activator.ID, "Malformed extension"));
+ }
+
+ private IExtension[] findMatchingRepositoryExtensions(String suffix) {
+ IConfigurationElement[] elt = RegistryFactory.getRegistry().getConfigurationElementsFor(Activator.REPO_PROVIDER_XPT);
+ int count = 0;
+ for (int i = 0; i < elt.length; i++) {
+ if (elt[i].getName().equals("filter")) {
+ if (!elt[i].getAttribute("suffix").equals(suffix)) {
+ elt[i] = null;
+ } else {
+ count++;
+ }
+ } else {
+ elt[i] = null;
+ }
+ }
+ IExtension[] results = new IExtension[count];
+ for (int i = 0; i < elt.length; i++) {
+ if (elt[i] != null)
+ results[--count] = elt[i].getDeclaringExtension();
+ }
+ return results;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/prov/metadata/repository/SimpleMetadataRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/prov/metadata/repository/SimpleMetadataRepositoryFactory.java
new file mode 100644
index 000000000..99a009631
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/prov/metadata/repository/SimpleMetadataRepositoryFactory.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.metadata.repository;
+
+import java.io.*;
+import java.net.URL;
+import org.eclipse.equinox.prov.core.repository.RepositoryCreationException;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepository;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepositoryFactory;
+
+public class SimpleMetadataRepositoryFactory implements IMetadataRepositoryFactory {
+
+ public IMetadataRepository load(URL location) {
+ if (location == null)
+ return null;
+ try {
+ InputStream descriptorStream = new BufferedInputStream(URLMetadataRepository.getActualLocation(location).openStream());
+ try {
+ IMetadataRepository result = MetadataRepositoryIO.read(descriptorStream);
+ if (result instanceof LocalMetadataRepository)
+ ((LocalMetadataRepository) result).initializeAfterLoad(location);
+ if (result instanceof URLMetadataRepository)
+ ((URLMetadataRepository) result).initializeAfterLoad(location);
+ return result;
+ } catch (RepositoryCreationException e) {
+ // TODO Auto-generated catch block
+ return null;
+ } finally {
+ if (descriptorStream != null)
+ descriptorStream.close();
+ }
+ } catch (IOException e) {
+ //TODO: log and throw?
+ }
+ return null;
+ }
+
+ public IMetadataRepository create(URL location, String name, String type) {
+ try {
+ if (location.getProtocol().equals("file")) //$NON-NLS-1$
+ return new LocalMetadataRepository(location, name);
+ return new URLMetadataRepository(location, name);
+ } catch (RepositoryCreationException e) {
+ // if the exception has no cause then it was just a missing repo so we'll return null
+ return null;
+ }
+ }
+
+ public void restore(AbstractMetadataRepository repository, URL location) {
+ AbstractMetadataRepository source = (AbstractMetadataRepository) load(location);
+ repository.description = source.description;
+ repository.name = source.name;
+ repository.properties = source.properties;
+ repository.provider = source.provider;
+ repository.type = source.type;
+ repository.version = source.version;
+ repository.units = source.units;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/prov/metadata/repository/URLMetadataRepository.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/prov/metadata/repository/URLMetadataRepository.java
new file mode 100644
index 000000000..61f5bc9a8
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/prov/metadata/repository/URLMetadataRepository.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Prashant Deva - Bug 194674 [prov] Provide write access to metadata repository
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.metadata.repository;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Iterator;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.equinox.prov.core.repository.RepositoryCreationException;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.metadata.RequiredCapability;
+import org.eclipse.equinox.prov.query.CompoundIterator;
+import org.eclipse.osgi.service.resolver.VersionRange;
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * A metadata repository backed by an arbitrary URL.
+ */
+public class URLMetadataRepository extends AbstractMetadataRepository {
+
+ static final private String REPOSITORY_TYPE = URLMetadataRepository.class.getName();
+ static final private Integer REPOSITORY_VERSION = new Integer(1);
+ static final protected String CONTENT_FILENAME = "content.xml"; //$NON-NLS-1$
+
+ transient protected URL location;
+ transient protected URL content;
+
+ public static URL getActualLocation(URL base) {
+ String spec = base.toExternalForm();
+ if (spec.endsWith(CONTENT_FILENAME))
+ return base;
+ if (spec.endsWith("/")) //$NON-NLS-1$
+ spec += CONTENT_FILENAME;
+ else
+ spec += "/" + CONTENT_FILENAME; //$NON-NLS-1$
+ try {
+ return new URL(spec);
+ } catch (MalformedURLException e) {
+ return null;
+ }
+ }
+
+ protected URLMetadataRepository(String name, String type, String version) {
+ super(name, type, version);
+ }
+
+ public URLMetadataRepository(URL location, String name) {
+ super(name == null ? (location != null ? location.toExternalForm() : "") : name, REPOSITORY_TYPE, REPOSITORY_VERSION.toString());
+ this.location = location;
+ content = getActualLocation(location);
+ }
+
+ protected boolean load() throws RepositoryCreationException {
+ return new SimpleMetadataRepositoryFactory().load(location) != null;
+ }
+
+ public IInstallableUnit[] getInstallableUnits(IProgressMonitor monitor) {
+ if (monitor == null)
+ monitor = new NullProgressMonitor();
+ monitor.beginTask(NLS.bind(Messages.REPO_LOADING, location.toExternalForm()), 5);
+ IInstallableUnit[] result = (IInstallableUnit[]) units.toArray(new IInstallableUnit[units.size()]);
+ monitor.done();
+ return result;
+ }
+
+ public URL getLocation() {
+ return location;
+ }
+
+ protected URL getContentURL() {
+ return content;
+ }
+
+ public Iterator getIterator(String id, VersionRange range, RequiredCapability[] requirements, boolean and) {
+ return new CompoundIterator(new Iterator[] {units.iterator()}, id, range, requirements, and);
+ }
+
+ public IInstallableUnit[] query(String id, VersionRange range, RequiredCapability[] requirements, boolean and, IProgressMonitor progress) {
+ return CompoundIterator.asArray(new CompoundIterator(new Iterator[] {units.iterator()}, id, range, requirements, and), null);
+ }
+
+ public Object getAdapter(Class adapter) {
+ if (adapter == URLMetadataRepository.class)
+ return this;
+ else
+ return super.getAdapter(adapter);
+ }
+
+ // use this method to setup any transient fields etc after the object has been restored from a stream
+ public void initializeAfterLoad(URL location) {
+ this.location = location;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/prov/metadata/repository/messages.properties b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/prov/metadata/repository/messages.properties
new file mode 100644
index 000000000..fc369d7ab
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/prov/metadata/repository/messages.properties
@@ -0,0 +1,13 @@
+###############################################################################
+# Copyright (c) 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+
+REPO_LOADING = Loading the repository {0}
+REPOMGR_ADDING_REPO = Adding repository {0} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/prov/metadata/repository/IMetadataRepository.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/prov/metadata/repository/IMetadataRepository.java
new file mode 100644
index 000000000..eb55c22fa
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/prov/metadata/repository/IMetadataRepository.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.metadata.repository;
+
+import java.net.URL;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.equinox.prov.core.repository.IRepositoryInfo;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.query.IQueryable;
+
+/**
+ * A metadata repository stores information about a set of installable units
+ * <p>
+ * Clients may implement this interface.
+ * </p>
+ * TODO: This should be an abstract class so methods can be added in the future
+ * without breaking clients.
+ */
+public interface IMetadataRepository extends IRepositoryInfo, IQueryable {
+ /**
+ * Returns all installable units known to this repository.
+ * @param monitor TODO
+ * @return the installable units known to this repository
+ *TODO: Progress monitor? Is the repository expected to be local?
+ */
+ public IInstallableUnit[] getInstallableUnits(IProgressMonitor monitor);
+
+ /**
+ * Returns the URL of this repository.
+ * TODO: Should we use URL or URI? URL requires a protocol handler to be installed
+ * in Java. Can the URL have any protocol? Why are we exposing this at all?
+ * @return the URL of this repository.
+ */
+ public URL getLocation();
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/prov/metadata/repository/IMetadataRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/prov/metadata/repository/IMetadataRepositoryFactory.java
new file mode 100644
index 000000000..e5533326e
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/prov/metadata/repository/IMetadataRepositoryFactory.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.metadata.repository;
+
+import java.net.URL;
+
+public interface IMetadataRepositoryFactory {
+
+ public IMetadataRepository load(URL location);
+
+ public IMetadataRepository create(URL location, String name, String type);
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/prov/metadata/repository/IMetadataRepositoryManager.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/prov/metadata/repository/IMetadataRepositoryManager.java
new file mode 100644
index 000000000..98173d6f6
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/prov/metadata/repository/IMetadataRepositoryManager.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.metadata.repository;
+
+import java.net.URL;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+public interface IMetadataRepositoryManager {
+ /**
+ * Adds a new metadata repository to the set of known repositories.
+ * @param repository
+ */
+ public void addRepository(IMetadataRepository repository);
+
+ /**
+ * Adds a repository corresponding to the given URL.
+ * @param url The URL of the repository to add
+ * @param progress TODO
+ */
+ public IMetadataRepository loadRepository(URL url, IProgressMonitor progress);
+
+ /**
+ * Creates and returns a metadata repository of the given type at the given location.
+ * If a repository already exists at that location <code>null</code> is returned.
+ * @param location the location for the new repository
+ * @param name the name of the new repo
+ * @param type the kind of repository to create
+ * @return the discovered or created repository
+ */
+ public IMetadataRepository createRepository(URL location, String name, String type);
+
+ public IMetadataRepository[] getKnownRepositories();
+
+ public IMetadataRepository getRepository(URL repo); //TODO Should this throw an exception
+
+ public void removeRepository(IMetadataRepository toRemove);
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/prov/metadata/repository/IWritableMetadataRepository.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/prov/metadata/repository/IWritableMetadataRepository.java
new file mode 100644
index 000000000..a22a6e804
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/prov/metadata/repository/IWritableMetadataRepository.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Prashant Deva - Bug 194674 [prov] Provide write access to metadata repository
+ * IBM Corporation - ongoing development
+ *******************************************************************************/
+package org.eclipse.equinox.prov.metadata.repository;
+
+import org.eclipse.equinox.prov.core.repository.IWritableRepositoryInfo;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+
+public interface IWritableMetadataRepository extends IMetadataRepository, IWritableRepositoryInfo {
+
+ void addInstallableUnits(IInstallableUnit[] installableUnit);
+
+ void removeInstallableUnits(IInstallableUnit[] installableUnit);
+
+ /**
+ * Remove IUs from this repository.
+ */
+ public void removeAll();
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/.classpath b/bundles/org.eclipse.equinox.p2.metadata/.classpath
new file mode 100644
index 000000000..7cdeb7319
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/CDC-1.1%Foundation-1.1"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.equinox.p2.metadata/.project b/bundles/org.eclipse.equinox.p2.metadata/.project
new file mode 100644
index 000000000..bd63dce6d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.equinox.prov.metadata</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.equinox.p2.metadata/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.metadata/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..78523cd05
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,331 @@
+#Thu Aug 16 11:00:59 EDT 2007
+eclipse.preferences.version=1
+org.eclipse.jdt.core.builder.cleanOutputFolder=clean
+org.eclipse.jdt.core.builder.duplicateResourceTask=warning
+org.eclipse.jdt.core.builder.invalidClasspath=abort
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
+org.eclipse.jdt.core.circularClasspath=error
+org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
+org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=error
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=false
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false
+org.eclipse.jdt.core.formatter.comment.format_line_comments=false
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=800
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.incompatibleJDKLevel=ignore
+org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/bundles/org.eclipse.equinox.p2.metadata/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.p2.metadata/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 000000000..f3f395b81
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,57 @@
+#Sun Sep 23 11:58:15 EDT 2007
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_core
+formatter_settings_version=11
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=;
+org.eclipse.jdt.ui.ondemandthreshold=3
+org.eclipse.jdt.ui.staticondemandthreshold=3
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates/>
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.format_source_code=true
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_variable_declarations_final=true
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=false
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/bundles/org.eclipse.equinox.p2.metadata/.settings/org.eclipse.pde.core.prefs b/bundles/org.eclipse.equinox.p2.metadata/.settings/org.eclipse.pde.core.prefs
new file mode 100644
index 000000000..7913d20db
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata/.settings/org.eclipse.pde.core.prefs
@@ -0,0 +1,4 @@
+
+eclipse.preferences.version=1
+pluginProject.extensions=false
+resolve.requirebundle=false
diff --git a/bundles/org.eclipse.equinox.p2.metadata/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.metadata/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..be3a5230d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata/META-INF/MANIFEST.MF
@@ -0,0 +1,19 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Metadata Plug-in (Incubation)
+Bundle-SymbolicName: org.eclipse.equinox.prov.metadata
+Bundle-Version: 0.1.0.qualifier
+Export-Package: org.eclipse.equinox.internal.prov.metadata;x-friends:="org.eclipse.equinox.prov.metadata.generator",
+ org.eclipse.equinox.prov.metadata,
+ org.eclipse.equinox.prov.query,
+ org.eclipse.equinox.prov.resolution
+Import-Package: org.eclipse.osgi.service.resolver;version="1.1.0",
+ org.eclipse.osgi.util;version="1.1.0",
+ org.osgi.framework;version="1.3.0"
+Bundle-Activator: org.eclipse.equinox.internal.prov.metadata.MetadataActivator
+Eclipse-LazyStart: true
+Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
+ J2SE-1.4
+Require-Bundle: org.eclipse.equinox.common,
+ com.thoughtworks.xstream,
+ org.eclipse.equinox.prov.core
diff --git a/bundles/org.eclipse.equinox.p2.metadata/about.html b/bundles/org.eclipse.equinox.p2.metadata/about.html
new file mode 100644
index 000000000..460233046
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 2, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.metadata/build.properties b/bundles/org.eclipse.equinox.p2.metadata/build.properties
new file mode 100644
index 000000000..475da1dec
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata/build.properties
@@ -0,0 +1,15 @@
+###############################################################################
+# Copyright (c) 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/prov/metadata/ArtifactKey.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/prov/metadata/ArtifactKey.java
new file mode 100644
index 000000000..71546915b
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/prov/metadata/ArtifactKey.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.metadata;
+
+import org.eclipse.equinox.prov.metadata.IArtifactKey;
+import org.osgi.framework.Version;
+
+/**
+ * The concrete type for representing IArtifactKey's.
+ * <p>
+ * See {link IArtifact for a description of the lifecycle of artifact keys)
+ */
+public class ArtifactKey implements IArtifactKey {
+
+ static final int NO_SEGMENTS = 5;
+ private static final char SEP_CHAR = ',';
+
+ private String namespace;
+ private String id;
+ private String classifier;
+ private transient Version versionObject;
+ private String version;
+
+ public ArtifactKey(String namespace, String classifier, String id, Version aVersion) {
+ super();
+ if (namespace.indexOf(SEP_CHAR) != -1)
+ throw new IllegalArgumentException("comma not allowed in namespace"); //$NON-NLS-1$
+ if (classifier.indexOf(SEP_CHAR) != -1)
+ throw new IllegalArgumentException("comma not allowed in classifier"); //$NON-NLS-1$
+ if (id.indexOf(SEP_CHAR) != -1)
+ throw new IllegalArgumentException("comma not allowed in id"); //$NON-NLS-1$
+ this.namespace = namespace;
+ this.classifier = classifier;
+ this.id = id;
+ this.versionObject = aVersion;
+ this.version = aVersion == null ? null : aVersion.toString();
+ }
+
+ public String getNamespace() {
+ return namespace;
+ }
+
+ public String getClassifier() {
+ return classifier;
+ }
+
+ public Version getVersion() {
+ if (versionObject == null)
+ versionObject = version == null ? Version.emptyVersion : new Version(version);
+ return versionObject;
+ }
+
+ public int hashCode() {
+ int hash = id.hashCode();
+ hash = 17 * hash + getVersion().hashCode();
+ hash = 17 * hash + namespace.hashCode();
+ hash = 17 * hash + classifier.hashCode();
+ return hash;
+ }
+
+ public String toString() {
+ return "ArtifactKey=" + id + '/' + namespace + '/' + classifier + '/' + getVersion(); //$NON-NLS-1$
+ }
+
+ public boolean equals(Object obj) {
+ if (!(obj instanceof ArtifactKey))
+ return false;
+ ArtifactKey ak = (ArtifactKey) obj;
+ return ak.id.equals(id) && ak.getVersion().equals(getVersion()) && ak.namespace.equals(namespace) && ak.classifier.equals(classifier);
+ }
+
+ public String getId() {
+ return id;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/prov/metadata/InternalInstallableUnit.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/prov/metadata/InternalInstallableUnit.java
new file mode 100644
index 000000000..6ab875e14
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/prov/metadata/InternalInstallableUnit.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.internal.prov.metadata;
+
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.metadata.IResolvedInstallableUnit;
+
+public interface InternalInstallableUnit extends IInstallableUnit {
+ public IResolvedInstallableUnit getResolved();
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/prov/metadata/Messages.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/prov/metadata/Messages.java
new file mode 100644
index 000000000..00c7aef16
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/prov/metadata/Messages.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.metadata;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.equinox.internal.prov.metadata.messages"; //$NON-NLS-1$
+
+ static {
+ // load message values from bundle file and assign to fields below
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ public static String QUERY_PROGRESS;
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/prov/metadata/MetadataActivator.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/prov/metadata/MetadataActivator.java
new file mode 100644
index 000000000..9e717f490
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/prov/metadata/MetadataActivator.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.metadata;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class MetadataActivator implements BundleActivator {
+ public static final String PI_METADATA = "org.eclipse.equinox.prov.metadata"; //$NON-NLS-1$
+ public static BundleContext context;
+
+ public static BundleContext getContext() {
+ return context;
+ }
+
+ public void start(BundleContext context) throws Exception {
+ MetadataActivator.context = context;
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ MetadataActivator.context = null;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/prov/metadata/messages.properties b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/prov/metadata/messages.properties
new file mode 100644
index 000000000..138d56215
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/prov/metadata/messages.properties
@@ -0,0 +1,14 @@
+###############################################################################
+# Copyright (c) 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+
+QUERY_PROGRESS=Executing query.
+
+
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/ConstrainableElement.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/ConstrainableElement.java
new file mode 100644
index 000000000..a45c91031
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/ConstrainableElement.java
@@ -0,0 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.metadata;
+
+public class ConstrainableElement {
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/IArtifactKey.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/IArtifactKey.java
new file mode 100644
index 000000000..3f45b9f9c
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/IArtifactKey.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.metadata;
+
+import org.osgi.framework.Version;
+
+/**
+ * Provide standardized artifact information to uniquely identify the
+ * corresponding bytes (perhaps not stored as a file).
+ * <p>
+ * Artifact keys represent both a unique opaque identifier as well as structured
+ * and standardized pieces of information.
+ */
+
+public interface IArtifactKey {
+
+ /**
+ * The namespace.
+ * @return This returns the namespace segment of the artifact. Never
+ * null or empty.
+ */
+ String getNamespace();
+
+ /**
+ * The classifier.
+ * @return This returns the classifier segment of the key. Never
+ * null. Can be empty.
+ */
+ String getClassifier();
+
+ /**
+ * The identity of the artifact.
+ * @return This returns the id segment of the artifact. Can
+ * be empty.
+ *
+ * TODO: consider renaming this to getIdentity.
+ */
+ String getId();
+
+ /**
+ * The version of the artifact.
+ * @return This returns the version of the artifact. Never null. Can
+ * be empty (Version.emptyVersion).
+ */
+ Version getVersion();
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/IInstallableUnit.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/IInstallableUnit.java
new file mode 100644
index 000000000..399747f34
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/IInstallableUnit.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.metadata;
+
+import org.osgi.framework.Version;
+
+public interface IInstallableUnit extends Comparable {
+
+ /**
+ * A capability namespace representing a particular kind of installable unit.
+ * For example, an InstallableUnit may specify that it provides the "group" kind
+ * capability to express that it represents a group of instalable units.
+ */
+ public static final String IU_KIND_NAMESPACE = "org.eclipse.equinox.prov.type"; //$NON-NLS-1$
+ /**
+ * A capability namespace representing a particular InstallableUnit by name.
+ * Each InstallableUnit automatically provides an instance of this namespace representing
+ * itself, and other InstallableUnits can require such a capability to state that they
+ * require a particular InstallableUnit to be present.
+ */
+ public static final String IU_NAMESPACE = "org.eclipse.equinox.prov.iunamespace"; //$NON-NLS-1$
+ /**
+ * A capability namespace representing a particular profile flavor.
+ */
+ public static final String FLAVOR_NAMESPACE = "flavor"; //$NON-NLS-1$
+ //These two constants needs to be moved somewhere more appropriate...
+ public static final String CAPABILITY_ECLIPSE_TYPES = "org.eclipse.equinox.prov.eclipsetouchpoint.types"; //$NON-NLS-1$
+ public static final String CAPABILITY_ECLIPSE_BUNDLE = "bundle"; //$NON-NLS-1$
+
+ public abstract TouchpointType getTouchpointType();
+
+ public abstract String getId();
+
+ /**
+ * Returns the filter on this installable unit. The filter is matched against
+ * the selection context of the profile the unit is installed into. An IU will not
+ * be installed if it has a filter condition that is not satisfied by the context.
+ *
+ * See Profile#getSelectionContext.
+ */
+ public abstract String getFilter();
+
+ public abstract Version getVersion();
+
+ public abstract IArtifactKey[] getArtifacts();
+
+ public abstract RequiredCapability[] getRequiredCapabilities();
+
+ // public ProvidedCapability[] getProvidedCapabilities() {
+ // return providedCapabilities;
+ // }
+ //
+ public abstract ProvidedCapability[] getProvidedCapabilities();
+
+ public abstract boolean isSingleton();
+
+ public abstract String getProperty(String key);
+
+ public abstract TouchpointData[] getTouchpointData();
+
+ public abstract boolean isFragment();
+
+ public abstract String getApplicabilityFilter();
+
+ public abstract void accept(IMetadataVisitor visitor);
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/IInstallableUnitConstants.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/IInstallableUnitConstants.java
new file mode 100644
index 000000000..36c73a0b8
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/IInstallableUnitConstants.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.equinox.prov.metadata;
+
+/**
+ * Definitions for constants associated with InstallableUnits.
+ */
+public interface IInstallableUnitConstants {
+
+ /*
+ * Keys for common properties that optionally
+ * be defined in InstallableUnits.
+ */
+ public String NAME = "equinox.prov.name"; //$NON-NLS-1$
+ public String DESCRIPTION = "equinox.prov.description"; //$NON-NLS-1$
+ public String DOC_URL = "equinox.prov.doc.url"; //$NON-NLS-1$
+ public String PROVIDER = "equinox.prov.provider"; //$NON-NLS-1$
+ public String CONTACT = "equinox.prov.contact"; //$NON-NLS-1$
+ public String LICENSE = "equinox.prov.license"; //$NON-NLS-1$
+ public String COPYRIGHT = "equinox.prov.copyright"; //$NON-NLS-1$
+ public String UPDATE_SITE = "equinox.prov.update.site"; //$NON-NLS-1$
+ public String UPDATE_FROM = "equinox.prov.update.from"; //$NON-NLS-1$
+ public String UPDATE_RANGE = "equinox.prov.update.range"; //$NON-NLS-1$
+
+ //TODO This is not the ideal location for these constants
+ public String ENTRYPOINT_IU_KEY = "entryPoint"; //$NON-NLS-1$
+ public static final String PROFILE_IU_KEY = "profileIU"; //$NON-NLS-1$
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/IInstallableUnitFragment.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/IInstallableUnitFragment.java
new file mode 100644
index 000000000..5f11ed83b
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/IInstallableUnitFragment.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.metadata;
+
+import org.eclipse.osgi.service.resolver.VersionRange;
+
+public interface IInstallableUnitFragment extends IInstallableUnit {
+
+ public abstract String getHostId();
+
+ public abstract VersionRange getHostVersionRange();
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/IMetadataVisitor.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/IMetadataVisitor.java
new file mode 100644
index 000000000..737afd742
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/IMetadataVisitor.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.metadata;
+
+public interface IMetadataVisitor {
+ public void visitInstallableUnit(IInstallableUnit iu);
+
+ public void visitCapability(ProvidedCapability capability);
+
+ public void visitRequiredCapability(RequiredCapability capability);
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/IResolvedInstallableUnit.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/IResolvedInstallableUnit.java
new file mode 100644
index 000000000..e73ad5565
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/IResolvedInstallableUnit.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.metadata;
+
+public interface IResolvedInstallableUnit extends IInstallableUnit {
+
+ public abstract IInstallableUnitFragment[] getFragments();
+
+ public abstract IInstallableUnit getOriginal();
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/IResolvedInstallableUnitFragment.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/IResolvedInstallableUnitFragment.java
new file mode 100644
index 000000000..eb1b34e6a
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/IResolvedInstallableUnitFragment.java
@@ -0,0 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.metadata;
+
+public interface IResolvedInstallableUnitFragment extends IInstallableUnitFragment, IResolvedInstallableUnit {
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/Inclusion.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/Inclusion.java
new file mode 100644
index 000000000..7ba050b2d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/Inclusion.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.metadata;
+
+public abstract class Inclusion {
+ String selectorId;
+
+ public String getSelectorId() {
+ return selectorId;
+ }
+
+ public abstract void accept(IMetadataVisitor visitor);
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/InstallableUnit.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/InstallableUnit.java
new file mode 100644
index 000000000..000911032
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/InstallableUnit.java
@@ -0,0 +1,217 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.metadata;
+
+import org.eclipse.equinox.internal.prov.metadata.InternalInstallableUnit;
+import org.eclipse.equinox.prov.core.helpers.OrderedProperties;
+import org.eclipse.equinox.prov.core.helpers.UnmodifiableProperties;
+import org.osgi.framework.Version;
+
+public class InstallableUnit implements IInstallableUnitConstants, IInstallableUnit, InternalInstallableUnit {
+ private static final RequiredCapability[] NO_REQUIRES = new RequiredCapability[0];
+ private static final OrderedProperties NO_PROPERTIES = new OrderedProperties();
+
+ private String id;
+ private transient Version versionObject;
+ private String version;
+ private boolean singleton;
+
+ private OrderedProperties properties;
+
+ private IArtifactKey[] artifacts;
+ private TouchpointType touchpointType;
+ private TouchpointData immutableTouchpointData;
+
+ private RequiredCapability[] requires;
+
+ private String filter;
+
+ String applicabilityFilter;
+
+ ProvidedCapability[] providedCapabilities = new ProvidedCapability[0];
+
+ public InstallableUnit() {
+ super();
+ }
+
+ public TouchpointType getTouchpointType() {
+ return touchpointType == null ? TouchpointType.NONE : touchpointType;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public String getFilter() {
+ return filter;
+ }
+
+ public Version getVersion() {
+ if (versionObject == null)
+ versionObject = version == null ? Version.emptyVersion : new Version(version);
+ return versionObject;
+ }
+
+ public IArtifactKey[] getArtifacts() {
+ return artifacts;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public void setVersion(Version newVersion) {
+ this.versionObject = newVersion;
+ this.version = newVersion == null ? null : newVersion.toString();
+ }
+
+ public void setTouchpointType(TouchpointType type) {
+ this.touchpointType = type == TouchpointType.NONE ? null : type;
+ }
+
+ public void setArtifacts(IArtifactKey[] value) {
+ artifacts = value;
+ }
+
+ public RequiredCapability[] getRequiredCapabilities() {
+ return requires != null ? requires : NO_REQUIRES;
+
+ }
+
+ public ProvidedCapability[] getProvidedCapabilities() {
+ ProvidedCapability self = new ProvidedCapability(IU_NAMESPACE, id, getVersion());
+ if (providedCapabilities == null)
+ return new ProvidedCapability[] {self};
+
+ ProvidedCapability[] result = new ProvidedCapability[providedCapabilities.length + 1];
+ result[0] = self;
+ System.arraycopy(providedCapabilities, 0, result, 1, providedCapabilities.length);
+ return result;
+ }
+
+ public void setRequiredCapabilities(RequiredCapability[] capabilities) {
+ if (capabilities == NO_REQUIRES) {
+ this.requires = null;
+ } else {
+ //copy array for safety
+ this.requires = (RequiredCapability[]) capabilities.clone();
+ }
+ }
+
+ public void accept(IMetadataVisitor visitor) {
+ visitor.visitInstallableUnit(this);
+ }
+
+ public boolean isSingleton() {
+ return singleton;
+ }
+
+ public void setSingleton(boolean singleton) {
+ this.singleton = singleton;
+ }
+
+ public String getProperty(String key) {
+ return getProperties().getProperty(key);
+ }
+
+ public String setProperty(String key, String value) {
+ if (properties == null)
+ properties = new OrderedProperties();
+ return (String) properties.setProperty(key, value);
+ }
+
+ public String toString() {
+ return id + ' ' + getVersion();
+ }
+
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((id == null) ? 0 : id.hashCode());
+ result = prime * result + ((getVersion() == null) ? 0 : getVersion().hashCode());
+ return result;
+ }
+
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (!(obj instanceof IInstallableUnit))
+ return false;
+ final IInstallableUnit other = (IInstallableUnit) obj;
+ if (id == null) {
+ if (other.getId() != null)
+ return false;
+ } else if (!id.equals(other.getId()))
+ return false;
+ if (getVersion() == null) {
+ if (other.getVersion() != null)
+ return false;
+ } else if (!getVersion().equals(other.getVersion()))
+ return false;
+ return true;
+ }
+
+ public void setFilter(String filter) {
+ this.filter = filter;
+ }
+
+ public TouchpointData[] getTouchpointData() {
+ return immutableTouchpointData == null ? TouchpointData.NO_TOUCHPOINT_DATA : new TouchpointData[] {immutableTouchpointData};
+ }
+
+ public void setImmutableTouchpointData(TouchpointData immutableData) {
+ this.immutableTouchpointData = immutableData;
+ }
+
+ OrderedProperties getProperties() {
+ return properties == null ? NO_PROPERTIES : properties;
+ }
+
+ /**
+ * Get an <i>unmodifiable copy</i> of the properties
+ * associated with the installable unit.
+ *
+ * @return an <i>unmodifiable copy</i> of the IU properties.
+ */
+ public OrderedProperties copyProperties() {
+ return (properties != null ? new UnmodifiableProperties(getProperties()) : new UnmodifiableProperties(new OrderedProperties()));
+ }
+
+ public boolean isFragment() {
+ return false;
+ }
+
+ public void setCapabilities(ProvidedCapability[] exportedCapabilities) {
+ providedCapabilities = exportedCapabilities;
+ }
+
+ public void setApplicabilityFilter(String ldapFilter) {
+ applicabilityFilter = ldapFilter;
+ }
+
+ public String getApplicabilityFilter() {
+ return applicabilityFilter;
+ }
+
+ public IResolvedInstallableUnit getResolved() {
+ return new ResolvedInstallableUnit(this);
+ }
+
+ public int compareTo(Object toCompareTo) {
+ if (!(toCompareTo instanceof IInstallableUnit)) {
+ return -1;
+ }
+ IInstallableUnit other = (IInstallableUnit) toCompareTo;
+ if (getId().compareTo(other.getId()) == 0)
+ return (getVersion().compareTo(other.getVersion()));
+ return getId().compareTo(other.getId());
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/InstallableUnitFragment.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/InstallableUnitFragment.java
new file mode 100644
index 000000000..74180a9c8
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/InstallableUnitFragment.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.metadata;
+
+import org.eclipse.osgi.service.resolver.VersionRange;
+import org.osgi.framework.Version;
+
+public class InstallableUnitFragment extends InstallableUnit implements IInstallableUnitFragment, IInstallableUnit {
+ public static ProvidedCapability FRAGMENT_CAPABILITY = new ProvidedCapability(IU_KIND_NAMESPACE, "iu.fragment", new Version(1, 0, 0));
+
+ private String hostId;
+ private transient VersionRange hostRangeObject;
+ private String hostRange;
+
+ public ProvidedCapability[] getProvidedCapabilities() {
+ ProvidedCapability[] otherCapabilities = super.getProvidedCapabilities();
+ if (otherCapabilities.length == 0)
+ return new ProvidedCapability[] {FRAGMENT_CAPABILITY};
+ ProvidedCapability[] result = new ProvidedCapability[otherCapabilities.length + 1];
+ System.arraycopy(otherCapabilities, 0, result, 1, otherCapabilities.length);
+ result[0] = FRAGMENT_CAPABILITY;
+ return result;
+ }
+
+ public void setHost(String iuId, VersionRange versionRange) {
+ if (iuId == null || versionRange == null)
+ throw new IllegalArgumentException();
+ hostId = iuId;
+ hostRangeObject = versionRange;
+ hostRange = versionRange == null ? null : versionRange.toString();
+ addRequiredCapability(RequiredCapability.createRequiredCapabilityForName(iuId, versionRange, false));
+ }
+
+ public String getHostId() {
+ return hostId;
+ }
+
+ public VersionRange getHostVersionRange() {
+ if (hostRangeObject == null)
+ hostRangeObject = hostRange == null ? VersionRange.emptyRange : new VersionRange(hostRange);
+ return hostRangeObject;
+ }
+
+ private void addRequiredCapability(RequiredCapability toAdd) {
+ RequiredCapability[] current = super.getRequiredCapabilities();
+ RequiredCapability[] result = new RequiredCapability[current.length + 1];
+ System.arraycopy(current, 0, result, 0, current.length);
+ result[current.length] = toAdd;
+ setRequiredCapabilities(result);
+ }
+
+ public boolean isFragment() {
+ return true;
+ }
+
+ public IResolvedInstallableUnit getResolved() {
+ return new ResolvedInstallableUnitFragment(this);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/ProvidedCapability.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/ProvidedCapability.java
new file mode 100644
index 000000000..ffe074ded
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/ProvidedCapability.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.metadata;
+
+import org.osgi.framework.Version;
+
+/**
+ * Describes a capability as exposed or required by an installable unit
+ */
+public class ProvidedCapability {
+ String namespace;
+ String name;
+ transient Version versionObject;
+ String version;
+
+ public String getNamespace() {
+ return namespace;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Version getVersion() {
+ if (versionObject == null)
+ versionObject = version == null ? Version.emptyVersion : new Version(version);
+ return versionObject;
+ }
+
+ public ProvidedCapability(String namespace, String name, Version newVersion) {
+ this.name = name;
+ this.versionObject = newVersion;
+ this.version = newVersion == null ? null : newVersion.toString();
+ this.namespace = namespace;
+ }
+
+ public boolean isSatisfiedBy(RequiredCapability candidate) {
+ if (getName() == null || !getName().equals(candidate.getName()))
+ return false;
+ if (getNamespace() == null || !getNamespace().equals(candidate.getNamespace()))
+ return false;
+ return candidate.getRange().isIncluded(getVersion());
+ }
+
+ public void accept(IMetadataVisitor visitor) {
+ visitor.visitCapability(this);
+ }
+
+ public boolean equals(Object other) {
+ if (other instanceof ProvidedCapability) {
+ ProvidedCapability otherCapability = (ProvidedCapability) other;
+ return otherCapability.namespace.equals(namespace) && otherCapability.name.equals(name) && otherCapability.getVersion().equals(getVersion());
+ }
+ return false;
+ }
+
+ public int hashCode() {
+ return namespace.hashCode() * name.hashCode() * getVersion().hashCode();
+ }
+
+ public String toString() {
+ return namespace + '/' + name + '/' + getVersion();
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/Recommendation.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/Recommendation.java
new file mode 100644
index 000000000..e3ff45ca4
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/Recommendation.java
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.metadata;
+
+import org.eclipse.osgi.service.resolver.VersionRange;
+import org.osgi.framework.Version;
+
+public class Recommendation {
+ private RequiredCapability applyOn;
+ private RequiredCapability newValue;
+
+ public Recommendation(RequiredCapability applyOn2, RequiredCapability newValue2) {
+ this.applyOn = applyOn2;
+ this.newValue = newValue2;
+ }
+
+ public RequiredCapability applyOn() {
+ return applyOn;
+ }
+
+ public RequiredCapability newValue() {
+ return newValue;
+ }
+
+ public boolean matches(RequiredCapability toMatch) {
+ if (!toMatch.getNamespace().equals(applyOn.getNamespace()))
+ return false;
+ if (!toMatch.getName().equals(applyOn.getName()))
+ return false;
+ if (toMatch.getRange().equals(applyOn.getRange()))
+ return true;
+
+ //TODO Here, in the long run we want to be smarter .for example we could check that the range of the match is a subset of the range specified on applyOn.
+ return false;
+ }
+
+ boolean matches(Recommendation toMatch) {
+ return matches(toMatch.applyOn());
+ }
+
+ protected Recommendation merge(Recommendation r2) {
+ VersionRange result = intersect(newValue().getRange(), r2.newValue().getRange());
+ if (result == null)
+ return null;
+ return new Recommendation(applyOn, new RequiredCapability(applyOn.getNamespace(), applyOn.getName(), result));
+ }
+
+ private VersionRange intersect(VersionRange r1, VersionRange r2) {
+ Version resultMin = null;
+ boolean resultMinIncluded = false;
+ Version resultMax = null;
+ boolean resultMaxIncluded = false;
+
+ int minCompare = r1.getMinimum().compareTo(r2.getMinimum());
+ if (minCompare < 0) {
+ resultMin = r2.getMinimum();
+ resultMinIncluded = r2.getIncludeMinimum();
+ } else if (minCompare > 0) {
+ resultMin = r1.getMinimum();
+ resultMinIncluded = r1.getIncludeMinimum();
+ } else if (minCompare == 0) {
+ resultMin = r1.getMinimum();
+ resultMinIncluded = r1.getIncludeMinimum() && r2.getIncludeMinimum();
+ }
+
+ int maxCompare = r1.getMaximum().compareTo(r2.getMaximum());
+ if (maxCompare > 0) {
+ resultMax = r2.getMaximum();
+ resultMaxIncluded = r2.getIncludeMaximum();
+ } else if (maxCompare < 0) {
+ resultMax = r1.getMaximum();
+ resultMaxIncluded = r1.getIncludeMaximum();
+ } else if (maxCompare == 0) {
+ resultMax = r1.getMaximum();
+ resultMaxIncluded = r1.getIncludeMaximum() && r2.getIncludeMaximum();
+ }
+
+ int resultRangeComparison = resultMin.compareTo(resultMax);
+ if (resultRangeComparison < 0)
+ return new VersionRange(resultMin, resultMinIncluded, resultMax, resultMaxIncluded);
+ else if (resultRangeComparison == 0 && resultMinIncluded == resultMaxIncluded)
+ return new VersionRange(resultMin, resultMinIncluded, resultMax, resultMaxIncluded);
+ else
+ return null;
+ }
+
+ public boolean isCompatible(Recommendation other) {
+ return intersect(newValue.getRange(), other.newValue.getRange()) != null;
+ }
+
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((applyOn == null) ? 0 : applyOn.hashCode());
+ result = prime * result + ((newValue == null) ? 0 : newValue.hashCode());
+ return result;
+ }
+
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ final Recommendation other = (Recommendation) obj;
+ if (applyOn == null) {
+ if (other.applyOn != null)
+ return false;
+ } else if (!applyOn.equals(other.applyOn))
+ return false;
+ if (newValue == null) {
+ if (other.newValue != null)
+ return false;
+ } else if (!newValue.equals(other.newValue))
+ return false;
+ return true;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/RecommendationDescriptor.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/RecommendationDescriptor.java
new file mode 100644
index 000000000..4a6722074
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/RecommendationDescriptor.java
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.metadata;
+
+import java.util.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.internal.prov.metadata.MetadataActivator;
+import org.eclipse.osgi.service.resolver.VersionRange;
+
+public class RecommendationDescriptor {
+ public static final String TOUCHPOINT_DATA_KEY = "recommendations";
+ public static final String KIND = "recommendation";
+
+ private Set recommendations;
+
+ public RecommendationDescriptor(Set recommendations) {
+ this.recommendations = recommendations;
+ }
+
+ public Set getRecommendations() {
+ return recommendations;
+ }
+
+ public Recommendation findRecommendation(RequiredCapability toMatch) {
+ for (Iterator iterator = recommendations.iterator(); iterator.hasNext();) {
+ Recommendation name = (Recommendation) iterator.next();
+ if (name.matches(toMatch))
+ return name;
+ }
+ return null;
+ }
+
+ public Recommendation findRecommendation(Recommendation toMatch) {
+ for (Iterator iterator = recommendations.iterator(); iterator.hasNext();) {
+ Recommendation name = (Recommendation) iterator.next();
+ if (name.matches(toMatch))
+ return name;
+ }
+ return null;
+ }
+
+ //Merge the other descriptor into this one. Return an OK Status is the merged succeeded, otherwise return an INFO Status
+ public IStatus merge(RecommendationDescriptor other) {
+ MultiStatus result = null;
+ for (Iterator it = other.recommendations.iterator(); it.hasNext();) {
+ Recommendation otherRecommendation = (Recommendation) it.next();
+ Recommendation matchInThis = findRecommendation(otherRecommendation);
+ if (matchInThis == null) {
+ recommendations.add(otherRecommendation);
+ continue;
+ }
+ Recommendation newRec = otherRecommendation.merge(matchInThis);
+ if (newRec != null) {
+ recommendations.remove(matchInThis);
+ recommendations.add(newRec);
+ continue;
+ } else {
+ if (result == null)
+ result = new MultiStatus(MetadataActivator.PI_METADATA, 0, "Conflict between recommendations", null);
+ result.add(new Status(IStatus.INFO, MetadataActivator.PI_METADATA, "can't merge " + otherRecommendation + " with " + matchInThis));
+ }
+ }
+ if (result == null)
+ return Status.OK_STATUS;
+ return result;
+
+ }
+
+ public static RecommendationDescriptor parse(String descriptor) {
+ StringTokenizer entries = new StringTokenizer(descriptor, "\n");
+ Set recommendations = new HashSet(entries.countTokens());
+ while (entries.hasMoreElements()) {
+ StringTokenizer oneRec = new StringTokenizer((String) entries.nextElement(), "/");
+ if (oneRec.countTokens() != 4) {
+ //format error, ignore and continue
+
+ continue;
+ }
+ String ns = oneRec.nextToken().trim();
+ String name = oneRec.nextToken().trim();
+ String oldRange = oneRec.nextToken().trim();
+ String newRange = oneRec.nextToken().trim();
+ recommendations.add(new Recommendation(new RequiredCapability(ns, name, new VersionRange(oldRange)), new RequiredCapability(ns, name, new VersionRange(newRange))));
+ }
+ return new RecommendationDescriptor(recommendations);
+ }
+
+ public static String serialize(RecommendationDescriptor toSerialize) {
+ StringBuffer result = new StringBuffer();
+ for (Iterator iterator = toSerialize.recommendations.iterator(); iterator.hasNext();) {
+ Recommendation entry = (Recommendation) iterator.next();
+ result.append(entry.applyOn().getNamespace() + '/' + entry.applyOn().getName() + '/' + entry.applyOn().getRange().toString() + '/' + entry.newValue().getRange().toString() + '\n');
+ }
+ return result.toString();
+ }
+
+ public boolean isCompatible(RecommendationDescriptor other) {
+ for (Iterator it = other.recommendations.iterator(); it.hasNext();) {
+ Recommendation otherRecommendation = (Recommendation) it.next();
+ Recommendation matchInThis = findRecommendation(otherRecommendation);
+ if (matchInThis == null) {
+ continue;
+ }
+ if (!otherRecommendation.isCompatible(matchInThis))
+ return false;
+ }
+ return true;
+
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/RequiredCapability.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/RequiredCapability.java
new file mode 100644
index 000000000..3ad8a8ee8
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/RequiredCapability.java
@@ -0,0 +1,158 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.metadata;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.osgi.service.resolver.VersionRange;
+
+/**
+ * A required capability represents some external constraint on an {@link InstallableUnit}.
+ * Each capability represents something an {@link InstallableUnit} needs that
+ * it expects to be provided by another {@link InstallableUnit}. Capabilities are
+ * entirely generic, and are intended to be capable of representing anything that
+ * an {@link InstallableUnit} may need either at install time, or at runtime.
+ * <p>
+ * Capabilities are segmented into namespaces. Anyone can introduce new
+ * capability namespaces. Some well-known namespaces are introduced directly
+ * by the provisioning framework.
+ *
+ * @see InstallableUnit#IU_KIND_NAMESPACE
+ * @see InstallableUnit#IU_NAMESPACE
+ */
+public class RequiredCapability {
+ private String filter;
+
+ private boolean multiple;
+ private String name;
+ private String namespace;
+ boolean optional;
+ private String range;
+ private String[] selectors;
+ private transient VersionRange rangeObject;
+
+ /**
+ * Returns a {@link RequiredCapability} on the installable unit with the given name
+ * and version range.
+ */
+ public static RequiredCapability createRequiredCapabilityForName(String name, VersionRange versionRange, boolean optional) {
+ return new RequiredCapability(IInstallableUnit.IU_NAMESPACE, name, versionRange, null, optional, false);
+ }
+
+ public RequiredCapability(String namespace, String name, VersionRange range) {
+ this(namespace, name, range, null, false, false);
+ }
+
+ public RequiredCapability(String namespace, String name, VersionRange range, String filter, boolean optional, boolean multiple) {
+ this(namespace, name, range, null, filter, optional, multiple);
+ }
+
+ public RequiredCapability(String namespace, String name, VersionRange range, String[] selectors, String filter, boolean optional, boolean multiple) {
+ Assert.isNotNull(namespace);
+ Assert.isNotNull(name);
+ this.namespace = namespace;
+ this.name = name;
+ this.rangeObject = range;
+ this.range = rangeObject == null ? null : rangeObject.toString();
+ this.selectors = selectors == null ? new String[0] : selectors;
+ this.optional = optional;
+ this.filter = filter;
+ this.multiple = multiple;
+ }
+
+ public void accept(IMetadataVisitor visitor) {
+ visitor.visitRequiredCapability(this);
+ }
+
+ public String getFilter() {
+ return filter;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getNamespace() {
+ return namespace;
+ }
+
+ public VersionRange getRange() {
+ if (rangeObject == null)
+ rangeObject = range == null ? VersionRange.emptyRange : new VersionRange(range);
+ return rangeObject;
+ }
+
+ public boolean isMultiple() {
+ return multiple;
+ }
+
+ public boolean isOptional() {
+ return optional;
+ }
+
+ public String toString() {
+ return "requiredCapability: " + namespace + '/' + name + '/' + range;
+ }
+
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((filter == null) ? 0 : filter.hashCode());
+ result = prime * result + (multiple ? 1231 : 1237);
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ result = prime * result + ((namespace == null) ? 0 : namespace.hashCode());
+ result = prime * result + (optional ? 1231 : 1237);
+ result = prime * result + ((rangeObject == null) ? 0 : rangeObject.hashCode());
+ return result;
+ }
+
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ final RequiredCapability other = (RequiredCapability) obj;
+ if (filter == null) {
+ if (other.filter != null)
+ return false;
+ } else if (!filter.equals(other.filter))
+ return false;
+ if (multiple != other.multiple)
+ return false;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ if (namespace == null) {
+ if (other.namespace != null)
+ return false;
+ } else if (!namespace.equals(other.namespace))
+ return false;
+ if (optional != other.optional)
+ return false;
+ if (rangeObject == null) {
+ if (other.rangeObject != null)
+ return false;
+ } else if (!rangeObject.equals(other.rangeObject))
+ return false;
+ return true;
+ }
+
+ /**
+ * Returns the properties to use for evaluating required capability filters
+ * downstream from this capability. For example, if the selector "doc"
+ * is provided, then a downstream InstallableUnit with a required capability
+ * filtered with "doc=true" will be included.
+ */
+ public String[] getSelectors() {
+ return selectors;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/ResolvedInstallableUnit.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/ResolvedInstallableUnit.java
new file mode 100644
index 000000000..f6f5bc034
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/ResolvedInstallableUnit.java
@@ -0,0 +1,148 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.metadata;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import org.eclipse.equinox.internal.prov.metadata.InternalInstallableUnit;
+import org.osgi.framework.Version;
+
+public class ResolvedInstallableUnit implements IResolvedInstallableUnit, InternalInstallableUnit {
+ private static IInstallableUnit[] NO_IU = new IInstallableUnit[0];
+
+ private IInstallableUnit[] fragments = NO_IU;
+ protected InstallableUnit resolved;
+
+ public ResolvedInstallableUnit(InstallableUnit resolved) {
+ this.resolved = resolved;
+ }
+
+ public void setFragments(IResolvedInstallableUnit[] fragments) {
+ this.fragments = fragments;
+ }
+
+ public IInstallableUnitFragment[] getFragments() {
+ ArrayList result = new ArrayList();
+ if (fragments != null)
+ result.addAll(Arrays.asList(fragments));
+ for (int i = 0; i < result.size(); i++) {
+ result.addAll(Arrays.asList(((IResolvedInstallableUnit) result.get(i)).getFragments()));
+ }
+ return (IInstallableUnitFragment[]) result.toArray(new IInstallableUnitFragment[result.size()]);
+ }
+
+ public String getApplicabilityFilter() {
+ return resolved.getApplicabilityFilter();
+ }
+
+ public IArtifactKey[] getArtifacts() {
+ return resolved.getArtifacts();
+ }
+
+ public String getFilter() {
+ return resolved.getFilter();
+ }
+
+ public String getId() {
+ return resolved.getId();
+ }
+
+ public String getProperty(String key) {
+ return resolved.getProperty(key);
+ }
+
+ public ProvidedCapability[] getProvidedCapabilities() {
+ ArrayList result = new ArrayList();
+ result.addAll(Arrays.asList(resolved.getProvidedCapabilities()));
+ for (int i = 0; i < fragments.length; i++) {
+ result.addAll(Arrays.asList(fragments[i].getProvidedCapabilities()));
+ }
+ return resolved.getProvidedCapabilities();
+ }
+
+ public RequiredCapability[] getRequiredCapabilities() {
+ ArrayList result = new ArrayList();
+ result.addAll(Arrays.asList(resolved.getRequiredCapabilities()));
+ for (int i = 0; i < fragments.length; i++) {
+ result.addAll(Arrays.asList(fragments[i].getRequiredCapabilities()));
+ }
+ return (RequiredCapability[]) result.toArray(new RequiredCapability[result.size()]);
+
+ }
+
+ public TouchpointData[] getTouchpointData() {
+ ArrayList result = new ArrayList();
+ result.addAll(Arrays.asList(resolved.getTouchpointData()));
+ for (int i = 0; i < fragments.length; i++) {
+ TouchpointData[] data = fragments[i].getTouchpointData();
+ for (int j = 0; j < data.length; j++) {
+ result.add(data[j]);
+ }
+ }
+ return (TouchpointData[]) result.toArray(new TouchpointData[result.size()]);
+ }
+
+ public TouchpointType getTouchpointType() {
+ return resolved.getTouchpointType();
+ }
+
+ public Version getVersion() {
+ return resolved.getVersion();
+ }
+
+ public boolean isFragment() {
+ return resolved.isFragment();
+ }
+
+ public boolean isSingleton() {
+ return resolved.isSingleton();
+ }
+
+ public void accept(IMetadataVisitor visitor) {
+ visitor.visitInstallableUnit(this);
+ }
+
+ public boolean equals(Object obj) {
+ //TODO This is pretty ugly....
+ boolean result = resolved.equals(obj);
+ if (result)
+ return true;
+ if (obj instanceof ResolvedInstallableUnit)
+ return resolved.equals(((ResolvedInstallableUnit) obj).resolved);
+ return false;
+ }
+
+ public int hashCode() {
+ // TODO Auto-generated method stub
+ return resolved.hashCode();
+ }
+
+ public String toString() {
+ return "[R]" + resolved.toString();
+ }
+
+ public IInstallableUnit getOriginal() {
+ return resolved;
+ }
+
+ public int compareTo(Object toCompareTo) {
+ if (!(toCompareTo instanceof IInstallableUnit)) {
+ return -1;
+ }
+ IInstallableUnit other = (IInstallableUnit) toCompareTo;
+ if (getId().compareTo(other.getId()) == 0)
+ return (getVersion().compareTo(other.getVersion()));
+ return getId().compareTo(other.getId());
+ }
+
+ public IResolvedInstallableUnit getResolved() {
+ return this;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/ResolvedInstallableUnitFragment.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/ResolvedInstallableUnitFragment.java
new file mode 100644
index 000000000..f7532d2a9
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/ResolvedInstallableUnitFragment.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.metadata;
+
+import org.eclipse.osgi.service.resolver.VersionRange;
+
+public class ResolvedInstallableUnitFragment extends ResolvedInstallableUnit implements IResolvedInstallableUnitFragment {
+
+ public ResolvedInstallableUnitFragment(InstallableUnitFragment resolved) {
+ super(resolved);
+ }
+
+ public String getHostId() {
+ return ((InstallableUnitFragment) resolved).getHostId();
+ }
+
+ public VersionRange getHostVersionRange() {
+ return ((InstallableUnitFragment) resolved).getHostVersionRange();
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/Selector.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/Selector.java
new file mode 100644
index 000000000..a63f39bc3
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/Selector.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.metadata;
+
+import java.util.Dictionary;
+import org.eclipse.equinox.internal.prov.metadata.MetadataActivator;
+import org.osgi.framework.InvalidSyntaxException;
+
+public class Selector {
+ private String id;
+ private String filter;
+ private boolean internal;
+
+ public Selector(String id, String filter, boolean internal) {
+ this.id = id;
+ this.filter = filter;
+ this.internal = internal;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public boolean eval(Dictionary context) {
+ try {
+ return MetadataActivator.context.createFilter(filter).match(context);
+ } catch (InvalidSyntaxException e) {
+ //TODO log something. though that should not happen
+ return false;
+ }
+ }
+
+ public boolean isInternal() {
+ return internal;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/TouchpointData.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/TouchpointData.java
new file mode 100644
index 000000000..67b56c6de
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/TouchpointData.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.metadata;
+
+import java.util.Map;
+
+public class TouchpointData {
+ public static TouchpointData[] NO_TOUCHPOINT_DATA = new TouchpointData[0];
+
+ /**
+ * Map of (String->String). The values represent the instructions. The set
+ * of keys supported is up to the touchpoint that will process these
+ * instructions
+ */
+ private Map instructions;
+
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((instructions == null) ? 0 : instructions.hashCode());
+ return result;
+ }
+
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ final TouchpointData other = (TouchpointData) obj;
+ if (instructions == null) {
+ if (other.instructions != null)
+ return false;
+ } else if (!instructions.equals(other.instructions))
+ return false;
+ return true;
+ }
+
+ public TouchpointData(Map instructions) {
+ this.instructions = instructions;
+ }
+
+ public String getInstructions(String instructionKey) {
+ return (String) instructions.get(instructionKey);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/TouchpointType.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/TouchpointType.java
new file mode 100644
index 000000000..1a99d8a2a
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/metadata/TouchpointType.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.metadata;
+
+import org.osgi.framework.Version;
+
+/**
+ * Identifies a particular touchpoint. A touchpoint is identified by an id
+ * and a version.
+ */
+public class TouchpointType {
+ /**
+ * A touchpoint type indicating that the "null" touchpoint should be used.
+ * The null touchpoint does not participate in any install phase.
+ */
+ public static final TouchpointType NONE = new TouchpointType("null", new Version("0")); //$NON-NLS-1$//$NON-NLS-2$
+ private String id;
+ private Version versionObject;
+ private String version;
+
+ public TouchpointType(String id, Version aVersion) {
+ this.id = id;
+ this.versionObject = aVersion;
+ this.version = aVersion == null ? null : aVersion.toString();
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public Version getVersion() {
+ if (versionObject == null)
+ versionObject = version == null ? Version.emptyVersion : new Version(version);
+ return versionObject;
+ }
+
+ public String toString() {
+ return "Touchpoint: " + id + ' ' + getVersion();
+ }
+
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((id == null) ? 0 : id.hashCode());
+ result = prime * result + ((getVersion() == null) ? 0 : getVersion().hashCode());
+ return result;
+ }
+
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (super.equals(obj))
+ return true;
+ if (getClass() != obj.getClass())
+ return false;
+ final TouchpointType other = (TouchpointType) obj;
+ if (id == null) {
+ if (other.id != null)
+ return false;
+ } else if (!id.equals(other.id))
+ return false;
+ if (getVersion() == null) {
+ if (other.getVersion() != null)
+ return false;
+ } else if (!getVersion().equals(other.getVersion()))
+ return false;
+ return true;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/query/CompoundIterator.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/query/CompoundIterator.java
new file mode 100644
index 000000000..73dfaa3dd
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/query/CompoundIterator.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.query;
+
+import java.util.*;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.equinox.internal.prov.metadata.Messages;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.metadata.RequiredCapability;
+import org.eclipse.osgi.service.resolver.VersionRange;
+
+public class CompoundIterator implements Iterator {
+ private Iterator[] iterators;
+ private String id;
+ private VersionRange range;
+ private RequiredCapability[] requirements;
+ private boolean and;
+ private int index = 0;
+ private boolean filtered = false;
+ private IInstallableUnit lookahead = null;
+
+ public static IInstallableUnit[] asArray(Iterator i, IProgressMonitor progress) {
+ if (progress == null)
+ progress = new NullProgressMonitor();
+ progress.beginTask(Messages.QUERY_PROGRESS, IProgressMonitor.UNKNOWN);
+ HashSet result = new HashSet();
+ while (i.hasNext()) {
+ result.add(i.next());
+ progress.worked(IProgressMonitor.UNKNOWN);
+ }
+ progress.done();
+ return (IInstallableUnit[]) result.toArray(new IInstallableUnit[result.size()]);
+ }
+
+ public CompoundIterator(Iterator[] iterators) {
+ this.iterators = iterators;
+ }
+
+ public CompoundIterator(Iterator[] iterators, String id, VersionRange range, RequiredCapability[] requirements, boolean and) {
+ this(iterators);
+ this.id = id;
+ this.range = range;
+ this.requirements = requirements;
+ this.and = and;
+ filtered = true;
+ }
+
+ public boolean hasNext() {
+ if (lookahead != null)
+ return true;
+ if (index >= iterators.length)
+ return false;
+ if (filtered) {
+ while (iterators[index].hasNext()) {
+ IInstallableUnit next = (IInstallableUnit) iterators[index].next();
+ if (Query.match(next, id, range, requirements, and)) {
+ lookahead = next;
+ return true;
+ }
+ }
+ } else {
+ if (iterators[index].hasNext())
+ return true;
+ }
+ index++;
+ return hasNext();
+ }
+
+ public Object next() {
+ if (lookahead != null) {
+ IInstallableUnit result = lookahead;
+ lookahead = null;
+ return result;
+ }
+ if (index >= iterators.length)
+ throw new NoSuchElementException();
+ while (iterators[index].hasNext()) {
+ IInstallableUnit next = (IInstallableUnit) iterators[index].next();
+ if (!filtered)
+ return next;
+ if (Query.match(next, id, range, requirements, and))
+ return next;
+ }
+ index++;
+ return next();
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/query/IQueryable.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/query/IQueryable.java
new file mode 100644
index 000000000..7811a750a
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/query/IQueryable.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.query;
+
+import java.util.Iterator;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.metadata.RequiredCapability;
+import org.eclipse.osgi.service.resolver.VersionRange;
+
+public interface IQueryable {
+
+ IInstallableUnit[] query(String id, VersionRange range, RequiredCapability[] requirements, boolean and, IProgressMonitor progress);
+
+ Iterator getIterator(String id, VersionRange range, RequiredCapability[] requirements, boolean and);
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/query/Query.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/query/Query.java
new file mode 100644
index 000000000..ac91489ed
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/query/Query.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.query;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.equinox.internal.prov.metadata.Messages;
+import org.eclipse.equinox.prov.metadata.*;
+import org.eclipse.osgi.service.resolver.VersionRange;
+
+public class Query {
+
+ public static boolean match(IInstallableUnit source, String id, VersionRange range, RequiredCapability[] requirements, boolean and) {
+ if (id != null && !source.getId().equals(id))
+ return false;
+ if (range != null && !range.isIncluded(source.getVersion()))
+ return false;
+ if (requirements == null)
+ return true;
+ // if any of the requirements are met by any of the capabilities of the source...
+ for (int k = 0; k < requirements.length; k++) {
+ boolean valid = false;
+ ProvidedCapability[] capabilities = source.getProvidedCapabilities();
+ for (int j = 0; j < capabilities.length; j++)
+ //TODO Need to deal with option and multiplicity flag
+ if ((requirements[k].getName().equals(capabilities[j].getName()) && requirements[k].getNamespace().equals(capabilities[j].getNamespace()) && (requirements[k].getRange() == null ? true : requirements[k].getRange().isIncluded(capabilities[j].getVersion())))) {
+ valid = true;
+ }
+ // if we are OR'ing then the first time we find a requirement that is met, return success
+ if (valid && !and)
+ return true;
+ // if we are AND'ing then the first time we find a requirement that is NOT met, return failure
+ if (!valid && and)
+ return false;
+ }
+ // if we get past the requirements check and we are AND'ing then return true
+ // since all requirements must have been met. If we are OR'ing then return false
+ // since none of the requirements were met.
+ return and;
+ }
+
+ public static IInstallableUnit[] query(IQueryable[] sources, String id, VersionRange range, RequiredCapability[] requirements, boolean and, IProgressMonitor progress) {
+ if (progress == null)
+ progress = new NullProgressMonitor();
+
+ progress.beginTask(Messages.QUERY_PROGRESS, sources.length);
+ ArrayList result = new ArrayList();
+ for (int i = 0; i < sources.length; i++) {
+ IQueryable source = sources[i];
+ IInstallableUnit[] list = source.query(id, range, requirements, and, progress);
+ for (int j = 0; j < list.length; j++)
+ result.add(list[j]);
+ progress.worked(1);
+ }
+ progress.done();
+ return (IInstallableUnit[]) result.toArray(new IInstallableUnit[result.size()]);
+ }
+
+ public static Iterator getIterator(IQueryable[] sources, String id, VersionRange range, RequiredCapability[] requirements, boolean and) {
+ Iterator[] result = new Iterator[sources.length];
+ for (int i = 0; i < sources.length; i++)
+ result[i] = sources[i].getIterator(id, range, requirements, and);
+ return new CompoundIterator(result);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/query/QueryableArray.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/query/QueryableArray.java
new file mode 100644
index 000000000..01177285e
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/query/QueryableArray.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.query;
+
+import java.util.*;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.equinox.internal.prov.metadata.Messages;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.metadata.RequiredCapability;
+import org.eclipse.osgi.service.resolver.VersionRange;
+
+public class QueryableArray implements IQueryable {
+ private IInstallableUnit[] source;
+
+ public QueryableArray(IInstallableUnit[] source) {
+ this.source = source;
+ }
+
+ public Iterator getIterator(String id, VersionRange range, RequiredCapability[] requirements, boolean and) {
+ Iterator i = Arrays.asList(source).iterator();
+ return new CompoundIterator(new Iterator[] {i}, id, range, requirements, and);
+ }
+
+ public IInstallableUnit[] query(String id, VersionRange range, RequiredCapability[] requirements, boolean and, IProgressMonitor progress) {
+ if (progress == null)
+ progress = new NullProgressMonitor();
+ progress.beginTask(Messages.QUERY_PROGRESS, source.length);
+ Set result = new HashSet();
+ for (int i = 0; i < source.length; i++) {
+ if (Query.match(source[i], id, range, requirements, and))
+ result.add(source[i]);
+ progress.worked(1);
+ }
+ progress.done();
+ return (IInstallableUnit[]) result.toArray(new IInstallableUnit[result.size()]);
+
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/resolution/ResolutionHelper.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/resolution/ResolutionHelper.java
new file mode 100644
index 000000000..5eceae0d1
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/resolution/ResolutionHelper.java
@@ -0,0 +1,171 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.resolution;
+
+import java.util.*;
+import org.eclipse.equinox.internal.prov.metadata.InternalInstallableUnit;
+import org.eclipse.equinox.internal.prov.metadata.MetadataActivator;
+import org.eclipse.equinox.prov.metadata.*;
+import org.eclipse.osgi.service.resolver.*;
+import org.osgi.framework.ServiceReference;
+
+public class ResolutionHelper {
+ private static boolean DEBUG = false;
+
+ private Transformer transformer;
+ private State state;
+ private Dictionary selectionContext;
+ private RecommendationDescriptor recommendations;
+
+ public ResolutionHelper(Dictionary selectionContext, RecommendationDescriptor recommendations) {
+ this.selectionContext = selectionContext;
+ this.recommendations = recommendations;
+ }
+
+ private void initialize() {
+ ServiceReference sr = MetadataActivator.context.getServiceReference(PlatformAdmin.class.getName());
+ PlatformAdmin pa = (PlatformAdmin) MetadataActivator.context.getService(sr);
+ transformer = new Transformer(pa.getFactory(), selectionContext, recommendations);
+ state = pa.getFactory().createState(true);
+ if (selectionContext != null)
+ state.setPlatformProperties(selectionContext);
+ }
+
+ private void addToState(BundleDescription bd) {
+ state.addBundle(bd);
+ }
+
+ private BundleDescription addInResolution(IInstallableUnit toAdd) {
+ toAdd.accept(transformer);
+ // transformer.visitInstallableUnit(toAdd);
+ BundleDescription descriptionToAdd = transformer.getResult();
+ // bundleDescriptionToIU.put(descriptionToAdd, toAdd);
+ addToState(descriptionToAdd);
+ return descriptionToAdd;
+ }
+
+ /**
+ * Indicates if the installable unit to install will have all their constraints satisfied when installed with other installable units.
+ * @param toInstall the installable units to install
+ * @param existingState the other installable units to resolve against
+ * @return true if the installable unit to install resolves, return false otherwise.
+ */
+ public UnsatisfiedCapability[] install(Set toInstall, Set existingState) {
+ initialize();
+ BundleDescription[] addedBundle = new BundleDescription[toInstall.size()];
+ int j = 0;
+ for (Iterator iterator = toInstall.iterator(); iterator.hasNext();) {
+ addedBundle[j++] = addInResolution((IInstallableUnit) iterator.next());
+ }
+
+ for (Iterator iterator = existingState.iterator(); iterator.hasNext();) {
+ addInResolution((IInstallableUnit) iterator.next());
+ }
+
+ state.resolve(); //We may want to resolve in two times. first the existing state, then add the toInstall. This would allow to see what changes when dropping the new iu.
+ //Also it could allow us to do an incremental resolution. however the results may differ
+
+ ArrayList results = new ArrayList();
+ for (int i = 0; i < addedBundle.length; i++) {
+ results.addAll(createUnsatisfiedCapabilities(state.getStateHelper().getUnsatisfiedConstraints(addedBundle[i]), addedBundle[i]));
+ }
+ return (UnsatisfiedCapability[]) results.toArray(new UnsatisfiedCapability[results.size()]);
+
+ }
+
+ private ArrayList createUnsatisfiedCapabilities(VersionConstraint[] unsatisfied, BundleDescription description) {
+ ArrayList results = new ArrayList();
+ for (int i = 0; i < unsatisfied.length; i++) {
+ RequiredCapability originalDependency = (RequiredCapability) ((StateMetadataMap) description.getUserObject()).getGenericSpecifications().get(unsatisfied[i]);
+ results.add(new UnsatisfiedCapability(originalDependency, ((StateMetadataMap) description.getUserObject()).getUnit()));
+ }
+ return results;
+ }
+
+ /**
+ * Associates installable unit fragments to each IU being installed.
+ *
+ * TODO: This method should probably be renamed to attachFragments
+ */
+ public Collection attachCUs(Collection toAttach) {
+ initialize();
+ Collection result = new HashSet(toAttach.size());
+ for (Iterator iterator = toAttach.iterator(); iterator.hasNext();) {
+ IResolvedInstallableUnit tmp = ((InternalInstallableUnit) iterator.next()).getResolved();
+ result.add(tmp);
+ addInResolution(tmp);
+ }
+ state.resolve();
+ BundleDescription[] bds = state.getBundles();
+ for (int i = 0; i < bds.length; i++) {
+ if (DEBUG) {
+ ResolverError[] re = state.getResolverErrors(bds[i]);
+ for (int j = 0; j < re.length; j++) {
+ System.out.println(re[j]);
+ }
+ }
+ BundleDescription[] potentialIUFragments = state.getStateHelper().getDependentBundles(new BundleDescription[] {bds[i]});
+ // TODO: We need to define a way to allow IUFragments to work together to do configuration work.
+ // For now we will select just one fragment by preferring a fragment that matches the host
+
+ IInstallableUnit hostIU = ((StateMetadataMap) bds[i].getUserObject()).getUnit();
+ IResolvedInstallableUnitFragment selectedFragment = null;
+ for (int k = 0; k < potentialIUFragments.length; k++) {
+ IInstallableUnit dependentIU = ((StateMetadataMap) potentialIUFragments[k].getUserObject()).getUnit();
+ if (hostIU.equals(dependentIU))
+ continue;
+
+ if (dependentIU.isFragment()) {
+ IResolvedInstallableUnitFragment potentialFragment = (IResolvedInstallableUnitFragment) dependentIU;
+
+ if (potentialFragment.getHostId() == null) {
+ // default fragment - we'll mark it selected but keep looking for a fragment that matches the host
+ selectedFragment = potentialFragment;
+ } else if (potentialFragment.getHostId().equals(hostIU.getId()) && potentialFragment.getHostVersionRange().isIncluded(hostIU.getVersion())) {
+ // matches host - we're done
+ selectedFragment = potentialFragment;
+ break;
+ } // otherwise keep looking
+ }
+ }
+ if (selectedFragment != null)
+ ((ResolvedInstallableUnit) hostIU).setFragments(new IResolvedInstallableUnit[] {selectedFragment});
+ }
+ return result;
+ }
+
+ public boolean isResolved(IInstallableUnit iu) {
+ return state.getBundle(iu.getId(), iu.getVersion()).isResolved();
+ }
+
+ public ArrayList getAllResolved() {
+ BundleDescription[] bd = state.getResolvedBundles();
+ ArrayList result = new ArrayList(bd.length);
+ for (int i = 0; i < bd.length; i++) {
+ result.add(extractIU(bd[i]));
+ }
+ return result;
+ }
+
+ private IInstallableUnit extractIU(BundleDescription bd) {
+ return ((StateMetadataMap) bd.getUserObject()).getUnit();
+ }
+
+ public List getSorted() {
+ BundleDescription[] toSort = state.getResolvedBundles();
+ state.getStateHelper().sortBundles(toSort);
+ List result = new ArrayList(toSort.length);
+ for (int i = 0; i < toSort.length; i++) {
+ result.add(extractIU(toSort[i]));
+ }
+ return result;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/resolution/StateMetadataMap.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/resolution/StateMetadataMap.java
new file mode 100644
index 000000000..1fc262c5e
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/resolution/StateMetadataMap.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.resolution;
+
+import java.util.Map;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+
+//Instances of this class are stored in the user object slot of bundlescriptions to ease navigation between the two models.
+public class StateMetadataMap {
+ private IInstallableUnit unit;
+ private Map correspondingSpecifications; //indexes in this array maps to the ones in the dependencies array. This is gross. TODO
+
+ public StateMetadataMap(IInstallableUnit unit, Map correspondingSpecifications) {
+ super();
+ this.unit = unit;
+ this.correspondingSpecifications = correspondingSpecifications;
+ }
+
+ public IInstallableUnit getUnit() {
+ return unit;
+ }
+
+ public Map getGenericSpecifications() {
+ return correspondingSpecifications;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/resolution/Transformer.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/resolution/Transformer.java
new file mode 100644
index 000000000..d9afe1cfa
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/resolution/Transformer.java
@@ -0,0 +1,141 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.resolution;
+
+import java.util.*;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.internal.prov.metadata.MetadataActivator;
+import org.eclipse.equinox.prov.core.helpers.LogHelper;
+import org.eclipse.equinox.prov.metadata.*;
+import org.eclipse.osgi.service.resolver.*;
+import org.osgi.framework.InvalidSyntaxException;
+
+public class Transformer implements IMetadataVisitor {
+ private static final byte IU_KIND = 0;
+ private static final String IU_NAMESPACE = "iu.namespace";
+ static long iuInternalId = 0;
+
+ private Dictionary context = null;
+ private StateObjectFactory factory = null;
+ private ArrayList iuCapabilities;
+ private Map iuDependencies;
+ private byte kind = IU_KIND;
+
+ private BundleDescription result = null;
+
+ private RecommendationDescriptor recommendations = null;
+
+ public Transformer(StateObjectFactory factory) {
+ this(factory, null, null);
+ }
+
+ public Transformer(StateObjectFactory factory, Dictionary context, RecommendationDescriptor recommendations) {
+ this.factory = factory;
+ this.context = context;
+ this.recommendations = recommendations;
+ }
+
+ private String getNamespace() {
+ switch (kind) {
+ case IU_KIND :
+ return IU_NAMESPACE;
+ default :
+ throw new IllegalStateException("unknown kind"); //This should not happen
+ }
+ }
+
+ public BundleDescription getResult() {
+ return result;
+ }
+
+ private boolean isEnabled(RequiredCapability capability) {
+ // If there is no context then be optimistic
+ if (context == null)
+ return true;
+ String filter = capability.getFilter();
+ if (filter == null)
+ return true;
+ try {
+ return MetadataActivator.getContext().createFilter(filter).match(context);
+ } catch (InvalidSyntaxException e) {
+ // If we fail to parse the filter treat it as invalid and be optimistic
+ return true;
+ }
+ }
+
+ private String toFilter(VersionRange range) {
+ if (range == null)
+ return null;
+ StringBuffer buf = new StringBuffer();
+ buf.append("(&"); //$NON-NLS-1$
+ buf.append("(version>=").append(range.getMinimum().toString()).append(')'); //$NON-NLS-1$
+ if (!range.getIncludeMinimum())
+ buf.append("(!(version=").append(range.getMinimum().toString()).append("))");
+ buf.append("(version<=").append(range.getMaximum().toString()).append(')'); //$NON-NLS-1$
+ if (!range.getIncludeMaximum())
+ buf.append("(!(version=").append(range.getMaximum().toString()).append("))");
+ buf.append(')');
+ return buf.toString();
+ }
+
+ public void visitCapability(ProvidedCapability capability) {
+ iuCapabilities.add(factory.createGenericDescription(capability.getName(), capability.getNamespace(), capability.getVersion(), null));
+ }
+
+ public void visitInstallableUnit(IInstallableUnit toTransform) {
+ kind = IU_KIND;
+
+ //Start with the dependencies
+ RequiredCapability[] requires = toTransform.getRequiredCapabilities();
+ iuDependencies = new HashMap(requires.length);
+ for (int i = 0; i < requires.length; i++) {
+ requires[i].accept(this);
+ }
+
+ //Do the capabilities
+ ProvidedCapability[] capabilities = toTransform.getProvidedCapabilities();
+ iuCapabilities = new ArrayList(requires.length + 1);
+ for (int i = 0; i < capabilities.length; i++) {
+ capabilities[i].accept(this);
+ }
+
+ //Add a capability representing the IU itself
+ iuCapabilities.add(factory.createGenericDescription(toTransform.getId(), getNamespace(), toTransform.getVersion(), null));
+
+ GenericSpecification[] genericSpecifications = new GenericSpecification[iuDependencies.size()];
+ iuDependencies.keySet().toArray(genericSpecifications);
+
+ GenericDescription[] genericDescriptions = new GenericDescription[iuCapabilities.size()];
+ iuCapabilities.toArray(genericDescriptions);
+
+ //Finally create the bundle description
+ //TODO Need to create the filter for the IU itself
+ result = factory.createBundleDescription(iuInternalId++, toTransform.getId(), toTransform.getVersion(), (String) null, (BundleSpecification[]) null, (HostSpecification) null, (ImportPackageSpecification[]) null, (ExportPackageDescription[]) null, toTransform.isSingleton(), true, true, toTransform.getFilter(), (String[]) null, genericSpecifications, genericDescriptions);
+ result.setUserObject(new StateMetadataMap(toTransform, iuDependencies));
+ }
+
+ public void visitRequiredCapability(RequiredCapability capability) {
+ try {
+ if (isEnabled(capability)) {
+ capability = rewrite(capability);
+ iuDependencies.put(factory.createGenericSpecification(capability.getName(), capability.getNamespace(), toFilter(capability.getRange()), capability.isOptional(), capability.isMultiple()), capability);
+ }
+ } catch (InvalidSyntaxException e) {
+ LogHelper.log(new Status(IStatus.ERROR, MetadataActivator.PI_METADATA, "Invalid filter: " + e.getFilter(), e)); //$NON-NLS-1$
+ }
+ }
+
+ private RequiredCapability rewrite(RequiredCapability match) {
+ if (recommendations == null)
+ return match;
+ Recommendation foundRecommendation = recommendations.findRecommendation(match);
+ return foundRecommendation != null ? foundRecommendation.newValue() : match;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/resolution/UnsatisfiedCapability.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/resolution/UnsatisfiedCapability.java
new file mode 100644
index 000000000..29d6c244d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/prov/resolution/UnsatisfiedCapability.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.resolution;
+
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.metadata.RequiredCapability;
+
+/**
+ * Represents a provisioning dependency that was not satisfied during
+ * resolution.
+ */
+public class UnsatisfiedCapability {
+ private IInstallableUnit owner;
+ private RequiredCapability require;
+
+ /**
+ * Creates a new unresolved dependency
+ * @param required The dependency that was not satisfied.
+ * @param owner The installable unit whose dependency was not satisfied.
+ */
+ public UnsatisfiedCapability(RequiredCapability required, IInstallableUnit owner) {
+ this.require = required;
+ this.owner = owner;
+ }
+
+ public IInstallableUnit getOwner() {
+ return owner;
+ }
+
+ /**
+ * Returns the specific dependency that was not satisfied.
+ */
+ public RequiredCapability getRequiredCapability() {
+ return require;
+ }
+
+ /**
+ * Returns the installable unit whose dependency was not satisfied.
+ */
+ public IInstallableUnit getUnsatisfiedUnit() {
+ return owner;
+ }
+
+ /**
+ * For debugging purposes only.
+ */
+ public String toString() {
+ return "[" + owner + "] " + require.toString(); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/.classpath b/bundles/org.eclipse.equinox.p2.tests/.classpath
new file mode 100644
index 000000000..7cdeb7319
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/CDC-1.1%Foundation-1.1"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.equinox.p2.tests/.project b/bundles/org.eclipse.equinox.p2.tests/.project
new file mode 100644
index 000000000..6b99e9a8c
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.equinox.prov.test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.equinox.p2.tests/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..cca252c35
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,340 @@
+#Sat Sep 15 21:26:35 EDT 2007
+eclipse.preferences.version=1
+instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
+org.eclipse.jdt.core.builder.cleanOutputFolder=clean
+org.eclipse.jdt.core.builder.duplicateResourceTask=warning
+org.eclipse.jdt.core.builder.invalidClasspath=abort
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
+org.eclipse.jdt.core.circularClasspath=error
+org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
+org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=false
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false
+org.eclipse.jdt.core.formatter.comment.format_line_comments=false
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=800
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.incompatibleJDKLevel=ignore
+org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/bundles/org.eclipse.equinox.p2.tests/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.p2.tests/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 000000000..6619592bb
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,57 @@
+#Sun Sep 23 11:58:50 EDT 2007
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_core
+formatter_settings_version=11
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=;
+org.eclipse.jdt.ui.ondemandthreshold=3
+org.eclipse.jdt.ui.staticondemandthreshold=3
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates/>
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.format_source_code=true
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_variable_declarations_final=true
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=false
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/bundles/org.eclipse.equinox.p2.tests/.settings/org.eclipse.pde.core.prefs b/bundles/org.eclipse.equinox.p2.tests/.settings/org.eclipse.pde.core.prefs
new file mode 100644
index 000000000..63331939d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/.settings/org.eclipse.pde.core.prefs
@@ -0,0 +1,4 @@
+#Thu Aug 23 14:59:00 CEST 2007
+eclipse.preferences.version=1
+pluginProject.extensions=true
+resolve.requirebundle=false
diff --git a/bundles/org.eclipse.equinox.p2.tests/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.tests/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..3ffad4219
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,41 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Test Plug-in (Incubation)
+Bundle-SymbolicName: org.eclipse.equinox.prov.test;singleton:=true
+Bundle-Version: 0.1.0.qualifier
+Import-Package: com.thoughtworks.xstream,
+ junit.framework;version="3.8.2",
+ org.eclipse.core.runtime;common=split,
+ org.eclipse.equinox.internal.p2.jarprocessor,
+ org.eclipse.equinox.internal.prov.artifact.repository,
+ org.eclipse.equinox.internal.prov.director,
+ org.eclipse.equinox.internal.prov.metadata,
+ org.eclipse.equinox.p2.jarprocessor,
+ org.eclipse.equinox.prov.artifact.repository,
+ org.eclipse.equinox.prov.artifact.repository.processing,
+ org.eclipse.equinox.prov.core.helpers,
+ org.eclipse.equinox.prov.core.location,
+ org.eclipse.equinox.prov.core.repository,
+ org.eclipse.equinox.prov.director,
+ org.eclipse.equinox.prov.engine,
+ org.eclipse.equinox.prov.installregistry,
+ org.eclipse.equinox.prov.metadata,
+ org.eclipse.equinox.prov.metadata.repository,
+ org.eclipse.equinox.prov.query,
+ org.eclipse.equinox.prov.resolution,
+ org.eclipse.osgi.service.environment;version="1.0.0",
+ org.eclipse.osgi.service.resolver;version="1.1.0",
+ org.eclipse.osgi.util;version="1.1.0",
+ org.osgi.framework;version="1.3.0",
+ org.osgi.service.packageadmin;version="1.2.0"
+Bundle-Activator: org.eclipse.equinox.prov.tests.TestActivator
+Bundle-ClassPath: .
+Bundle-RequiredExecutionEnviron: J2SE-1.4
+Require-Bundle: org.eclipse.equinox.prov.metadata.generator,
+ org.eclipse.equinox.frameworkadmin,
+ org.eclipse.equinox.common,
+ org.eclipse.equinox.prov.download
+Eclipse-LazyStart: true
+Eclipse-RegisterBuddy: org.eclipse.equinox.prov.artifact.repository
+Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
+ J2SE-1.4
diff --git a/bundles/org.eclipse.equinox.p2.tests/Test Director CDT.launch b/bundles/org.eclipse.equinox.p2.tests/Test Director CDT.launch
new file mode 100644
index 000000000..1581c875f
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/Test Director CDT.launch
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
+<booleanAttribute key="append.args" value="true"/>
+<stringAttribute key="application" value="org.eclipse.pde.junit.runtime.coretestapplication"/>
+<booleanAttribute key="askclear" value="false"/>
+<booleanAttribute key="automaticAdd" value="true"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="true"/>
+<booleanAttribute key="clearws" value="true"/>
+<booleanAttribute key="clearwslog" value="false"/>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
+<booleanAttribute key="default" value="true"/>
+<booleanAttribute key="includeOptional" value="true"/>
+<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/org.eclipse.equinox.prov.test/src/org/eclipse/equinox/prov/test/DirectorTest.java"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="1"/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.equinox.prov.tests.director.DirectorTest"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl}"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.equinox.prov.test"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Declipse.prov.data.area=c:/temp/equinox.prov/agent/&#13;&#10;-Declipse.prov.metadataRepository=file:c:/temp/equinox.prov/servers/CDTmetadataRepository/ &#13;&#10;-Declipse.prov.artifactRepository=file:c:/temp/equinox.prov/servers/artifactRepository/&#13;&#10;-Declipse.prov.installFolder=c:/temp/equinox.prov/eclipseInstall/ &#13;&#10;-Declipse.prov.configurationFlavor=tooling&#13;&#10;-Declipse.prov.autoInstall=cdt"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<stringAttribute key="product" value="org.eclipse.platform.ide"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useDefaultConfig" value="true"/>
+<booleanAttribute key="useDefaultConfigArea" value="false"/>
+<booleanAttribute key="useProduct" value="false"/>
+<stringAttribute key="vminstall" value="jdk"/>
+</launchConfiguration>
diff --git a/bundles/org.eclipse.equinox.p2.tests/Test Director SDK.launch b/bundles/org.eclipse.equinox.p2.tests/Test Director SDK.launch
new file mode 100644
index 000000000..cdd1a0001
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/Test Director SDK.launch
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
+<booleanAttribute key="append.args" value="true"/>
+<stringAttribute key="application" value="org.eclipse.pde.junit.runtime.coretestapplication"/>
+<booleanAttribute key="askclear" value="false"/>
+<booleanAttribute key="automaticAdd" value="false"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="true"/>
+<booleanAttribute key="clearws" value="true"/>
+<booleanAttribute key="clearwslog" value="false"/>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
+<booleanAttribute key="default" value="false"/>
+<stringAttribute key="deselected_workspace_plugins" value="org.eclipse.update.configurator"/>
+<booleanAttribute key="includeOptional" value="true"/>
+<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/org.eclipse.equinox.prov.test/src/org/eclipse/equinox/prov/tests/director/DirectorTest.java"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="1"/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.equinox.prov.tests.director.DirectorTest"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -console -noExit -consoleLog"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.equinox.prov.test"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Declipse.prov.data.area=d:/tmp/equinox.prov/agent/ &#13;&#10;-Declipse.prov.metadataRepository=file:d:/tmp/equinox.prov/servers/metadataRepository/ &#13;&#10;-Declipse.prov.artifactRepository=file:d:/tmp/equinox.prov/servers/artifactRepository/&#13;&#10;-Declipse.prov.installFolder=d:/tmp/equinox.prov/eclipseInstall/ &#13;&#10;-Declipse.prov.configurationFlavor=tooling&#13;&#10;-Declipse.prov.autoInstall=sdk"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<stringAttribute key="product" value="org.eclipse.platform.ide"/>
+<stringAttribute key="selected_target_plugins" value="com.ibm.icu,com.ibm.icu.source,com.jcraft.jsch,javax.servlet,javax.servlet.jsp,javax.servlet.jsp.source,javax.servlet.source,org.apache.ant,org.apache.ant.source,org.apache.commons.el,org.apache.commons.el.source,org.apache.commons.logging,org.apache.commons.logging.source,org.apache.jasper,org.apache.jasper.source,org.apache.lucene,org.apache.lucene.analysis,org.apache.lucene.analysis.source,org.apache.lucene.source,org.eclipse.ant.core,org.eclipse.ant.ui,org.eclipse.compare,org.eclipse.core.boot,org.eclipse.core.commands,org.eclipse.core.contenttype,org.eclipse.core.databinding,org.eclipse.core.databinding.beans,org.eclipse.core.expressions,org.eclipse.core.filebuffers,org.eclipse.core.filesystem,org.eclipse.core.filesystem.win32.x86,org.eclipse.core.jobs,org.eclipse.core.net,org.eclipse.core.resources,org.eclipse.core.resources.compatibility,org.eclipse.core.resources.win32,org.eclipse.core.runtime,org.eclipse.core.runtime.compatibility,org.eclipse.core.runtime.compatibility.auth,org.eclipse.core.runtime.compatibility.registry,org.eclipse.core.variables,org.eclipse.cvs,org.eclipse.cvs.source,org.eclipse.debug.core,org.eclipse.debug.ui,org.eclipse.equinox.app,org.eclipse.equinox.common,org.eclipse.equinox.http.jetty,org.eclipse.equinox.http.registry,org.eclipse.equinox.http.servlet,org.eclipse.equinox.jsp.jasper,org.eclipse.equinox.jsp.jasper.registry,org.eclipse.equinox.launcher,org.eclipse.equinox.launcher.win32.win32.x86,org.eclipse.equinox.preferences,org.eclipse.equinox.registry,org.eclipse.help,org.eclipse.help.appserver,org.eclipse.help.base,org.eclipse.help.ui,org.eclipse.help.webapp,org.eclipse.jdt,org.eclipse.jdt.apt.core,org.eclipse.jdt.apt.pluggable.core,org.eclipse.jdt.apt.ui,org.eclipse.jdt.compiler.apt,org.eclipse.jdt.compiler.tool,org.eclipse.jdt.core,org.eclipse.jdt.core.manipulation,org.eclipse.jdt.debug,org.eclipse.jdt.debug.ui,org.eclipse.jdt.doc.isv,org.eclipse.jdt.doc.user,org.eclipse.jdt.junit,org.eclipse.jdt.junit.runtime,org.eclipse.jdt.junit4.runtime,org.eclipse.jdt.launching,org.eclipse.jdt.source,org.eclipse.jdt.ui,org.eclipse.jface,org.eclipse.jface.databinding,org.eclipse.jface.text,org.eclipse.jsch.core,org.eclipse.jsch.ui,org.eclipse.ltk.core.refactoring,org.eclipse.ltk.ui.refactoring,org.eclipse.osgi,org.eclipse.osgi.services,org.eclipse.osgi.util,org.eclipse.pde,org.eclipse.pde.build,org.eclipse.pde.core,org.eclipse.pde.doc.user,org.eclipse.pde.junit.runtime,org.eclipse.pde.runtime,org.eclipse.pde.source,org.eclipse.pde.ui,org.eclipse.pde.ui.templates,org.eclipse.platform,org.eclipse.platform.doc.isv,org.eclipse.platform.doc.user,org.eclipse.platform.source,org.eclipse.platform.source.win32.win32.x86,org.eclipse.rcp,org.eclipse.rcp.source,org.eclipse.rcp.source.win32.win32.x86,org.eclipse.sdk,org.eclipse.search,org.eclipse.swt,org.eclipse.swt.win32.win32.x86,org.eclipse.team.core,org.eclipse.team.cvs.core,org.eclipse.team.cvs.ssh,org.eclipse.team.cvs.ssh2,org.eclipse.team.cvs.ui,org.eclipse.team.ui,org.eclipse.text,org.eclipse.tomcat,org.eclipse.ui,org.eclipse.ui.browser,org.eclipse.ui.cheatsheets,org.eclipse.ui.console,org.eclipse.ui.editors,org.eclipse.ui.externaltools,org.eclipse.ui.forms,org.eclipse.ui.ide,org.eclipse.ui.ide.application,org.eclipse.ui.intro,org.eclipse.ui.intro.universal,org.eclipse.ui.navigator,org.eclipse.ui.navigator.resources,org.eclipse.ui.net,org.eclipse.ui.presentations.r21,org.eclipse.ui.views,org.eclipse.ui.views.properties.tabbed,org.eclipse.ui.win32,org.eclipse.ui.workbench,org.eclipse.ui.workbench.compatibility,org.eclipse.ui.workbench.texteditor,org.eclipse.update.configurator,org.eclipse.update.core,org.eclipse.update.core.win32,org.eclipse.update.scheduler,org.eclipse.update.ui,org.junit,org.junit.source,org.junit4,org.mortbay.jetty,org.mortbay.jetty.source"/>
+<stringAttribute key="selected_workspace_plugins" value="org.eclipse.ecf,org.eclipse.equinox.prov.touchpoint.eclipse,org.eclipse.equinox.frameworkadmin.equinox,org.eclipse.equinox.prov.touchpoint.natives,org.eclipse.equinox.prov.test,org.apache.xml.resolver,org.apache.xerces,org.eclipse.ecf.identity,org.eclipse.equinox.frameworkadmin,org.eclipse.equinox.prov.metadata.generator,org.eclipse.equinox.prov.artifact.repository,org.eclipse.equinox.p2.jarprocessor,org.mozilla.rhino,org.eclipse.equinox.prov.metadata.repository,com.thoughtworks.xstream,org.eclipse.equinox.prov.director,org.eclipse.equinox.prov.engine,org.eclipse.equinox.prov.console,org.eclipse.ecf.filetransfer,org.eclipse.equinox.prov.metadata,org.eclipse.equinox.prov.core,org.eclipse.equinox.prov.examplarysetup,org.eclipse.equinox.simpleconfigurator.manipulator,org.eclipse.equinox.prov.download,org.eclipse.ecf.provider.filetransfer,org.eclipse.equinox.prov.selfhosting,org.eclipse.equinox.simpleconfigurator"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useDefaultConfig" value="true"/>
+<booleanAttribute key="useDefaultConfigArea" value="false"/>
+<booleanAttribute key="useProduct" value="false"/>
+<stringAttribute key="vminstall" value="ibm1.5sr1"/>
+</launchConfiguration>
diff --git a/bundles/org.eclipse.equinox.p2.tests/Test Director Uninstall CDT.launch b/bundles/org.eclipse.equinox.p2.tests/Test Director Uninstall CDT.launch
new file mode 100644
index 000000000..87e9cbd99
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/Test Director Uninstall CDT.launch
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
+<booleanAttribute key="append.args" value="true"/>
+<stringAttribute key="application" value="org.eclipse.pde.junit.runtime.coretestapplication"/>
+<booleanAttribute key="askclear" value="false"/>
+<booleanAttribute key="automaticAdd" value="true"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="true"/>
+<booleanAttribute key="clearws" value="true"/>
+<booleanAttribute key="clearwslog" value="false"/>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
+<booleanAttribute key="default" value="true"/>
+<booleanAttribute key="includeOptional" value="true"/>
+<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/org.eclipse.equinox.prov.test/src/org/eclipse/equinox/prov/tests/director/DirectorTest.java"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="1"/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.equinox.prov.tests.director.DirectorTest"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl}"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.equinox.prov.test"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Declipse.prov.data.area=c:/temp/equinox.prov/agent/&#13;&#10;-Declipse.prov.metadataRepository=file:c:/temp/equinox.prov/servers/CDTmetadataRepository/ &#13;&#10;-Declipse.prov.artifactRepository=file:c:/temp/equinox.prov/servers/artifactRepository/&#13;&#10;-Declipse.prov.installFolder=c:/temp/equinox.prov/eclipseInstall/ &#13;&#10;-Declipse.prov.configurationFlavor=tooling&#13;&#10;-Declipse.prov.autoInstall=cdt&#13;&#10;-Declipse.prov.doUninstall=true"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<stringAttribute key="product" value="org.eclipse.platform.ide"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useDefaultConfig" value="true"/>
+<booleanAttribute key="useDefaultConfigArea" value="false"/>
+<booleanAttribute key="useProduct" value="false"/>
+<stringAttribute key="vminstall" value="jdk"/>
+</launchConfiguration>
diff --git a/bundles/org.eclipse.equinox.p2.tests/Test Director Uninstall SDK.launch b/bundles/org.eclipse.equinox.p2.tests/Test Director Uninstall SDK.launch
new file mode 100644
index 000000000..ab7674355
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/Test Director Uninstall SDK.launch
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.pde.ui.EquinoxLauncher">
+<booleanAttribute key="automaticAdd" value="false"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="true"/>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/Test Director Uninstall SDK"/>
+<booleanAttribute key="default_auto_start" value="false"/>
+<intAttribute key="default_start_level" value="4"/>
+<booleanAttribute key="includeOptional" value="true"/>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-console -consolelog"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m&#13;&#10;-Xmx768m&#13;&#10;-Declipse.prov.data.area=c:/temp/equinox.prov/agent/&#13;&#10;-Declipse.prov.metadataRepository=file:c:/temp/equinox.prov/servers/metadataRepository/ &#13;&#10;-Declipse.prov.artifactRepository=file:c:/temp/equinox.prov/servers/artifactRepository/&#13;&#10;-Declipse.prov.installFolder=c:/temp/equinox.prov/eclipseInstall/ &#13;&#10;-Declipse.prov.configurationFlavor=tooling&#13;&#10;-Declipse.prov.autoInstall=sdk&#13;&#10;-Declipse.prov.doUninstall=true"/>
+<stringAttribute key="target_bundles" value="org.eclipse.core.jobs@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.common@default:default,org.eclipse.equinox.launcher@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.osgi@:,org.eclipse.osgi.services@default:default,org.junit@default:default"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useDefaultConfigArea" value="true"/>
+<stringAttribute key="vminstall" value="j2re1.4.2_13"/>
+<stringAttribute key="workspace_bundles" value="com.thoughtworks.xstream@default:default,org.eclipse.ecf@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.ecf.provider.filetransfer@default:default,org.eclipse.equinox.frameworkadmin@default:default,org.eclipse.equinox.frameworkadmin.equinox@default:true,org.eclipse.equinox.prov.artifact.repository@default:default,org.eclipse.equinox.prov.core@default:default,org.eclipse.equinox.prov.director@default:default,org.eclipse.equinox.prov.download@default:default,org.eclipse.equinox.prov.engine@default:default,org.eclipse.equinox.prov.examplarysetup@default:default,org.eclipse.equinox.prov.metadata@default:default,org.eclipse.equinox.prov.metadata.repository@default:default,org.eclipse.equinox.prov.test@default:true,org.eclipse.equinox.prov.touchpoint.eclipse@default:default,org.eclipse.equinox.prov.touchpoint.natives@default:default,org.eclipse.equinox.simpleconfigurator.manipulator@1:true,org.mozilla.rhino@default:default"/>
+</launchConfiguration>
diff --git a/bundles/org.eclipse.equinox.p2.tests/about.html b/bundles/org.eclipse.equinox.p2.tests/about.html
new file mode 100644
index 000000000..460233046
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 2, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.tests/build.properties b/bundles/org.eclipse.equinox.p2.tests/build.properties
new file mode 100644
index 000000000..6278d7e84
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/build.properties
@@ -0,0 +1,18 @@
+###############################################################################
+# Copyright (c) 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html,\
+ plugin.xml,\
+ testData/
+customCallBack=foo.xml
diff --git a/bundles/org.eclipse.equinox.p2.tests/plugin.xml b/bundles/org.eclipse.equinox.p2.tests/plugin.xml
new file mode 100644
index 000000000..16e069030
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/plugin.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.eclipse.equinox.prov.artifact.repository.processingSteps"
+ id="org.eclipse.equinox.prov.processing.ByteShifter">
+ <step class="org.eclipse.equinox.prov.tests.artifact.repository.processing.ByteShifter"/>
+ </extension>
+
+ <extension
+ point="org.eclipse.equinox.prov.artifact.repository.processingSteps"
+ id="org.eclipse.equinox.prov.processing.MD5Verifier">
+ <step class="org.eclipse.equinox.prov.tests.artifact.repository.processing.MD5Verifier"/>
+ </extension>
+
+ <extension
+ point="org.eclipse.equinox.prov.artifact.repository.processingSteps"
+ id="org.eclipse.equinox.prov.processing.Adder">
+ <step class="org.eclipse.equinox.prov.tests.artifact.repository.processing.Adder"/>
+ </extension>
+
+ <extension
+ point="org.eclipse.equinox.prov.artifact.repository.processingSteps"
+ id="org.eclipse.equinox.prov.processing.Multiplier">
+ <step class="org.eclipse.equinox.prov.tests.artifact.repository.processing.Multiplier"/>
+ </extension>
+
+ <extension
+ point="org.eclipse.equinox.prov.artifact.repository.processingSteps"
+ id="org.eclipse.equinox.prov.processing.Pack200Unpacker">
+ <step class="org.eclipse.equinox.prov.tests.artifact.repository.processing.Pack200Unpacker"/>
+ </extension>
+
+</plugin>
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/AbstractProvisioningTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/AbstractProvisioningTest.java
new file mode 100644
index 000000000..7b5386984
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/AbstractProvisioningTest.java
@@ -0,0 +1,181 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.tests;
+
+import java.util.*;
+import junit.framework.TestCase;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.equinox.prov.core.helpers.ServiceHelper;
+import org.eclipse.equinox.prov.director.IDirector;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.metadata.RequiredCapability;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepository;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepositoryManager;
+import org.eclipse.osgi.service.resolver.VersionRange;
+import org.osgi.framework.Version;
+
+/**
+ * Base class for provisioning tests with convenience methods used by multiple tests.
+ */
+public class AbstractProvisioningTest extends TestCase {
+ protected static VersionRange ANY_VERSION = new VersionRange(Version.emptyVersion, true, new Version(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE), true);
+
+ /**
+ * Tracks the metadata repositories created by this test instance. The repositories
+ * will be removed automatically at the end of the test.
+ */
+ private List metadataRepos = new ArrayList();
+
+ public AbstractProvisioningTest() {
+ super("");
+ }
+
+ public AbstractProvisioningTest(String name) {
+ super(name);
+ }
+
+ /**
+ * Asserts that the given profile contains *only* the given IUs.
+ */
+ protected void assertProfileContains(String message, Profile profile, IInstallableUnit[] expectedUnits) {
+ HashSet expected = new HashSet(Arrays.asList(expectedUnits));
+ for (Iterator it = profile.getInstallableUnits(); it.hasNext();) {
+ IInstallableUnit actual = (IInstallableUnit) it.next();
+ if (!expected.remove(actual))
+ fail(message + " profile " + profile.getProfileId() + " contained an unexpected unit: " + actual);
+ }
+ if (!expected.isEmpty())
+ fail(message + " profile " + profile.getProfileId() + " did not contain expected units: " + expected);
+ }
+
+ /**
+ * Asserts that the given profile contains all the given IUs.
+ */
+ protected void assertProfileContainsAll(String message, Profile profile, IInstallableUnit[] expectedUnits) {
+ HashSet expected = new HashSet(Arrays.asList(expectedUnits));
+ for (Iterator it = profile.getInstallableUnits(); it.hasNext();) {
+ IInstallableUnit actual = (IInstallableUnit) it.next();
+ expected.remove(actual);
+ }
+ if (!expected.isEmpty())
+ fail(message + " profile " + profile.getProfileId() + " did not contain expected units: " + expected);
+ }
+
+ /**
+ * Creates and returns a correctly formatted LDAP filter with the given key and value.
+ */
+ protected String createFilter(String filterKey, String filterValue) {
+ return "(" + filterKey + '=' + filterValue + ')';
+ }
+
+ /**
+ * Creates and returns a required capability with the provided attributes.
+ */
+ protected RequiredCapability[] createRequiredCapabilities(String namespace, String name, String filter) {
+ return createRequiredCapabilities(namespace, name, ANY_VERSION, filter);
+ }
+
+ /**
+ * Creates and returns a required capability with the provided attributes.
+ */
+ protected RequiredCapability[] createRequiredCapabilities(String namespace, String name, VersionRange range, String filter) {
+ return new RequiredCapability[] {new RequiredCapability(namespace, name, range, filter, false, false)};
+ }
+
+ /**
+ * Adds a test metadata repository to the system that provides the given units.
+ * The repository will automatically be removed in the tearDown method.
+ */
+ protected void createTestMetdataRepository(IInstallableUnit[] units) {
+ IMetadataRepository repo = new TestMetadataRepository(units);
+ IMetadataRepositoryManager repoMan = (IMetadataRepositoryManager) ServiceHelper.getService(TestActivator.getContext(), IMetadataRepositoryManager.class.getName());
+ assertNotNull(repoMan);
+ repoMan.addRepository(repo);
+ metadataRepos.add(repo);
+ }
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ //remove all metadata repositories created by this test
+ if (!metadataRepos.isEmpty()) {
+ IMetadataRepositoryManager repoMan = (IMetadataRepositoryManager) ServiceHelper.getService(TestActivator.getContext(), IMetadataRepositoryManager.class.getName());
+ for (Iterator it = metadataRepos.iterator(); it.hasNext();) {
+ IMetadataRepository repo = (IMetadataRepository) it.next();
+ repoMan.removeRepository(repo);
+ }
+ metadataRepos.clear();
+ }
+ }
+
+ public IDirector createDirector() {
+ return (IDirector) ServiceHelper.getService(TestActivator.getContext(), IDirector.class.getName());
+ }
+
+ public void printProfile(Profile toPrint) {
+ boolean containsIU = false;
+ for (Iterator iterator = toPrint.getInstallableUnits(); iterator.hasNext();) {
+ System.out.println(iterator.next());
+ containsIU = true;
+ }
+ if (!containsIU)
+ System.out.println("No iu");
+ }
+
+ public void assertEmptyProfile(Profile p) {
+ assertNotNull("The profile should not be null", p);
+ boolean containsIU = false;
+ for (Iterator iterator = p.getInstallableUnits(); iterator.hasNext();) {
+ containsIU = true;
+ }
+ if (containsIU)
+ fail("The profile should be empty,profileId=" + p);
+ }
+
+ protected void assertNotOK(IStatus result) {
+ if (result.getSeverity() != IStatus.OK)
+ return;
+ fail("The status should not have been OK");
+ }
+
+ protected void assertOK(IStatus result) {
+ if (result.getSeverity() == IStatus.OK)
+ return;
+
+ if (result instanceof MultiStatus) {
+ MultiStatus ms = (MultiStatus) result;
+ IStatus children[] = ms.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ System.err.println(children[i]);
+ }
+ }
+
+ Throwable t = result.getException();
+ if (t != null)
+ t.printStackTrace();
+
+ fail(result.toString());
+ }
+
+ protected void assertNotIUs(IInstallableUnit[] ius, Iterator installableUnits) {
+ Set notexpected = new HashSet();
+ notexpected.addAll(Arrays.asList(ius));
+
+ while (installableUnits.hasNext()) {
+ IInstallableUnit next = (IInstallableUnit) installableUnits.next();
+ if (notexpected.contains(next)) {
+ fail("not expected [" + next + "]");
+ }
+ }
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/AutomatedTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/AutomatedTests.java
new file mode 100644
index 000000000..bf2dc9d51
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/AutomatedTests.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.tests;
+
+import junit.framework.*;
+
+/**
+ * This is the master test suite for all automated provisioning tests. It runs every test
+ * that is suitable for running in an automated fashion as part of a build. Some
+ * tests may be excluded if they require special setup (such as generating metadata).
+ */
+public class AutomatedTests extends TestCase {
+ public static Test suite() {
+ TestSuite suite = new TestSuite(AutomatedTests.class.getName());
+ suite.addTest(org.eclipse.equinox.prov.tests.director.AllTests.suite());
+ suite.addTest(org.eclipse.equinox.prov.tests.download.AllTests.suite());
+ suite.addTest(org.eclipse.equinox.prov.tests.engine.AllTests.suite());
+ suite.addTest(org.eclipse.equinox.prov.tests.metadata.AllTests.suite());
+ return suite;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/TestActivator.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/TestActivator.java
new file mode 100644
index 000000000..9cef88a04
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/TestActivator.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.tests;
+
+import org.osgi.framework.*;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+public class TestActivator implements BundleActivator {
+ public static final String PI_PROV_TESTS = "org.eclipse.equinox.prov.test";
+ public static BundleContext context;
+ private static PackageAdmin packageAdmin = null;
+ private static ServiceReference packageAdminRef = null;
+
+ public static BundleContext getContext() {
+ return context;
+ }
+
+ public void start(BundleContext context) throws Exception {
+ TestActivator.context = context;
+ packageAdminRef = context.getServiceReference(PackageAdmin.class.getName());
+ packageAdmin = (PackageAdmin) context.getService(packageAdminRef);
+
+ //This is a hack because the junit plugin launch config do not allow to start bundles
+ getBundle("org.eclipse.equinox.prov.examplarysetup").start();
+ getBundle("org.eclipse.equinox.frameworkadmin.equinox").start();
+ getBundle("org.eclipse.equinox.simpleconfigurator.manipulator").start();
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ TestActivator.context = null;
+ }
+
+ public static Bundle getBundle(String symbolicName) {
+ if (packageAdmin == null)
+ return null;
+ Bundle[] bundles = packageAdmin.getBundles(symbolicName, null);
+ if (bundles == null)
+ return null;
+ //Return the first bundle that is not installed or uninstalled
+ for (int i = 0; i < bundles.length; i++) {
+ if ((bundles[i].getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) == 0) {
+ return bundles[i];
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/TestArtifactRepository.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/TestArtifactRepository.java
new file mode 100644
index 000000000..ada291281
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/TestArtifactRepository.java
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.tests;
+
+import java.io.*;
+import java.net.*;
+import java.util.HashMap;
+import java.util.Map;
+import junit.framework.Assert;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.internal.prov.artifact.repository.ArtifactRequest;
+import org.eclipse.equinox.prov.artifact.repository.*;
+import org.eclipse.equinox.prov.artifact.repository.processing.ProcessingStepHandler;
+import org.eclipse.equinox.prov.core.helpers.*;
+import org.eclipse.equinox.prov.core.helpers.MultiStatus;
+import org.eclipse.equinox.prov.core.repository.IRepositoryInfo;
+import org.eclipse.equinox.prov.core.repository.RepositoryCreationException;
+import org.eclipse.equinox.prov.metadata.IArtifactKey;
+
+/**
+ * A simple artifact repository implementation used for testing purposes.
+ * All artifacts are kept in memory.
+ */
+public class TestArtifactRepository extends Assert implements IArtifactRepository {
+ private static final String SCHEME = "testartifactrepo";
+ /**
+ * Map of IArtifactKey -> String (location)
+ */
+ Map keysToLocations = new HashMap();
+ /**
+ * Map of String (location) -> byte[] (contents)
+ */
+ Map locationsToContents = new HashMap();
+
+ Transport testhandler = new Transport() {
+ public IStatus download(String toDownload, OutputStream target, IProgressMonitor pm) {
+ byte[] contents = (byte[]) locationsToContents.get(toDownload);
+ if (contents == null)
+ fail("Attempt to download missing artifact in TestArtifactRepository: " + toDownload);
+ try {
+ target.write(contents);
+ } catch (IOException e) {
+ e.printStackTrace();
+ fail("Unexpected exception in TestArtifactRepository" + e.getMessage());
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ private URL url;
+
+ public void addArtifact(IArtifactKey key, byte[] contents) {
+ String location = key.toString();
+ keysToLocations.put(key, location);
+ locationsToContents.put(location, contents);
+ }
+
+ public URI getArtifact(IArtifactKey key) {
+ String location = (String) keysToLocations.get(key);
+ if (location == null)
+ return null;
+ try {
+ return new URI(SCHEME, location, null);
+ } catch (URISyntaxException e) {
+ fail("Invalid URI in TestArtifactRepository: " + e.getMessage());
+ return null;
+ }
+ }
+
+ public IArtifactKey[] getArtifactKeys() {
+ return (IArtifactKey[]) keysToLocations.keySet().toArray(new IArtifactKey[0]);
+ }
+
+ private IStatus getArtifact(ArtifactRequest request, IProgressMonitor monitor) {
+ request.setSourceRepository(this);
+ request.perform(monitor);
+ return request.getResult();
+ }
+
+ public IStatus getArtifacts(IArtifactRequest[] requests, IProgressMonitor monitor) {
+ SubMonitor subMonitor = SubMonitor.convert(monitor, requests.length);
+ try {
+ MultiStatus overallStatus = new MultiStatus();
+ for (int i = 0; i < requests.length; i++) {
+ overallStatus.add(getArtifact((ArtifactRequest) requests[i], subMonitor.newChild(1)));
+ }
+ return (monitor.isCanceled() ? Status.CANCEL_STATUS : overallStatus);
+ } finally {
+ subMonitor.done();
+ }
+ }
+
+ public String getType() {
+ return SCHEME;
+ }
+
+ public URL getLocation() {
+ return url;
+ }
+
+ public void initialize(URL repoURL, InputStream descriptorFile) throws RepositoryCreationException {
+ this.url = repoURL;
+ }
+
+ public String getDescription() {
+ return "A Test Artifact Repository"; //$NON-NLS-1$
+ }
+
+ public String getName() {
+ return "ATestArtifactRepository"; //$NON-NLS-1$
+ }
+
+ public String getProvider() {
+ return "org.eclipse"; //$NON-NLS-1$
+ }
+
+ public String getVersion() {
+ return "1"; //$NON-NLS-1$
+ }
+
+ public UnmodifiableProperties getProperties() {
+ return new UnmodifiableProperties(new OrderedProperties());
+ }
+
+ public Object getAdapter(Class adapter) {
+ if (adapter == TestArtifactRepository.class || adapter == IArtifactRepository.class || adapter == IRepositoryInfo.class) {
+ return this;
+ }
+ return null;
+ }
+
+ public boolean contains(IArtifactDescriptor descriptor) {
+ return keysToLocations.get(descriptor.getArtifactKey()) != null;
+ }
+
+ public boolean contains(IArtifactKey key) {
+ return keysToLocations.get(key) != null;
+ }
+
+ public IStatus getArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) {
+ ProcessingStepHandler handler = new ProcessingStepHandler();
+ destination = handler.createAndLink(descriptor.getProcessingSteps(), null, destination, monitor);
+ testhandler.download((String) keysToLocations.get(descriptor.getArtifactKey()), destination, monitor);
+ return Status.OK_STATUS;
+ }
+
+ public IArtifactDescriptor[] getArtifactDescriptors(IArtifactKey key) {
+ if (!contains(key))
+ return null;
+ return new IArtifactDescriptor[] {new ArtifactDescriptor(key)};
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/TestMetadataRepository.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/TestMetadataRepository.java
new file mode 100644
index 000000000..99cf56c03
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/TestMetadataRepository.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.tests;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.*;
+import junit.framework.Assert;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.equinox.prov.core.helpers.OrderedProperties;
+import org.eclipse.equinox.prov.core.helpers.UnmodifiableProperties;
+import org.eclipse.equinox.prov.core.repository.IRepositoryInfo;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.metadata.RequiredCapability;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepository;
+import org.eclipse.equinox.prov.query.CompoundIterator;
+import org.eclipse.osgi.service.resolver.VersionRange;
+
+/**
+ * A simple metadata repository used for testing purposes. All metadata
+ * is kept in memory.
+ */
+public class TestMetadataRepository extends Assert implements IMetadataRepository {
+
+ private static final String SCHEME = "testmetadatarepo"; //$NON-NLS-1$
+ private final List units = new ArrayList();
+ private URL url;
+
+ public TestMetadataRepository(IInstallableUnit[] ius) {
+ units.addAll(Arrays.asList(ius));
+ try {
+ url = File.createTempFile("TestMetadataRepository", Long.toString(System.currentTimeMillis())).toURL();
+ } catch (MalformedURLException e) {
+ fail(e.getMessage());
+ } catch (IOException e) {
+ fail(e.getMessage());
+ }
+ }
+
+ public IInstallableUnit[] getInstallableUnits(IProgressMonitor monitor) {
+ IInstallableUnit[] result = query(null, null, null, false, monitor);
+ return result;
+ }
+
+ public Iterator getIterator(String id, VersionRange range, RequiredCapability[] requirements, boolean and) {
+ return new CompoundIterator(new Iterator[] {units.iterator()}, id, range, requirements, and);
+ }
+
+ public URL getLocation() {
+ return url;
+ }
+
+ public IInstallableUnit[] query(String id, VersionRange range, RequiredCapability[] requirements, boolean and, IProgressMonitor monitor) {
+ return CompoundIterator.asArray(new CompoundIterator(new Iterator[] {units.iterator()}, id, range, requirements, and), null);
+ }
+
+ public String getDescription() {
+ return "A Test Metadata Repository"; //$NON-NLS-1$;
+ }
+
+ public String getName() {
+ return "ATestMetadataRepository"; //$NON-NLS-1$;
+ }
+
+ public String getProvider() {
+ return "org.eclipse"; //$NON-NLS-1$
+ }
+
+ public String getType() {
+ return SCHEME;
+ }
+
+ public String getVersion() {
+ return "1"; //$NON-NLS-1$
+ }
+
+ public UnmodifiableProperties getProperties() {
+ return new UnmodifiableProperties(new OrderedProperties());
+ }
+
+ public Object getAdapter(Class adapter) {
+ if (adapter == TestMetadataRepository.class || adapter == IMetadataRepository.class || adapter == IRepositoryInfo.class) {
+ return this;
+ }
+ return null;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/AllTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/AllTests.java
new file mode 100644
index 000000000..496438193
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/AllTests.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.tests.artifact.repository;
+
+import junit.framework.*;
+
+/**
+ * Performs all automated director tests.
+ */
+public class AllTests extends TestCase {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(AllTests.class.getName());
+ suite.addTestSuite(JarURLRepositoryTest.class);
+ return suite;
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/JarURLRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/JarURLRepositoryTest.java
new file mode 100644
index 000000000..8b8d60772
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/JarURLRepositoryTest.java
@@ -0,0 +1,47 @@
+package org.eclipse.equinox.prov.tests.artifact.repository;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import junit.framework.TestCase;
+import org.eclipse.equinox.internal.prov.metadata.ArtifactKey;
+import org.eclipse.equinox.prov.artifact.repository.IArtifactRepository;
+import org.eclipse.equinox.prov.artifact.repository.IArtifactRepositoryManager;
+import org.eclipse.equinox.prov.tests.TestActivator;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.Version;
+
+public class JarURLRepositoryTest extends TestCase {
+
+ private ServiceReference managerRef;
+ private IArtifactRepositoryManager manager;
+
+ public JarURLRepositoryTest(String name) {
+ super(name);
+ }
+
+ public JarURLRepositoryTest() {
+ super("");
+ }
+
+ protected void setUp() throws Exception {
+ managerRef = TestActivator.getContext().getServiceReference(IArtifactRepositoryManager.class.getName());
+ manager = (IArtifactRepositoryManager) TestActivator.getContext().getService(managerRef);
+ }
+
+ protected void tearDown() throws Exception {
+ manager = null;
+ TestActivator.getContext().ungetService(managerRef);
+ }
+
+ public void testJarURLRepository() {
+ URL engineJar = TestActivator.getContext().getBundle().getEntry("/testData/enginerepo.jar");
+ URL jarRepoURL = null;
+ try {
+ jarRepoURL = new URL("jar:" + engineJar.toString() + "!/");
+ } catch (MalformedURLException e) {
+ fail(e.getMessage());
+ }
+ IArtifactRepository repo = manager.loadRepository(jarRepoURL, null);
+ assertTrue(repo.contains(new ArtifactKey("eclipse", "plugin", "org.eclipse.equinox.prov.engine", new Version("0.1.0.200709241631"))));
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/Adder.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/Adder.java
new file mode 100644
index 000000000..8d23231b7
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/Adder.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+* Copyright (c) 2007 compeople AG and others.
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*
+* Contributors:
+* compeople AG (Stefan Liebig) - initial API and implementation
+* IBM - continuing development
+*******************************************************************************/
+package org.eclipse.equinox.prov.tests.artifact.repository.processing;
+
+import java.io.IOException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.internal.prov.artifact.repository.Activator;
+import org.eclipse.equinox.prov.artifact.repository.IArtifactDescriptor;
+import org.eclipse.equinox.prov.artifact.repository.processing.ProcessingStep;
+import org.eclipse.equinox.prov.artifact.repository.processing.ProcessingStepDescriptor;
+
+public class Adder extends ProcessingStep {
+
+ protected int operand;
+
+ public Adder() {
+ // needed
+ }
+
+ public Adder(int operand) {
+ super();
+ this.operand = operand;
+ }
+
+ public void initialize(ProcessingStepDescriptor descriptor, IArtifactDescriptor context) {
+ super.initialize(descriptor, context);
+ try {
+ operand = Integer.valueOf(descriptor.getData()).intValue();
+ } catch (NumberFormatException e) {
+ int code = descriptor.isRequired() ? IStatus.ERROR : IStatus.INFO;
+ status = new Status(code, Activator.ID, "Adder operand specification invalid", e);
+ return;
+ }
+ }
+
+ public void write(int b) throws IOException {
+ destination.write(b + operand);
+ }
+
+ public void close() throws IOException {
+ super.close();
+ status = Status.OK_STATUS;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/ByteShifter.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/ByteShifter.java
new file mode 100644
index 000000000..6ed97709d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/ByteShifter.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+* Copyright (c) 2007 compeople AG and others.
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*
+* Contributors:
+* compeople AG (Stefan Liebig) - initial API and implementation
+* IBM - continuing development
+*******************************************************************************/
+package org.eclipse.equinox.prov.tests.artifact.repository.processing;
+
+import java.io.IOException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.internal.prov.artifact.repository.Activator;
+import org.eclipse.equinox.prov.artifact.repository.IArtifactDescriptor;
+import org.eclipse.equinox.prov.artifact.repository.processing.ProcessingStep;
+import org.eclipse.equinox.prov.artifact.repository.processing.ProcessingStepDescriptor;
+
+public class ByteShifter extends ProcessingStep {
+
+ protected int operand;
+
+ public ByteShifter() {
+ super();
+ }
+
+ public ByteShifter(int shiftLeft) {
+ super();
+ this.operand = shiftLeft;
+ basicInitialize(null);
+ }
+
+ private void basicInitialize(ProcessingStepDescriptor descriptor) {
+ // if the status is already set to something that not ok, we've already found a problem.
+ if (status != null && status.getCode() != IStatus.OK)
+ return;
+
+ int code;
+ // if there is a descriptor, decide if the "bad case" is an error or info. If no
+ // descriptor then default to error.
+ if (descriptor != null)
+ code = descriptor.isRequired() ? IStatus.ERROR : IStatus.INFO;
+ else
+ code = IStatus.ERROR;
+
+ // finally, check the actual setup and set the status.
+ if (operand <= 0)
+ status = new Status(code, Activator.ID, "ByteShifter operand invalid: " + operand);
+ }
+
+ public void initialize(ProcessingStepDescriptor descriptor, IArtifactDescriptor context) {
+ super.initialize(descriptor, context);
+ try {
+ operand = Integer.valueOf(descriptor.getData()).intValue();
+ } catch (NumberFormatException e) {
+ int code = descriptor.isRequired() ? IStatus.ERROR : IStatus.INFO;
+ status = new Status(code, Activator.ID, "ByteShifter operand specification invalid", e);
+ return;
+ }
+ basicInitialize(descriptor);
+ }
+
+ public void write(int b) throws IOException {
+ destination.write(b == -1 ? b : b << operand);
+ }
+
+ public IStatus getStatus() {
+ return Status.OK_STATUS;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/Counter.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/Counter.java
new file mode 100644
index 000000000..f21e0265e
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/Counter.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+* Copyright (c) 2007 IBM Corporation and others.
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*
+* Contributors:
+* IBM Corporation - initial API and implementation
+*******************************************************************************/
+package org.eclipse.equinox.prov.tests.artifact.repository.processing;
+
+import java.io.IOException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.internal.prov.artifact.repository.Activator;
+import org.eclipse.equinox.prov.artifact.repository.IArtifactDescriptor;
+import org.eclipse.equinox.prov.artifact.repository.processing.ProcessingStep;
+import org.eclipse.equinox.prov.artifact.repository.processing.ProcessingStepDescriptor;
+
+public class Counter extends ProcessingStep {
+
+ protected long size = -1;
+ long total = 0;
+
+ public Counter() {
+ // needed
+ }
+
+ public Counter(long size) {
+ super();
+ this.size = size;
+ basicInitialize(null);
+ }
+
+ private void basicInitialize(ProcessingStepDescriptor descriptor) {
+ // if the status is already set to something that not ok, we've already found a problem.
+ if (status != null && status.getCode() != IStatus.OK)
+ return;
+
+ int code;
+ // if there is a descriptor, decide if the "bad case" is an error or info. If no
+ // descriptor then default to erorr.
+ if (descriptor != null)
+ code = descriptor.isRequired() ? IStatus.ERROR : IStatus.INFO;
+ else
+ code = IStatus.ERROR;
+
+ // finally, check the actual setup and set the status.
+ if (size != -1)
+ status = new Status(code, Activator.ID, "Counter size not set");
+ }
+
+ public void initialize(ProcessingStepDescriptor descriptor, IArtifactDescriptor context) {
+ super.initialize(descriptor, context);
+ String data = descriptor.getData();
+ if (data == null)
+ return;
+ try {
+ if (data.equals("download"))
+ size = Long.parseLong(context.getProperty(IArtifactDescriptor.DOWNLOAD_SIZE));
+ else if (data.equals("artifact"))
+ size = Long.parseLong(context.getProperty(IArtifactDescriptor.ARTIFACT_SIZE));
+ else
+ size = Long.parseLong(data);
+ } catch (NumberFormatException e) {
+ int code = descriptor.isRequired() ? IStatus.ERROR : IStatus.INFO;
+ status = new Status(code, Activator.ID, "Counter size specification invalid", e);
+ return;
+ }
+ basicInitialize(descriptor);
+ }
+
+ public void write(int b) throws IOException {
+ total++;
+ destination.write(b);
+ }
+
+ public void close() throws IOException {
+ super.close();
+ if (total != size)
+ status = new Status(IStatus.WARNING, "plugin id", "Size mismatch. Was " + total + " should have been " + size);
+ else
+ status = Status.OK_STATUS;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/MD5Verifier.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/MD5Verifier.java
new file mode 100644
index 000000000..5609874a2
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/MD5Verifier.java
@@ -0,0 +1,90 @@
+/*******************************************************************************
+* Copyright (c) 2007 compeople AG and others.
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*
+* Contributors:
+* compeople AG (Stefan Liebig) - initial API and implementation
+* IBM - continuing development
+*******************************************************************************/
+package org.eclipse.equinox.prov.tests.artifact.repository.processing;
+
+import java.io.IOException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.internal.prov.artifact.repository.Activator;
+import org.eclipse.equinox.prov.artifact.repository.IArtifactDescriptor;
+import org.eclipse.equinox.prov.artifact.repository.processing.ProcessingStep;
+import org.eclipse.equinox.prov.artifact.repository.processing.ProcessingStepDescriptor;
+
+public class MD5Verifier extends ProcessingStep {
+
+ protected String md5Test;
+ private MessageDigest md5;
+
+ public MD5Verifier() {
+ super();
+ }
+
+ public MD5Verifier(String md5Test) {
+ super();
+ this.md5Test = md5Test;
+ basicInitialize(null);
+ }
+
+ public void initialize(ProcessingStepDescriptor descriptor, IArtifactDescriptor context) {
+ super.initialize(descriptor, context);
+ String data = descriptor.getData();
+ if (data.equals("download"))
+ md5Test = context.getProperty(IArtifactDescriptor.DOWNLOAD_MD5);
+ else if (data.equals("artifact"))
+ md5Test = context.getProperty(IArtifactDescriptor.ARTIFACT_MD5);
+ else
+ md5Test = data;
+ basicInitialize(descriptor);
+ }
+
+ private void basicInitialize(ProcessingStepDescriptor descriptor) {
+ int code;
+ if (descriptor == null)
+ code = IStatus.ERROR;
+ else
+ code = descriptor.isRequired() ? IStatus.ERROR : IStatus.INFO;
+ if (md5Test == null || md5Test.length() != 32)
+ status = new Status(code, Activator.ID, "MD5 value not available or incorrect size");
+ try {
+ md5 = MessageDigest.getInstance("MD5");
+ } catch (NoSuchAlgorithmException e) {
+ status = new Status(code, Activator.ID, "Could not create MD5 algorithm", e);
+ }
+ }
+
+ public void write(int b) throws IOException {
+ if (b != -1)
+ md5.update((byte) b);
+ destination.write(b);
+ }
+
+ public void close() throws IOException {
+ super.close();
+
+ byte[] digest = md5.digest();
+ StringBuffer buf = new StringBuffer();
+ for (int i = 0; i < digest.length; i++) {
+ if ((digest[i] & 0xFF) < 0x10)
+ buf.append('0');
+ buf.append(Integer.toHexString(digest[i] & 0xFF));
+ }
+
+ // if the hashes don't line up set the status to error.
+ if (!buf.toString().equals(md5Test)) {
+ String message = "Error processing stream. MD5 hash is not as expected.";
+ status = new Status(IStatus.ERROR, "plugin id", message);
+ } else
+ status = Status.OK_STATUS;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/Multiplier.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/Multiplier.java
new file mode 100644
index 000000000..611fd8b7a
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/Multiplier.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+* Copyright (c) 2007 compeople AG and others.
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*
+* Contributors:
+* compeople AG (Stefan Liebig) - initial API and implementation
+* IBM - continuing development
+*******************************************************************************/
+package org.eclipse.equinox.prov.tests.artifact.repository.processing;
+
+import java.io.IOException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.internal.prov.artifact.repository.Activator;
+import org.eclipse.equinox.prov.artifact.repository.IArtifactDescriptor;
+import org.eclipse.equinox.prov.artifact.repository.processing.ProcessingStep;
+import org.eclipse.equinox.prov.artifact.repository.processing.ProcessingStepDescriptor;
+
+public class Multiplier extends ProcessingStep {
+
+ protected int operand;
+
+ public Multiplier() {
+ // needed
+ }
+
+ public Multiplier(int operand) {
+ super();
+ this.operand = operand;
+ }
+
+ public void initialize(ProcessingStepDescriptor descriptor, IArtifactDescriptor context) {
+ super.initialize(descriptor, context);
+ try {
+ operand = Integer.valueOf(descriptor.getData()).intValue();
+ } catch (NumberFormatException e) {
+ int code = descriptor.isRequired() ? IStatus.ERROR : IStatus.INFO;
+ status = new Status(code, Activator.ID, "Multiplier operand specification invalid", e);
+ return;
+ }
+ }
+
+ public void write(int b) throws IOException {
+ destination.write(b == -1 ? b : b * operand);
+ }
+
+ public void close() throws IOException {
+ super.close();
+ status = Status.OK_STATUS;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/Pack200Unpacker.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/Pack200Unpacker.java
new file mode 100644
index 000000000..ac0e57689
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/Pack200Unpacker.java
@@ -0,0 +1,107 @@
+/*******************************************************************************
+* Copyright (c) 2007 compeople AG and others.
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*
+* Contributors:
+* compeople AG (Stefan Liebig) - initial API and implementation
+* IBM - continuing development
+*******************************************************************************/
+package org.eclipse.equinox.prov.tests.artifact.repository.processing;
+
+import java.io.*;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.internal.p2.jarprocessor.UnpackStep;
+import org.eclipse.equinox.internal.p2.jarprocessor.Utils;
+import org.eclipse.equinox.internal.prov.artifact.repository.Activator;
+import org.eclipse.equinox.p2.jarprocessor.JarProcessorExecutor;
+import org.eclipse.equinox.p2.jarprocessor.JarProcessorExecutor.Options;
+import org.eclipse.equinox.prov.artifact.repository.IArtifactDescriptor;
+import org.eclipse.equinox.prov.artifact.repository.processing.ProcessingStep;
+import org.eclipse.equinox.prov.artifact.repository.processing.ProcessingStepDescriptor;
+import org.eclipse.equinox.prov.core.helpers.FileUtils;
+
+/**
+ * The Pack200Unpacker expects an input containing ".jar.pack.gz" data.
+ */
+public class Pack200Unpacker extends ProcessingStep {
+ private final static String PACKED_EXT = Utils.JAR_SUFFIX + Utils.PACKED_SUFFIX;
+
+ private File packed;
+ private OutputStream tempStream;
+
+ public void initialize(ProcessingStepDescriptor descriptor, IArtifactDescriptor context) {
+ super.initialize(descriptor, context);
+ if (!UnpackStep.canUnpack())
+ status = new Status(IStatus.ERROR, Activator.ID, "Unpack facility not configured");
+ }
+
+ public void write(int b) throws IOException {
+ OutputStream stream = getOutputStream();
+ stream.write(b);
+ }
+
+ private OutputStream getOutputStream() throws IOException {
+ if (tempStream != null)
+ return tempStream;
+ // store input stream in temporary file
+ packed = File.createTempFile("pack200", PACKED_EXT);
+ tempStream = new BufferedOutputStream(new FileOutputStream(packed));
+ return tempStream;
+ }
+
+ private void performUnpack() throws IOException {
+ BufferedInputStream unpackedStream = null;
+ File unpacked = null;
+ File workDir = null;
+ try {
+ if (tempStream == null)
+ // hmmm, no one wrote to this stream so there is nothing to pass on
+ return;
+ // Ok, so there is content, close the tempStream
+ tempStream.close();
+ // now create a temporary directory for the JarProcessor to work in
+ // TODO How to create a unique, temporary directory atomically?
+ workDir = File.createTempFile("work", "");
+ if (!workDir.delete())
+ throw new IOException("Could not delete file for creating temporary working dir.");
+ if (!workDir.mkdirs())
+ throw new IOException("Could not create temporary working dir.");
+
+ // unpack
+ Options options = new Options();
+ options.unpack = true;
+ options.processAll = true;
+ options.input = packed;
+ options.outputDir = workDir.getPath();
+ new JarProcessorExecutor().runJarProcessor(options);
+
+ // now write the unpacked content to our destination
+ String packedFileName = packed.getName();
+ unpacked = new File(workDir, packedFileName.substring(0, packedFileName.length() - Utils.PACKED_SUFFIX.length()));
+ unpackedStream = new BufferedInputStream(new FileInputStream(unpacked));
+ FileUtils.copyStream(unpackedStream, true, destination, false);
+ unpackedStream = null;
+ } finally {
+ if (packed != null)
+ packed.delete();
+ if (unpackedStream != null)
+ unpackedStream.close();
+ if (unpacked != null)
+ unpacked.delete();
+ if (workDir != null)
+ workDir.delete();
+ }
+ }
+
+ public void close() throws IOException {
+ // When we go to close we must have seen all the content we are going to see
+ // So before closing, run unpack and write the unpacked result to the destination
+ performUnpack();
+ super.close();
+ status = Status.OK_STATUS;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/ProcessingStepHandlerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/ProcessingStepHandlerTest.java
new file mode 100644
index 000000000..d7006c219
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/ProcessingStepHandlerTest.java
@@ -0,0 +1,207 @@
+/*******************************************************************************
+* Copyright (c) 2007 compeople AG and others.
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*
+* Contributors:
+* compeople AG (Stefan Liebig) - initial API and implementation
+* IBM - continuing development
+*******************************************************************************/
+package org.eclipse.equinox.prov.tests.artifact.repository.processing;
+
+import java.io.*;
+import java.util.Arrays;
+import junit.framework.TestCase;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.prov.artifact.repository.processing.*;
+import org.eclipse.equinox.prov.core.helpers.FileUtils;
+import org.eclipse.equinox.prov.tests.TestActivator;
+
+public class ProcessingStepHandlerTest extends TestCase {
+
+ // private static final int BUFFER_SIZE = 8 * 1024;
+
+ ProcessingStepHandler handler = new ProcessingStepHandler();
+ IProgressMonitor monitor = new NullProgressMonitor();
+
+ public void testExecuteNoPSs() throws IOException {
+ ProcessingStepDescriptor[] descriptors = new ProcessingStepDescriptor[0];
+ OutputStream result = new ByteArrayOutputStream(10);
+ OutputStream testStream = handler.createAndLink(descriptors, null, result, monitor);
+ testStream.write("Test".getBytes());
+ testStream.close();
+ assertEquals("Test", result.toString());
+ }
+
+ public void testExecuteOneByteShifterPS() throws IOException {
+ ProcessingStep[] steps = new ProcessingStep[] {new ByteShifter(1)};
+ ByteArrayOutputStream result = new ByteArrayOutputStream(10);
+ OutputStream testStream = handler.link(steps, result, monitor);
+ testStream.write(new byte[] {1});
+ testStream.close();
+ assertTrue(Arrays.equals(new byte[] {2}, result.toByteArray()));
+ }
+
+ public void testExecuteTwoByteShifterPSs() throws IOException {
+ ProcessingStep[] steps = new ProcessingStep[] {new ByteShifter(1), new ByteShifter(2)};
+ ByteArrayOutputStream result = new ByteArrayOutputStream(10);
+ OutputStream testStream = handler.link(steps, result, monitor);
+ testStream.write(new byte[] {1});
+ testStream.close();
+ assertTrue(Arrays.equals(new byte[] {8}, result.toByteArray()));
+ }
+
+ public void testExecuteOneMD5VerifierPSOk() throws IOException {
+ ProcessingStep[] steps = new ProcessingStep[] {new MD5Verifier("0cbc6611f5540bd0809a388dc95a615b")};
+ ByteArrayOutputStream result = new ByteArrayOutputStream(10);
+ OutputStream testStream = handler.link(steps, result, monitor);
+ testStream.write("Test".getBytes());
+ testStream.close();
+ assertEquals("Test", result.toString());
+ }
+
+ public void testExecuteOneMD5VerifierPSFails() throws IOException {
+ ProcessingStep[] steps = new ProcessingStep[] {new MD5Verifier("9cbc6611f5540bd0809a388dc95a615b")};
+ ByteArrayOutputStream result = new ByteArrayOutputStream(10);
+ OutputStream testStream = handler.link(steps, result, monitor);
+ testStream.write("Test".getBytes());
+ try {
+ testStream.close();
+ assertEquals("Test", result.toString());
+ assertTrue((handler.validateSteps(testStream).getSeverity() == IStatus.ERROR));
+ } catch (IOException e) {
+ assertTrue(true);
+ }
+ }
+
+ public void testExecuteOneByteShifterAndOneMD5VerifierPSOk() throws IOException {
+ // Order of PSs is important!!
+ ProcessingStep[] steps = new ProcessingStep[] {new ByteShifter(1), new MD5Verifier("ceeee507e8db83294600218b4e198897")};
+ ByteArrayOutputStream result = new ByteArrayOutputStream(10);
+ OutputStream testStream = handler.link(steps, result, monitor);
+ testStream.write(new byte[] {1, 2, 3, 4, 5});
+ testStream.close();
+ assertTrue(Arrays.equals(new byte[] {2, 4, 6, 8, 10}, result.toByteArray()));
+ }
+
+ public void testExecuteOneByteShifterAndOneMD5VerifierPSFailWrongOrder() throws IOException {
+ // Order of PSs is important - here it wrong!!
+ ProcessingStep[] steps = new ProcessingStep[] {new MD5Verifier("af476bbaf152a4c39ca4e5c498a88aa0"), new ByteShifter(1)};
+ ByteArrayOutputStream result = new ByteArrayOutputStream(10);
+ OutputStream testStream = handler.link(steps, result, monitor);
+ testStream.write(new byte[] {1, 2, 3, 4, 5});
+ try {
+ testStream.close();
+ assertTrue(Arrays.equals(new byte[] {2, 4, 6, 8, 10}, result.toByteArray()));
+ assertTrue((handler.validateSteps(testStream).getSeverity() == IStatus.ERROR));
+ } catch (IOException e) {
+ assertTrue(true);
+ }
+ }
+
+ public void testAssureOrderingOfPSs1() throws IOException {
+ ProcessingStep[] steps = new ProcessingStep[] {new Adder(1), new Multiplier(2)};
+ ByteArrayOutputStream result = new ByteArrayOutputStream(10);
+ OutputStream testStream = handler.link(steps, result, monitor);
+ testStream.write(new byte[] {1, 2, 3, 4, 5});
+ testStream.close();
+ assertTrue(Arrays.equals(new byte[] {4, 6, 8, 10, 12}, result.toByteArray()));
+ }
+
+ public void testAssureOrderingOfPSs2() throws IOException {
+ ProcessingStep[] steps = new ProcessingStep[] {new Multiplier(2), new Adder(1)};
+ ByteArrayOutputStream result = new ByteArrayOutputStream(10);
+ OutputStream testStream = handler.link(steps, result, monitor);
+ testStream.write(new byte[] {1, 2, 3, 4, 5});
+ testStream.close();
+ assertTrue(Arrays.equals(new byte[] {3, 5, 7, 9, 11}, result.toByteArray()));
+ }
+
+ public void testExecuteOnePack200UnpackerPS() throws IOException {
+ ProcessingStep[] steps = new ProcessingStep[] {new Pack200Unpacker()};
+ ByteArrayOutputStream result = new ByteArrayOutputStream(100000);
+ OutputStream testStream = handler.link(steps, result, monitor);
+ InputStream inputStream = TestActivator.getContext().getBundle().getEntry("testData/jarprocessor.jar.pack.gz").openStream();
+ FileUtils.copyStream(inputStream, true, testStream, true);
+ assertEquals(35062, result.size());
+ }
+
+ public void testCreateByteShifterPS() {
+ ProcessingStepDescriptor descriptor = new ProcessingStepDescriptor("org.eclipse.equinox.prov.processing.ByteShifter", "1", true);
+ ProcessingStep step = handler.create(descriptor, null);
+ assertNotNull(step);
+ assertEquals(ByteShifter.class, step.getClass());
+ }
+
+ public void testCreateMD5VerifierPS() {
+ ProcessingStepDescriptor descriptor = new ProcessingStepDescriptor("org.eclipse.equinox.prov.processing.MD5Verifier", "1", true);
+ ProcessingStep step = handler.create(descriptor, null);
+ assertNotNull(step);
+ assertEquals(MD5Verifier.class, step.getClass());
+ }
+
+ public void testCreateAdderPS() {
+ ProcessingStepDescriptor descriptor = new ProcessingStepDescriptor("org.eclipse.equinox.prov.processing.Adder", "1", true);
+ ProcessingStep step = handler.create(descriptor, null);
+ assertNotNull(step);
+ assertEquals(Adder.class, step.getClass());
+ }
+
+ public void testCreateMultiplierPS() {
+ ProcessingStepDescriptor descriptor = new ProcessingStepDescriptor("org.eclipse.equinox.prov.processing.Multiplier", "2", true);
+ ProcessingStep step = handler.create(descriptor, null);
+ assertNotNull(step);
+ assertEquals(Multiplier.class, step.getClass());
+ }
+
+ public void testCreatePack200UnpackerPS() {
+ ProcessingStepDescriptor descriptor = new ProcessingStepDescriptor("org.eclipse.equinox.prov.processing.Pack200Unpacker", null, true);
+ ProcessingStep step = handler.create(descriptor, null);
+ assertNotNull(step);
+ assertEquals(Pack200Unpacker.class, step.getClass());
+ }
+
+ public void testCreatePSsAndAssureOrderingOfPSs1() throws IOException {
+ ProcessingStepDescriptor descriptor = new ProcessingStepDescriptor("org.eclipse.equinox.prov.processing.Adder", "1", true);
+ ProcessingStep adder = handler.create(descriptor, null);
+
+ descriptor = new ProcessingStepDescriptor("org.eclipse.equinox.prov.processing.Multiplier", "2", true);
+ ProcessingStep multiplier = handler.create(descriptor, null);
+
+ ProcessingStep[] steps = new ProcessingStep[] {adder, multiplier};
+ ByteArrayOutputStream result = new ByteArrayOutputStream(10);
+ OutputStream testStream = handler.link(steps, result, monitor);
+ testStream.write(new byte[] {1, 2, 3, 4, 5});
+ testStream.close();
+ assertTrue(Arrays.equals(new byte[] {4, 6, 8, 10, 12}, result.toByteArray()));
+ }
+
+ public void testCreatePSsAndAssureOrderingOfPSs2() throws IOException {
+ ProcessingStepDescriptor descriptor = new ProcessingStepDescriptor("org.eclipse.equinox.prov.processing.Adder", "1", true);
+ ProcessingStep adder = handler.create(descriptor, null);
+
+ descriptor = new ProcessingStepDescriptor("org.eclipse.equinox.prov.processing.Multiplier", "2", true);
+ ProcessingStep multiplier = handler.create(descriptor, null);
+
+ ProcessingStep[] steps = new ProcessingStep[] {multiplier, adder};
+ ByteArrayOutputStream result = new ByteArrayOutputStream(10);
+ OutputStream testStream = handler.link(steps, result, monitor);
+ testStream.write(new byte[] {1, 2, 3, 4, 5});
+ testStream.close();
+ assertTrue(Arrays.equals(new byte[] {3, 5, 7, 9, 11}, result.toByteArray()));
+ }
+
+ public void testLinkPSs() throws IOException {
+ ProcessingStepDescriptor descriptor1 = new ProcessingStepDescriptor("org.eclipse.equinox.prov.processing.Adder", "1", true);
+ ProcessingStepDescriptor descriptor2 = new ProcessingStepDescriptor("org.eclipse.equinox.prov.processing.Multiplier", "2", true);
+ ProcessingStepDescriptor[] descriptors = new ProcessingStepDescriptor[] {descriptor1, descriptor2};
+ ByteArrayOutputStream result = new ByteArrayOutputStream(10);
+ OutputStream testStream = handler.createAndLink(descriptors, null, result, monitor);
+ testStream.write(new byte[] {1, 2, 3, 4, 5});
+ testStream.close();
+ assertTrue(Arrays.equals(new byte[] {4, 6, 8, 10, 12}, result.toByteArray()));
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/AllTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/AllTests.java
new file mode 100644
index 000000000..1d1645b90
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/AllTests.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.tests.director;
+
+import junit.framework.*;
+
+/**
+ * Performs all automated director tests.
+ */
+public class AllTests extends TestCase {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(AllTests.class.getName());
+ suite.addTestSuite(AutomatedDirectorTest.class);
+ suite.addTestSuite(Bug203637.class);
+ suite.addTestSuite(OperationGenerationTest.class);
+ suite.addTestSuite(OracleTest.class);
+ suite.addTestSuite(OracleTest2.class);
+ suite.addTestSuite(PickerTest.class);
+ suite.addTestSuite(RollbackTest.class);
+ suite.addTestSuite(SingletonTest.class);
+ suite.addTestSuite(UninstallTest.class);
+ suite.addTestSuite(UpdateTestWithoutEntryPoint.class);
+ suite.addTestSuite(UpdateTestWithEntryPoint.class);
+ return suite;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/AutomatedDirectorTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/AutomatedDirectorTest.java
new file mode 100644
index 000000000..29be504c9
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/AutomatedDirectorTest.java
@@ -0,0 +1,256 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.tests.director;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.equinox.prov.core.helpers.LogHelper;
+import org.eclipse.equinox.prov.director.IDirector;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.*;
+import org.eclipse.equinox.prov.tests.AbstractProvisioningTest;
+import org.osgi.framework.Version;
+
+/**
+ * Various automated tests of the {@link IDirector} API.
+ */
+public class AutomatedDirectorTest extends AbstractProvisioningTest {
+ private static Version version = new Version(1, 0, 0);
+
+ public static Test suite() {
+ return new TestSuite(AutomatedDirectorTest.class);
+ }
+
+ public AutomatedDirectorTest() {
+ super("");
+ }
+
+ public AutomatedDirectorTest(String name) {
+ super(name);
+ }
+
+ /**
+ * Tests installing an IU that has a filtered dependency on another IU. When
+ * the filter is satisfied, the dependency is active and the required IU should
+ * be installed. When the filter is not satisfied, the dependency is inactive
+ * and the second IU should not be installed.
+ */
+ public void testInstallFilteredCapability() {
+ //The IU that is required
+ InstallableUnit requiredIU = new InstallableUnit();
+ requiredIU.setId("required." + getName());
+ requiredIU.setVersion(version);
+
+ InstallableUnit toInstallIU = new InstallableUnit();
+ toInstallIU.setId("toInstall." + getName());
+ toInstallIU.setVersion(version);
+ String filter = createFilter("FilterKey", "true");
+ RequiredCapability capability = new RequiredCapability(IInstallableUnit.IU_NAMESPACE, requiredIU.getId(), ANY_VERSION, filter, false, false);
+ toInstallIU.setRequiredCapabilities(new RequiredCapability[] {capability});
+
+ IInstallableUnit[] allUnits = new IInstallableUnit[] {requiredIU, toInstallIU};
+ IInstallableUnit[] toInstallArray = new IInstallableUnit[] {toInstallIU};
+ createTestMetdataRepository(allUnits);
+ IDirector director = createDirector();
+
+ //Install into a profile in which the filter is satisfied
+ Profile satisfied = new Profile("Satisfied." + getName());
+ satisfied.setValue(Profile.PROP_ENVIRONMENTS, "FilterKey=true");
+ IStatus result = director.install(toInstallArray, satisfied, null, null);
+ assertTrue("1.0", result.isOK());
+ assertProfileContains("1.1", satisfied, allUnits);
+
+ //Install into a profile in which the filter is not satisfied
+
+ //Install into a profile in which the filter key is undefined
+
+ }
+
+ /**
+ * Tests installing an IU that has an optional prerequisite that is available.
+ */
+ public void testInstallOptionalAvailable() {
+ String capabilityId = "test." + getName();
+ //The IU that exports the capability
+ InstallableUnit requiredIU = new InstallableUnit();
+ requiredIU.setId("required." + getName());
+ requiredIU.setVersion(version);
+ requiredIU.setCapabilities(new ProvidedCapability[] {new ProvidedCapability("test.capability", capabilityId, version)});
+
+ //The IU that optionally requires the capability
+ InstallableUnit toInstallIU = new InstallableUnit();
+ toInstallIU.setId("toInstall." + getName());
+ toInstallIU.setVersion(version);
+ RequiredCapability required = new RequiredCapability("test.capability", capabilityId, ANY_VERSION, null, true, false);
+ toInstallIU.setRequiredCapabilities(new RequiredCapability[] {required});
+
+ IInstallableUnit[] allUnits = new IInstallableUnit[] {toInstallIU, requiredIU};
+ IInstallableUnit[] toInstallArray = new IInstallableUnit[] {toInstallIU};
+ createTestMetdataRepository(allUnits);
+
+ Profile profile = new Profile("TestProfile." + getName());
+ IDirector director = createDirector();
+ IStatus result = director.install(toInstallArray, profile, null, null);
+ if (!result.isOK())
+ LogHelper.log(result);
+ assertTrue("1.0", result.isOK());
+ assertProfileContains("1.1", profile, allUnits);
+ }
+
+ /**
+ * Tests installing an IU that has an optional prerequisite that is not available.
+ */
+ public void testInstallOptionalUnavailable() {
+ String capabilityId = "test." + getName();
+ InstallableUnit toInstallIU = new InstallableUnit();
+ toInstallIU.setId("toInstall." + getName());
+ toInstallIU.setVersion(version);
+ //no IU will be available that exports this capability
+ RequiredCapability required = new RequiredCapability("test.capability", capabilityId, ANY_VERSION, null, true, false);
+ toInstallIU.setRequiredCapabilities(new RequiredCapability[] {required});
+
+ IInstallableUnit[] allUnits = new IInstallableUnit[] {toInstallIU};
+ createTestMetdataRepository(allUnits);
+
+ Profile profile = new Profile("TestProfile." + getName());
+ IDirector director = createDirector();
+ IStatus result = director.install(allUnits, profile, null, null);
+ if (!result.isOK())
+ LogHelper.log(result);
+ assertTrue("1.0", result.isOK());
+ assertProfileContains("1.1", profile, allUnits);
+ }
+
+ /**
+ * Tests installing an IU that has a required capability, and the IU providing
+ * the capability has a platform filter that is not satisfied.
+ */
+ public void testInstallPlatformFilter() {
+ //The IU that exports the capability
+ String capabilityId = "test." + getName();
+ InstallableUnit requiredIU = new InstallableUnit();
+ requiredIU.setId("required." + getName());
+ requiredIU.setVersion(version);
+ requiredIU.setCapabilities(new ProvidedCapability[] {new ProvidedCapability("test.capability", capabilityId, version)});
+ requiredIU.setFilter(createFilter("osgi.os", "blort"));
+
+ InstallableUnit toInstallIU = new InstallableUnit();
+ toInstallIU.setId("toInstall." + getName());
+ toInstallIU.setVersion(version);
+ toInstallIU.setRequiredCapabilities(createRequiredCapabilities("test.capability", capabilityId, ANY_VERSION, null));
+
+ IInstallableUnit[] allUnits = new IInstallableUnit[] {requiredIU, toInstallIU};
+ IInstallableUnit[] toInstallArray = new IInstallableUnit[] {toInstallIU};
+ createTestMetdataRepository(allUnits);
+
+ Profile profile = new Profile("TestProfile." + getName());
+ IDirector director = createDirector();
+ IStatus result = director.install(toInstallArray, profile, null, null);
+ assertTrue("1.0", !result.isOK());
+
+ //try again with the filter satisfied
+ profile.setValue(Profile.PROP_ENVIRONMENTS, "osgi.os=blort");
+ result = director.install(toInstallArray, profile, null, null);
+ assertTrue("2.0", result.isOK());
+ }
+
+ /**
+ * Simple test of installing an IU that has a required capability, and ensuring
+ * that the IU providing the capability is installed.
+ */
+ public void testSimpleInstallRequired() {
+ String capabilityId = "test." + getName();
+ //The IU that exports the capability
+ InstallableUnit requiredIU = new InstallableUnit();
+ requiredIU.setId("required." + getName());
+ requiredIU.setVersion(version);
+ requiredIU.setCapabilities(new ProvidedCapability[] {new ProvidedCapability("test.capability", capabilityId, version)});
+
+ InstallableUnit toInstallIU = new InstallableUnit();
+ toInstallIU.setId("toInstall." + getName());
+ toInstallIU.setVersion(version);
+ toInstallIU.setRequiredCapabilities(createRequiredCapabilities("test.capability", capabilityId, ANY_VERSION, null));
+
+ IInstallableUnit[] allUnits = new IInstallableUnit[] {requiredIU, toInstallIU};
+ IInstallableUnit[] toInstallArray = new IInstallableUnit[] {toInstallIU};
+ createTestMetdataRepository(allUnits);
+
+ Profile profile = new Profile("TestProfile." + getName());
+
+ IDirector director = createDirector();
+ IStatus result = director.install(toInstallArray, profile, null, null);
+ if (!result.isOK())
+ LogHelper.log(result);
+ assertTrue("1.0", result.isOK());
+ assertProfileContains("1.1", profile, allUnits);
+ }
+
+ /**
+ * Simple test of installing an IU that has a required capability, but without
+ * specifying a version range (any version will do).
+ */
+ public void testInstallRequiredNoVersion() {
+ //The IU that is needed
+ InstallableUnit requiredIU = new InstallableUnit();
+ requiredIU.setId("required." + getName());
+ requiredIU.setVersion(version);
+
+ InstallableUnit toInstallIU = new InstallableUnit();
+ toInstallIU.setId("toInstall." + getName());
+ toInstallIU.setVersion(version);
+ RequiredCapability capability = new RequiredCapability(IInstallableUnit.IU_NAMESPACE, requiredIU.getId(), null, null, false, false);
+ toInstallIU.setRequiredCapabilities(new RequiredCapability[] {capability});
+
+ IInstallableUnit[] allUnits = new IInstallableUnit[] {requiredIU, toInstallIU};
+ IInstallableUnit[] toInstallArray = new IInstallableUnit[] {toInstallIU};
+ createTestMetdataRepository(allUnits);
+
+ Profile profile = new Profile("TestProfile." + getName());
+
+ IDirector director = createDirector();
+ IStatus result = director.install(toInstallArray, profile, null, null);
+ if (!result.isOK())
+ LogHelper.log(result);
+ assertTrue("1.0", result.isOK());
+ assertProfileContains("1.1", profile, allUnits);
+ }
+
+ /**
+ * Simple test of installing an IU that has a required IU, and ensuring
+ * that the required IU is installed. In other words, the IU to install has a required
+ * capability on the IU namespace.
+ */
+ public void testSimpleInstallRequiredIU() {
+ //The IU that exports the capability
+ InstallableUnit requiredIU = new InstallableUnit();
+ requiredIU.setId("required." + getName());
+ requiredIU.setVersion(version);
+
+ InstallableUnit toInstallIU = new InstallableUnit();
+ toInstallIU.setId("toInstall." + getName());
+ toInstallIU.setVersion(version);
+ RequiredCapability capability = new RequiredCapability(IInstallableUnit.IU_NAMESPACE, requiredIU.getId(), ANY_VERSION, null, false, false);
+ toInstallIU.setRequiredCapabilities(new RequiredCapability[] {capability});
+
+ IInstallableUnit[] allUnits = new IInstallableUnit[] {requiredIU, toInstallIU};
+ IInstallableUnit[] toInstallArray = new IInstallableUnit[] {toInstallIU};
+ createTestMetdataRepository(allUnits);
+
+ Profile profile = new Profile("TestProfile." + getName());
+
+ IDirector director = createDirector();
+ IStatus result = director.install(toInstallArray, profile, null, null);
+ if (!result.isOK())
+ LogHelper.log(result);
+ assertTrue("1.0", result.isOK());
+ assertProfileContains("1.1", profile, allUnits);
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/Bug203637.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/Bug203637.java
new file mode 100644
index 000000000..eea4af549
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/Bug203637.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.tests.director;
+
+import org.eclipse.equinox.prov.director.IDirector;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.metadata.InstallableUnit;
+import org.eclipse.equinox.prov.tests.AbstractProvisioningTest;
+import org.osgi.framework.Version;
+
+public class Bug203637 extends AbstractProvisioningTest {
+ public void test() {
+ IDirector d = createDirector();
+ Profile profile = new Profile("TestProfile." + getName());
+ InstallableUnit a1 = new InstallableUnit();
+ a1.setId("A");
+ a1.setVersion(new Version(1, 0, 0));
+ a1.setSingleton(true);
+
+ assertOK(d.replace(new IInstallableUnit[0], new IInstallableUnit[] {a1}, profile, null));
+
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/OperationGenerationTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/OperationGenerationTest.java
new file mode 100644
index 000000000..560c60688
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/OperationGenerationTest.java
@@ -0,0 +1,196 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.tests.director;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import junit.framework.TestCase;
+import org.eclipse.equinox.internal.prov.director.OperationGenerator;
+import org.eclipse.equinox.prov.metadata.IInstallableUnitConstants;
+import org.eclipse.equinox.prov.metadata.InstallableUnit;
+import org.eclipse.equinox.prov.resolution.ResolutionHelper;
+import org.osgi.framework.Version;
+
+public class OperationGenerationTest extends TestCase {
+ public void testInstallUninstall() {
+ InstallableUnit a1 = new InstallableUnit();
+ a1.setId("a");
+ a1.setVersion(new Version(1, 0, 0));
+
+ InstallableUnit a2 = new InstallableUnit();
+ a2.setId("a");
+ a2.setVersion(new Version(2, 0, 0));
+
+ InstallableUnit a3 = new InstallableUnit();
+ a3.setId("a");
+ a3.setVersion(new Version(3, 0, 0));
+
+ Collection from;
+ from = new ArrayList();
+ from.add(a1);
+ from.add(a2);
+
+ Collection to;
+ to = new ArrayList();
+ to.add(a1);
+ to.add(a3);
+
+ from = new ResolutionHelper(null, null).attachCUs(from);
+ to = new ResolutionHelper(null, null).attachCUs(to);
+ new OperationGenerator().generateOperation(from, to);
+ }
+
+ public void test1() {
+ InstallableUnit a1 = new InstallableUnit();
+ a1.setId("a");
+ a1.setVersion(new Version(1, 0, 0));
+
+ InstallableUnit a2 = new InstallableUnit();
+ a2.setId("a");
+ a2.setVersion(new Version(2, 0, 0));
+
+ InstallableUnit a3 = new InstallableUnit();
+ a3.setId("a");
+ a3.setVersion(new Version(3, 0, 0));
+
+ Collection from;
+ from = new ArrayList();
+ from.add(a1);
+ from.add(a3);
+
+ Collection to;
+ to = new ArrayList();
+ to.add(a1);
+ to.add(a3);
+ to.add(a2);
+
+ from = new ResolutionHelper(null, null).attachCUs(from);
+ to = new ResolutionHelper(null, null).attachCUs(to);
+ new OperationGenerator().generateOperation(from, to);
+ }
+
+ public void test2() {
+ InstallableUnit a1 = new InstallableUnit();
+ a1.setId("a");
+ a1.setVersion(new Version(1, 0, 0));
+
+ InstallableUnit a2 = new InstallableUnit();
+ a2.setId("a");
+ a2.setVersion(new Version(2, 0, 0));
+
+ InstallableUnit a3 = new InstallableUnit();
+ a3.setId("a");
+ a3.setVersion(new Version(3, 0, 0));
+
+ Collection from;
+ from = new ArrayList();
+ from.add(a1);
+ from.add(a2);
+ from.add(a3);
+
+ Collection to;
+ to = new ArrayList();
+ to.add(a1);
+ to.add(a3);
+
+ from = new ResolutionHelper(null, null).attachCUs(from);
+ to = new ResolutionHelper(null, null).attachCUs(to);
+ new OperationGenerator().generateOperation(from, to);
+ }
+
+ public void testUpdate3() {
+ InstallableUnit a1 = new InstallableUnit();
+ a1.setId("a");
+ a1.setVersion(new Version(1, 0, 0));
+
+ InstallableUnit a2 = new InstallableUnit();
+ a2.setId("a");
+ a2.setVersion(new Version(2, 0, 0));
+
+ InstallableUnit b = new InstallableUnit();
+ b.setId("b");
+ b.setVersion(new Version(1, 0, 0));
+ b.setProperty(IInstallableUnitConstants.UPDATE_FROM, "a");
+ b.setProperty(IInstallableUnitConstants.UPDATE_RANGE, "[1.0.0, 2.0.0)");
+
+ InstallableUnit c = new InstallableUnit();
+ c.setId("c");
+ c.setVersion(new Version(1, 0, 0));
+ c.setProperty(IInstallableUnitConstants.UPDATE_FROM, "a");
+ c.setProperty(IInstallableUnitConstants.UPDATE_RANGE, "[2.0.0, 2.3.0)");
+
+ Collection from;
+ from = new ArrayList();
+ from.add(a1);
+ from.add(a2);
+
+ Collection to;
+ to = new ArrayList();
+ to.add(b);
+ to.add(c);
+
+ from = new ResolutionHelper(null, null).attachCUs(from);
+ to = new ResolutionHelper(null, null).attachCUs(to);
+ new OperationGenerator().generateOperation(from, to);
+ }
+
+ public void testUpdate2() {
+ InstallableUnit a1 = new InstallableUnit();
+ a1.setId("a");
+ a1.setVersion(new Version(1, 0, 0));
+
+ InstallableUnit a2 = new InstallableUnit();
+ a2.setId("a");
+ a2.setVersion(new Version(2, 0, 0));
+
+ InstallableUnit b = new InstallableUnit();
+ b.setId("b");
+ b.setVersion(new Version(1, 0, 0));
+ b.setProperty(IInstallableUnitConstants.UPDATE_FROM, "a");
+ b.setProperty(IInstallableUnitConstants.UPDATE_RANGE, "[1.0.0, 3.0.0)");
+
+ Collection from;
+ from = new ArrayList();
+ from.add(a1);
+ from.add(a2);
+
+ Collection to;
+ to = new ArrayList();
+ to.add(b);
+
+ from = new ResolutionHelper(null, null).attachCUs(from);
+ to = new ResolutionHelper(null, null).attachCUs(to);
+ new OperationGenerator().generateOperation(from, to);
+ }
+
+ public void testUpdate1() {
+ InstallableUnit a = new InstallableUnit();
+ a.setId("a");
+ a.setVersion(new Version(1, 0, 0));
+
+ InstallableUnit b = new InstallableUnit();
+ b.setId("b");
+ b.setVersion(new Version(1, 0, 0));
+ b.setProperty(IInstallableUnitConstants.UPDATE_FROM, "a");
+ b.setProperty(IInstallableUnitConstants.UPDATE_RANGE, "[1.0.0, 2.0.0)");
+
+ Collection from;
+ from = new ArrayList();
+ from.add(a);
+
+ Collection to;
+ to = new ArrayList();
+ to.add(b);
+
+ from = new ResolutionHelper(null, null).attachCUs(from);
+ to = new ResolutionHelper(null, null).attachCUs(to);
+ new OperationGenerator().generateOperation(from, to);
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/OracleTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/OracleTest.java
new file mode 100644
index 000000000..74e8e7ad9
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/OracleTest.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.tests.director;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.equinox.prov.director.IDirector;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.metadata.InstallableUnit;
+import org.eclipse.equinox.prov.tests.AbstractProvisioningTest;
+import org.eclipse.osgi.service.resolver.VersionRange;
+import org.osgi.framework.Version;
+
+public class OracleTest extends AbstractProvisioningTest {
+ InstallableUnit a1;
+ InstallableUnit a2;
+ InstallableUnit b1;
+ InstallableUnit c1;
+ InstallableUnit d1;
+ InstallableUnit d2;
+
+ IDirector director;
+ Profile profile;
+
+ protected void setUp() throws Exception {
+ a1 = new InstallableUnit();
+ a1.setId("A");
+ a1.setVersion(new Version(1, 0, 0));
+ a1.setSingleton(true);
+ a1.setRequiredCapabilities(createRequiredCapabilities(IInstallableUnit.IU_NAMESPACE, "C", new VersionRange("[1.0.0, 2.0.0)"), null));
+
+ c1 = new InstallableUnit();
+ c1.setId("C");
+ c1.setVersion(new Version(1, 0, 0));
+ c1.setSingleton(true);
+ c1.setRequiredCapabilities(createRequiredCapabilities(IInstallableUnit.IU_NAMESPACE, "D", new VersionRange("[1.0.0, 3.0.0)"), null));
+
+ d1 = new InstallableUnit();
+ d1.setId("D");
+ d1.setVersion(new Version(1, 0, 0));
+ d1.setSingleton(true);
+
+ b1 = new InstallableUnit();
+ b1.setId("B");
+ b1.setVersion(new Version(1, 0, 0));
+ b1.setSingleton(true);
+ b1.setRequiredCapabilities(createRequiredCapabilities(IInstallableUnit.IU_NAMESPACE, "D", new VersionRange("[2.0.0, 3.0.0)"), null));
+
+ d2 = new InstallableUnit();
+ d2.setId("D");
+ d2.setVersion(new Version(2, 0, 0));
+ d2.setSingleton(true);
+
+ createTestMetdataRepository(new IInstallableUnit[] {a1, c1, d1, b1});
+
+ profile = new Profile("TestProfile." + getName());
+ director = createDirector();
+
+ }
+
+ public void testInstallA1() {
+ assertEquals(director.install(new IInstallableUnit[] {a1}, profile, null, null).getSeverity(), IStatus.OK);
+
+ createTestMetdataRepository(new IInstallableUnit[] {d2});
+ // assertEquals(new Oracle().canInstall(new IInstallableUnit[] {b1}, profile, null), true);
+ assertEquals(director.install(new IInstallableUnit[] {b1}, profile, null, null).getSeverity(), IStatus.OK);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/OracleTest2.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/OracleTest2.java
new file mode 100644
index 000000000..896e5ebd6
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/OracleTest2.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.tests.director;
+
+import java.util.Collection;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.equinox.prov.director.IDirector;
+import org.eclipse.equinox.prov.director.Oracle;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.*;
+import org.eclipse.equinox.prov.tests.AbstractProvisioningTest;
+import org.eclipse.osgi.service.resolver.VersionRange;
+import org.osgi.framework.Version;
+
+public class OracleTest2 extends AbstractProvisioningTest {
+ private InstallableUnit a1;
+ private InstallableUnit a2;
+ private InstallableUnit b1;
+ private InstallableUnit c1;
+ private InstallableUnit c2;
+
+ IDirector director;
+ Profile profile;
+
+ protected void setUp() throws Exception {
+ a1 = new InstallableUnit();
+ a1.setId("A");
+ a1.setVersion(new Version(1, 0, 0));
+ a1.setSingleton(true);
+ a1.setRequiredCapabilities(createRequiredCapabilities(IInstallableUnit.IU_NAMESPACE, "C", new VersionRange("[1.0.0, 2.0.0)"), null));
+
+ c1 = new InstallableUnit();
+ c1.setId("C");
+ c1.setVersion(new Version(1, 0, 0));
+ c1.setSingleton(true);
+
+ a2 = new InstallableUnit();
+ a2.setId("A");
+ a2.setVersion(new Version(2, 0, 0));
+ a2.setSingleton(true);
+ a2.setProperty(IInstallableUnitConstants.UPDATE_FROM, "A");
+ a2.setProperty(IInstallableUnitConstants.UPDATE_RANGE, "[1.0.0, 2.3.0)");
+ a2.setRequiredCapabilities(createRequiredCapabilities(IInstallableUnit.IU_NAMESPACE, "C", new VersionRange("[2.0.0, 3.0.0)"), null));
+
+ b1 = new InstallableUnit();
+ b1.setId("B");
+ b1.setVersion(new Version(1, 0, 0));
+ b1.setSingleton(true);
+ b1.setRequiredCapabilities(createRequiredCapabilities(IInstallableUnit.IU_NAMESPACE, "C", new VersionRange("[2.0.0, 3.0.0)"), null));
+
+ c2 = new InstallableUnit();
+ c2.setId("C");
+ c2.setVersion(new Version(2, 0, 0));
+ c2.setSingleton(true);
+ c2.setProperty(IInstallableUnitConstants.UPDATE_FROM, "C");
+ c2.setProperty(IInstallableUnitConstants.UPDATE_RANGE, "[1.0.0, 2.3.0)");
+
+ createTestMetdataRepository(new IInstallableUnit[] {a1, c1});
+
+ profile = new Profile("TestProfile." + getName());
+ director = createDirector();
+
+ }
+
+ public void testInstallA1() {
+ assertEquals(director.install(new IInstallableUnit[] {a1}, profile, null, null).getSeverity(), IStatus.OK);
+
+ createTestMetdataRepository(new IInstallableUnit[] {a2, c2, b1});
+ Collection brokenEntryPoint = (Collection) new Oracle().canInstall(new IInstallableUnit[] {b1}, profile, null);
+ // assertNotNull(brokenEntryPoint.getProperty("entryPoint"));
+
+ new Oracle().hasUpdate(a1);
+ System.out.println(new Oracle().canInstall(new IInstallableUnit[] {b1}, (IInstallableUnit[]) brokenEntryPoint.toArray(new IInstallableUnit[brokenEntryPoint.size()]), profile, null));
+ }
+
+ public void testInstallA1bis() {
+ profile = new Profile("testInstallA1bis." + getName());
+ director = createDirector();
+ createTestMetdataRepository(new IInstallableUnit[] {a1, a2, c1, c2, b1});
+
+ assertEquals(director.install(new IInstallableUnit[] {a1}, profile, null, null).getSeverity(), IStatus.OK);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/PickerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/PickerTest.java
new file mode 100644
index 000000000..22452040c
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/PickerTest.java
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.tests.director;
+
+import junit.framework.TestCase;
+import org.eclipse.equinox.internal.prov.director.Picker;
+import org.eclipse.equinox.prov.metadata.*;
+import org.eclipse.osgi.service.resolver.VersionRange;
+import org.osgi.framework.Version;
+
+/**
+ * Testing of the {@link Picker} class.
+ */
+public class PickerTest extends TestCase {
+ InstallableUnit unitVersion5;
+ private Picker picker;
+
+ public PickerTest() {
+ super(""); //$NON-NLS-1$
+ }
+
+ public PickerTest(String name) {
+ super(name);
+ }
+
+ private RequiredCapability[] createRequiredCapabilities(String namespace, String name, VersionRange range, String filter) {
+ return new RequiredCapability[] {new RequiredCapability(namespace, name, range, filter, false, false)};
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ Version version = new Version(5, 0, 0);
+
+ //create some sample IUs to be available for the picker
+ unitVersion5 = new InstallableUnit();
+ unitVersion5.setId("required");
+ unitVersion5.setVersion(version);
+ unitVersion5.setCapabilities(new ProvidedCapability[] {new ProvidedCapability("test.capability", "test", version)});
+
+ InstallableUnit[] units = new InstallableUnit[] {unitVersion5};
+ picker = new Picker(units, null);
+
+ }
+
+ /**
+ * Tests picking an IU that requires a capability, and the available
+ * provided capability is above the required capability's version range.
+ */
+ public void testRequiredBelowVersionRange() {
+
+ //an IU whose required capability falls outside available range
+ RequiredCapability[] required = createRequiredCapabilities("test.capability", "test", new VersionRange("[2.0,5.0)"), null);
+
+ IInstallableUnit[][] result = picker.findInstallableUnit(null, null, required, false);
+ assertEquals("1.0", 0, result[0].length + result[1].length);
+ }
+
+ /**
+ * Tests picking an IU that requires a capability, and the available
+ * provided capability is above the required capability's version range.
+ */
+ public void testRequiredWithinVersionRange() {
+
+ //in middle of range
+ RequiredCapability[] required = createRequiredCapabilities("test.capability", "test", new VersionRange("[2.0,6.0)"), null);
+ IInstallableUnit[][] result = picker.findInstallableUnit(null, null, required, false);
+ assertEquals("1.0", 1, result.length);
+ assertEquals("1.1", unitVersion5, result[0]);
+
+ //on lower bound
+ required = createRequiredCapabilities("test.capability", "test", new VersionRange("[5.0,6.0)"), null);
+ result = picker.findInstallableUnit(null, null, required, false);
+ assertEquals("1.0", 1, result[0].length + result[1].length);
+ assertEquals("1.1", unitVersion5, result[1][0]);
+
+ //on upper bound
+ required = createRequiredCapabilities("test.capability", "test", new VersionRange("[1.0,5.0]"), null);
+ result = picker.findInstallableUnit(null, null, required, false);
+ assertEquals("1.0", 1, result[0].length + result[1].length);
+ assertEquals("1.1", unitVersion5, result[1][0]);
+ }
+
+ /**
+ * Tests picking an IU that requires a capability, and the available
+ * provided capability is above the required capability's version range.
+ */
+ public void testRequiredAboveVersionRange() {
+
+ //an IU whose required capability falls outside available range
+ RequiredCapability[] required = createRequiredCapabilities("test.capability", "test", new VersionRange("[5.1,6.0)"), null);
+
+ IInstallableUnit[][] result = picker.findInstallableUnit(null, null, required, false);
+ assertEquals("1.0", 0, result[0].length + result[1].length);
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/RollbackTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/RollbackTest.java
new file mode 100644
index 000000000..cb0400878
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/RollbackTest.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.tests.director;
+
+import java.net.URL;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.equinox.internal.prov.director.DirectorActivator;
+import org.eclipse.equinox.prov.core.helpers.ServiceHelper;
+import org.eclipse.equinox.prov.core.location.AgentLocation;
+import org.eclipse.equinox.prov.director.IDirector;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.metadata.InstallableUnit;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepository;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepositoryManager;
+import org.eclipse.equinox.prov.tests.AbstractProvisioningTest;
+import org.eclipse.equinox.prov.tests.TestActivator;
+import org.osgi.framework.Version;
+
+public class RollbackTest extends AbstractProvisioningTest {
+
+ private InstallableUnit a1;
+ private Profile profile;
+ private IDirector director;
+
+ protected void setUp() throws Exception {
+ a1 = new InstallableUnit();
+ a1.setId("A");
+ a1.setVersion(new Version(1, 0, 0));
+ a1.setSingleton(true);
+
+ profile = new Profile("TestProfile." + getName());
+ director = createDirector();
+ }
+
+ public void test() {
+ System.out.println(director.install(new IInstallableUnit[] {a1}, profile, null, new NullProgressMonitor()));
+ printProfile(profile);
+ IMetadataRepositoryManager repoMan = (IMetadataRepositoryManager) ServiceHelper.getService(TestActivator.getContext(), IMetadataRepositoryManager.class.getName());
+ IMetadataRepository repo = null;
+ URL location = ((AgentLocation) ServiceHelper.getService(DirectorActivator.context, AgentLocation.class.getName())).getTouchpointDataArea("director");
+ repo = repoMan.getRepository(location);
+ IInstallableUnit[] ius = repo.getInstallableUnits(null);
+ for (int i = 0; i < ius.length; i++)
+ System.out.println(ius[i]);
+ director.become(ius[0], profile, new NullProgressMonitor());
+ printProfile(profile);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/SingletonTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/SingletonTest.java
new file mode 100644
index 000000000..016ce7882
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/SingletonTest.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.tests.director;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.equinox.prov.director.IDirector;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.metadata.InstallableUnit;
+import org.eclipse.equinox.prov.tests.AbstractProvisioningTest;
+import org.osgi.framework.Version;
+
+public class SingletonTest extends AbstractProvisioningTest {
+ InstallableUnit f1;
+ InstallableUnit f1_1;
+
+ InstallableUnit f2;
+ InstallableUnit f2_1;
+
+ InstallableUnit junit38;
+ InstallableUnit junit40;
+
+ IDirector director;
+ Profile profile;
+
+ protected void setUp() throws Exception {
+ f1 = new InstallableUnit();
+ f1.setId("f1");
+ f1.setVersion(new Version(1, 0, 0));
+ f1.setSingleton(true);
+
+ f1_1 = new InstallableUnit();
+ f1_1.setId("f1");
+ f1_1.setVersion(new Version(1, 1, 0));
+ f1_1.setSingleton(true);
+
+ f2 = new InstallableUnit();
+ f2.setId("f2");
+ f2.setVersion(new Version(1, 0, 0));
+ f2.setSingleton(true);
+
+ f2_1 = new InstallableUnit();
+ f2_1.setId("f2");
+ f2_1.setVersion(new Version(1, 0, 1));
+
+ junit38 = new InstallableUnit();
+ junit38.setId("junit");
+ junit38.setVersion(new Version(3, 8, 1));
+
+ junit40 = new InstallableUnit();
+ junit40.setId("junit");
+ junit40.setVersion(new Version(4, 0, 1));
+
+ createTestMetdataRepository(new IInstallableUnit[] {f1, f1_1, junit38, junit40, f2, f2_1});
+
+ profile = new Profile("TestProfile." + getName());
+ director = createDirector();
+ }
+
+ public void testMultipleVersionNonSingleton() {
+ //The installation of junit38 and junit 40 together should succeed
+ assertEquals(director.install(new IInstallableUnit[] {junit38, junit40}, profile, null, new NullProgressMonitor()).getSeverity(), IStatus.OK);
+ }
+
+ public void testMultipleVersionSingleton() {
+ //The installation of junit38 and junit 40 together should succeed
+ assertEquals(director.install(new IInstallableUnit[] {f1, f1_1}, profile, null, new NullProgressMonitor()).getSeverity(), IStatus.ERROR);
+ }
+
+ public void testMultipleVersionSingleton2() {
+ //The installation of junit38 and junit 40 together should succeed
+ assertEquals(director.install(new IInstallableUnit[] {f2, f2_1}, profile, null, new NullProgressMonitor()).getSeverity(), IStatus.ERROR);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/UninstallTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/UninstallTest.java
new file mode 100644
index 000000000..43a70fc70
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/UninstallTest.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.tests.director;
+
+import org.eclipse.equinox.prov.director.IDirector;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.metadata.InstallableUnit;
+import org.eclipse.equinox.prov.tests.AbstractProvisioningTest;
+import org.osgi.framework.Version;
+
+public class UninstallTest extends AbstractProvisioningTest {
+ private InstallableUnit a1;
+ private Profile profile;
+ private IDirector director;
+
+ protected void setUp() throws Exception {
+ a1 = new InstallableUnit();
+ a1.setId("A");
+ a1.setVersion(new Version(1, 0, 0));
+ a1.setSingleton(true);
+
+ profile = new Profile("TestProfile." + getName());
+ director = createDirector();
+ }
+
+ public void testUninstall() {
+ System.out.println(director.install(new IInstallableUnit[] {a1}, profile, null, null));
+ director.uninstall(new IInstallableUnit[] {a1}, profile, null);
+ assertEmptyProfile(profile);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/UpdateTestWithEntryPoint.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/UpdateTestWithEntryPoint.java
new file mode 100644
index 000000000..b5a535bc8
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/UpdateTestWithEntryPoint.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.tests.director;
+
+import java.util.Collection;
+import java.util.Iterator;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.equinox.prov.director.IDirector;
+import org.eclipse.equinox.prov.director.Oracle;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.*;
+import org.eclipse.equinox.prov.tests.AbstractProvisioningTest;
+import org.osgi.framework.Version;
+
+public class UpdateTestWithEntryPoint extends AbstractProvisioningTest {
+ InstallableUnit f1;
+ InstallableUnit f1_1;
+
+ IDirector director;
+ Profile profile;
+
+ protected void setUp() throws Exception {
+ f1 = new InstallableUnit();
+ f1.setId("f1");
+ f1.setVersion(new Version(1, 0, 0));
+ f1.setSingleton(true);
+
+ f1_1 = new InstallableUnit();
+ f1_1.setId("f1");
+ f1_1.setVersion(new Version(1, 1, 0));
+ f1_1.setSingleton(true);
+ f1_1.setProperty(IInstallableUnitConstants.UPDATE_FROM, "f1");
+ f1_1.setProperty(IInstallableUnitConstants.UPDATE_RANGE, "[1.0.0, 2.0.0)");
+
+ profile = new Profile("TestProfile." + getName());
+ director = createDirector();
+ createTestMetdataRepository(new IInstallableUnit[] {f1_1, f1});
+ }
+
+ public void testInstall() {
+ String entryPointName = "e1";
+ assertEquals(director.install(new IInstallableUnit[] {f1}, profile, entryPointName, new NullProgressMonitor()).getSeverity(), IStatus.OK);
+ for (Iterator iterator = profile.getInstallableUnits(); iterator.hasNext();) {
+ System.out.println(iterator.next());
+
+ }
+
+ //TODO This should return an error because we are trying to update something that would cause the entry point to be unsatisfied
+ //director.update(new IInstallableUnit[] {f1_1}, profile, new NullProgressMonitor());
+
+ IInstallableUnit toReplace = get(entryPointName, profile);
+ Collection updates = new Oracle().hasUpdate(toReplace);
+
+ director.replace(new IInstallableUnit[] {toReplace}, (IInstallableUnit[]) updates.toArray(new IInstallableUnit[updates.size()]), profile, new NullProgressMonitor());
+
+ //TODO Add a test to verify that we are not going down in the version
+ //TODO Add a test to verify that we respect the ranges
+
+ }
+
+ private IInstallableUnit get(String id, Profile p) {
+ Iterator it = profile.getInstallableUnits();
+ while (it.hasNext()) {
+ IInstallableUnit o = (IInstallableUnit) it.next();
+ if (o.getId().equals(id))
+ return o;
+ }
+ return null;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/UpdateTestWithoutEntryPoint.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/UpdateTestWithoutEntryPoint.java
new file mode 100644
index 000000000..a67c5daeb
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/UpdateTestWithoutEntryPoint.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.tests.director;
+
+import java.util.Iterator;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.equinox.prov.director.IDirector;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.metadata.InstallableUnit;
+import org.eclipse.equinox.prov.tests.AbstractProvisioningTest;
+import org.eclipse.osgi.service.resolver.VersionRange;
+import org.osgi.framework.Version;
+
+public class UpdateTestWithoutEntryPoint extends AbstractProvisioningTest {
+ InstallableUnit f1;
+ InstallableUnit f1_1;
+ InstallableUnit f1_4;
+
+ InstallableUnit fa;
+ InstallableUnit fap;
+ IDirector director;
+ Profile profile;
+
+ protected void setUp() throws Exception {
+ f1 = new InstallableUnit();
+ f1.setId("f1");
+ f1.setVersion(new Version(1, 0, 0));
+ f1.setSingleton(true);
+
+ f1_1 = new InstallableUnit();
+ f1_1.setId("f1");
+ f1_1.setVersion(new Version(1, 1, 0));
+ f1_1.setSingleton(true);
+
+ f1_4 = new InstallableUnit();
+ f1_4.setId("f1");
+ f1_4.setVersion(new Version(1, 4, 0));
+ f1_4.setSingleton(true);
+
+ fa = new InstallableUnit();
+ fa.setId("fa");
+ fa.setVersion(new Version(1, 0, 0));
+ fa.setRequiredCapabilities(createRequiredCapabilities(IInstallableUnit.IU_NAMESPACE, "f1", new VersionRange("[1.0.0, 1.3.0)"), null));
+
+ fap = new InstallableUnit();
+ fap.setId("fa");
+ fap.setVersion(new Version(1, 1, 0));
+ fap.setRequiredCapabilities(createRequiredCapabilities(IInstallableUnit.IU_NAMESPACE, "f1", new VersionRange("[1.0.0, 1.4.0)"), null));
+
+ createTestMetdataRepository(new IInstallableUnit[] {f1, fa});
+
+ profile = new Profile("TestProfile." + getName());
+ director = createDirector();
+ director.install(new IInstallableUnit[] {fa}, profile, null, null);
+
+ createTestMetdataRepository(new IInstallableUnit[] {f1_1, f1_4});
+ }
+
+ public void testInstall() {
+ assertEquals(director.install(new IInstallableUnit[] {f1_1}, profile, null, new NullProgressMonitor()).getSeverity(), IStatus.OK);
+ for (Iterator iterator = profile.getInstallableUnits(); iterator.hasNext();) {
+ System.out.println(iterator.next());
+
+ }
+ assertEquals(director.install(new IInstallableUnit[] {f1_4}, profile, null, new NullProgressMonitor()).getSeverity(), IStatus.ERROR);
+
+ // director.replace(new IInstallableUnit[] {fap}, profile, new NullProgressMonitor());
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/download/AllTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/download/AllTests.java
new file mode 100644
index 000000000..77c6b26c4
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/download/AllTests.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.tests.download;
+
+import junit.framework.*;
+
+/**
+ * Performs all automated download manager tests.
+ */
+public class AllTests extends TestCase {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(AllTests.class.getName());
+ suite.addTestSuite(DownloadManagerTest.class);
+ return suite;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/download/DownloadManagerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/download/DownloadManagerTest.java
new file mode 100644
index 000000000..f6e579e84
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/download/DownloadManagerTest.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.tests.download;
+
+import junit.framework.*;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.equinox.prov.download.DownloadManager;
+
+/**
+ * Simple tests of {@link DownloadManager} API.
+ */
+public class DownloadManagerTest extends TestCase {
+ public static Test suite() {
+ return new TestSuite(DownloadManagerTest.class);
+ }
+
+ /**
+ * Tests invocation of DownloadManager when there is nothing to download.
+ */
+ public void testEmpty() {
+ DownloadManager manager = new DownloadManager();
+ IStatus result = manager.start(null);
+ assertTrue("1.0", result.isOK());
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/engine/AllTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/engine/AllTests.java
new file mode 100644
index 000000000..ffdbf9eb7
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/engine/AllTests.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.tests.engine;
+
+import junit.framework.*;
+
+/**
+ * Performs all engine tests.
+ */
+public class AllTests extends TestCase {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(AllTests.class.getName());
+ suite.addTestSuite(EngineTest.class);
+ suite.addTestSuite(PhaseSetTest.class);
+ suite.addTestSuite(PhaseTest.class);
+ suite.addTestSuite(ProfileTest.class);
+ return suite;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/engine/EngineTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/engine/EngineTest.java
new file mode 100644
index 000000000..4318a8064
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/engine/EngineTest.java
@@ -0,0 +1,235 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.tests.engine;
+
+import java.util.*;
+import junit.framework.TestCase;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.equinox.internal.prov.metadata.ArtifactKey;
+import org.eclipse.equinox.prov.engine.*;
+import org.eclipse.equinox.prov.metadata.*;
+import org.eclipse.equinox.prov.tests.TestActivator;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.Version;
+
+/**
+ * Simple test of the engine API.
+ *
+ * Note:
+ * Currently you MUST have previously generated metadata from a 3.3.0 install.
+ * There are ordering dependencies for the tests temporarily
+ */
+public class EngineTest extends TestCase {
+ private ServiceReference engineRef;
+ private Engine engine;
+
+ public EngineTest(String name) {
+ super(name);
+ }
+
+ public EngineTest() {
+ super("");
+ }
+
+ protected void setUp() throws Exception {
+ engineRef = TestActivator.getContext().getServiceReference(Engine.class.getName());
+ engine = (Engine) TestActivator.getContext().getService(engineRef);
+ }
+
+ protected void tearDown() throws Exception {
+ engine = null;
+ TestActivator.getContext().ungetService(engineRef);
+ }
+
+ public void testNullProfile() {
+
+ Profile profile = null;
+ PhaseSet phaseSet = new DefaultPhaseSet();
+ Operand[] operands = new Operand[] {};
+ try {
+ engine.perform(profile, phaseSet, operands, new NullProgressMonitor());
+ } catch (IllegalArgumentException expected) {
+ return;
+ }
+ fail();
+ }
+
+ public void testNullPhaseSet() {
+
+ Profile profile = new Profile("test");
+ PhaseSet phaseSet = null;
+ Operand[] operands = new Operand[] {};
+ try {
+ engine.perform(profile, phaseSet, operands, new NullProgressMonitor());
+ } catch (IllegalArgumentException expected) {
+ return;
+ }
+ fail();
+ }
+
+ public void testNullOperands() {
+
+ Profile profile = new Profile("test");
+ PhaseSet phaseSet = new DefaultPhaseSet();
+ Operand[] operands = null;
+ try {
+ engine.perform(profile, phaseSet, operands, new NullProgressMonitor());
+ } catch (IllegalArgumentException expected) {
+ return;
+ }
+ fail();
+ }
+
+ public void testEmptyOperands() {
+
+ Profile profile = new Profile("test");
+ PhaseSet phaseSet = new DefaultPhaseSet();
+ Operand[] operands = new Operand[] {};
+ IStatus result = engine.perform(profile, phaseSet, operands, new NullProgressMonitor());
+ assertTrue(result.isOK());
+ }
+
+ public void testEmptyPhaseSet() {
+
+ Profile profile = new Profile("test");
+ PhaseSet phaseSet = new PhaseSet(new Phase[] {}) {
+ // empty PhaseSet
+ };
+ Operand op = new Operand(new ResolvedInstallableUnit(new InstallableUnit()), null);
+ Operand[] operands = new Operand[] {op};
+ IStatus result = engine.perform(profile, phaseSet, operands, new NullProgressMonitor());
+ assertTrue(result.isOK());
+ }
+
+ public void testPerformSingleNullOperand() {
+
+ Profile profile = new Profile("test");
+ PhaseSet phaseSet = new DefaultPhaseSet();
+ Operand[] operands = new Operand[] {new Operand(null, null)};
+ IStatus result = engine.perform(profile, phaseSet, operands, new NullProgressMonitor());
+ assertTrue(result.isOK());
+ }
+
+ public void testPerformInstallOSGiFramework() {
+
+ Profile profile = new Profile("test");
+ profile.setValue(Profile.PROP_INSTALL_FOLDER, "c:/tmp/testProvisioning/");
+ for (Iterator it = profile.getInstallableUnits(); it.hasNext();) {
+ PhaseSet phaseSet = new DefaultPhaseSet();
+ InstallableUnit doomed = (InstallableUnit) it.next();
+ Operand[] operands = new Operand[] {new Operand(doomed.getResolved(), null)};
+ engine.perform(profile, phaseSet, operands, new NullProgressMonitor());
+ }
+ PhaseSet phaseSet = new DefaultPhaseSet();
+
+ Operand[] operands = new Operand[] {new Operand(null, createOSGiIU())};
+ IStatus result = engine.perform(profile, phaseSet, operands, new NullProgressMonitor());
+ assertTrue(result.isOK());
+ Iterator ius = profile.getInstallableUnits();
+ assertTrue(ius.hasNext());
+ }
+
+ public void testPerformUpdateOSGiFramework() {
+
+ Profile profile = new Profile("test");
+ profile.setValue(Profile.PROP_INSTALL_FOLDER, "c:/tmp/testProvisioning/");
+ PhaseSet phaseSet = new DefaultPhaseSet();
+ Operand[] operands = new Operand[] {new Operand(createOSGiIU(), createOSGiIU())};
+ IStatus result = engine.perform(profile, phaseSet, operands, new NullProgressMonitor());
+ assertTrue(result.isOK());
+ Iterator ius = profile.getInstallableUnits();
+ assertTrue(ius.hasNext());
+ }
+
+ public void testPerformUninstallOSGiFramework() {
+
+ Profile profile = new Profile("test");
+ profile.setValue(Profile.PROP_INSTALL_FOLDER, "c:/tmp/testProvisioning/");
+ PhaseSet phaseSet = new DefaultPhaseSet();
+ Operand[] operands = new Operand[] {new Operand(createOSGiIU(), null)};
+ IStatus result = engine.perform(profile, phaseSet, operands, new NullProgressMonitor());
+ assertTrue(result.isOK());
+ Iterator ius = profile.getInstallableUnits();
+ assertFalse(ius.hasNext());
+ }
+
+ public void testPerformRollback() {
+
+ Profile profile = new Profile("test");
+ profile.setValue(Profile.PROP_INSTALL_FOLDER, "c:/tmp/testProvisioning/");
+ PhaseSet phaseSet = new DefaultPhaseSet();
+
+ Operand[] operands = new Operand[] {new Operand(null, createOSGiIU()), new Operand(null, createBadIU())};
+ IStatus result = engine.perform(profile, phaseSet, operands, new NullProgressMonitor());
+ assertFalse(result.isOK());
+ Iterator ius = profile.getInstallableUnits();
+ assertFalse(ius.hasNext());
+ }
+
+ private IResolvedInstallableUnit createOSGiIU() {
+ InstallableUnit iu = new InstallableUnit();
+ iu.setId("org.eclipse.osgi");
+ iu.setVersion(new Version("3.3.0.v20070530"));
+ iu.setTouchpointType(new TouchpointType("eclipse", new Version("1.0.0")));
+ Map touchpointData = new HashMap();
+ String manifest = "Manifest-Version: 1.0\r\n" + "Bundle-Activator: org.eclipse.osgi.framework.internal.core.SystemBundl\r\n" + " eActivator\r\n" + "Bundle-RequiredExecutionEnvironment: J2SE-1.4,OSGi/Minimum-1.0\r\n" + "Export-Package: org.eclipse.osgi.event;version=\"1.0\",org.eclipse.osgi.\r\n" + " framework.console;version=\"1.0\",org.eclipse.osgi.framework.eventmgr;v\r\n" + " ersion=\"1.0\",org.eclipse.osgi.framework.log;version=\"1.0\",org.eclipse\r\n" + " .osgi.service.datalocation;version=\"1.0\",org.eclipse.osgi.service.deb\r\n" + " ug;version=\"1.0\",org.eclipse.osgi.service.environment;version=\"1.0\",o\r\n" + " rg.eclipse.osgi.service.localization;version=\"1.0\",org.eclipse.osgi.s\r\n" + " ervice.pluginconversion;version=\"1.0\",org.eclipse.osgi.service.resolv\r\n"
+ + " er;version=\"1.1\",org.eclipse.osgi.service.runnable;version=\"1.0\",org.\r\n" + " eclipse.osgi.service.urlconversion;version=\"1.0\",org.eclipse.osgi.sto\r\n" + " ragemanager;version=\"1.0\",org.eclipse.osgi.util;version=\"1.0\",org.osg\r\n" + " i.framework;version=\"1.3\",org.osgi.service.condpermadmin;version=\"1.0\r\n" + " \",org.osgi.service.packageadmin;version=\"1.2\",org.osgi.service.permis\r\n" + " sionadmin;version=\"1.2\",org.osgi.service.startlevel;version=\"1.0\",org\r\n" + " .osgi.service.url;version=\"1.0\",org.osgi.util.tracker;version=\"1.3.2\"\r\n" + " ,org.eclipse.core.runtime.adaptor;x-friends:=\"org.eclipse.core.runtim\r\n" + " e\",org.eclipse.core.runtime.internal.adaptor;x-internal:=true,org.ecl\r\n"
+ + " ipse.core.runtime.internal.stats;x-friends:=\"org.eclipse.core.runtime\r\n" + " \",org.eclipse.osgi.baseadaptor;x-internal:=true,org.eclipse.osgi.base\r\n" + " adaptor.bundlefile;x-internal:=true,org.eclipse.osgi.baseadaptor.hook\r\n" + " s;x-internal:=true,org.eclipse.osgi.baseadaptor.loader;x-internal:=tr\r\n" + " ue,org.eclipse.osgi.framework.adaptor;x-internal:=true,org.eclipse.os\r\n" + " gi.framework.debug;x-internal:=true,org.eclipse.osgi.framework.intern\r\n" + " al.core;x-internal:=true,org.eclipse.osgi.framework.internal.protocol\r\n" + " ;x-internal:=true,org.eclipse.osgi.framework.internal.protocol.bundle\r\n" + " entry;x-internal:=true,org.eclipse.osgi.framework.internal.protocol.b\r\n"
+ + " undleresource;x-internal:=true,org.eclipse.osgi.framework.internal.pr\r\n" + " otocol.reference;x-internal:=true,org.eclipse.osgi.framework.internal\r\n" + " .reliablefile;x-internal:=true,org.eclipse.osgi.framework.launcher;x-\r\n" + " internal:=true,org.eclipse.osgi.framework.util;x-internal:=true,org.e\r\n" + " clipse.osgi.internal.baseadaptor;x-internal:=true,org.eclipse.osgi.in\r\n" + " ternal.module;x-internal:=true,org.eclipse.osgi.internal.profile;x-in\r\n" + " ternal:=true,org.eclipse.osgi.internal.resolver;x-internal:=true,org.\r\n" + " eclipse.osgi.internal.verifier;x-internal:=true,org.eclipse.osgi.inte\r\n" + " rnal.provisional.verifier;x-friends:=\"org.eclipse.update.core,org.ecl\r\n" + " ipse.ui.workbench\"\r\n" + "Bundle-Version: 3.3.0.v20060925\r\n"
+ + "Eclipse-SystemBundle: true\r\n" + "Bundle-Copyright: %copyright\r\n" + "Bundle-Name: %systemBundle\r\n" + "Bundle-Description: %systemBundle\r\n" + "Bundle-DocUrl: http://www.eclipse.org\r\n" + "Bundle-ManifestVersion: 2\r\n" + "Export-Service: org.osgi.service.packageadmin.PackageAdmin,org.osgi.se\r\n" + " rvice.permissionadmin.PermissionAdmin,org.osgi.service.startlevel.Sta\r\n" + " rtLevel,org.eclipse.osgi.service.debug.DebugOptions\r\n" + "Bundle-Vendor: %eclipse.org\r\n" + "Main-Class: org.eclipse.core.runtime.adaptor.EclipseStarter\r\n" + "Bundle-SymbolicName: org.eclipse.osgi; singleton:=true\r\n" + "Bundle-Localization: systembundle\r\n" + "Eclipse-ExtensibleAPI: true\r\n" + "\r\n" + "";
+ touchpointData.put("manifest", manifest);
+ touchpointData.put("configurationData", "manipulator.getConfigData().addBundle(bundleToInstall);bundleToInstall.setMarkedAsStarted(true);");
+ touchpointData.put("unconfigurationData", "bundleToRemove.setMarkedAsStarted(false);manipulator.getConfigData().removeBundle(bundleToRemove);");
+
+ IResolvedInstallableUnit[] cus = new IResolvedInstallableUnit[1];
+ InstallableUnitFragment tmp = new InstallableUnitFragment();
+ tmp.setImmutableTouchpointData(new TouchpointData(touchpointData));
+ cus[0] = tmp.getResolved();
+
+ IArtifactKey key = new ArtifactKey("eclipse", "plugin", "org.eclipse.osgi", new Version("3.3.0.v20070530"));
+ iu.setArtifacts(new IArtifactKey[] {key});
+
+ ResolvedInstallableUnit result = (ResolvedInstallableUnit) iu.getResolved();
+ result.setFragments(cus);
+
+ return result;
+ }
+
+ private IResolvedInstallableUnit createBadIU() {
+ InstallableUnit iu = new InstallableUnit();
+ iu.setId("org.eclipse.osgi.bad");
+ iu.setVersion(new Version("3.3.0.v20070530"));
+ iu.setTouchpointType(new TouchpointType("eclipse", new Version("1.0.0")));
+ Map touchpointData = new HashMap();
+ String manifest = "Manifest-Version: 1.0\r\n" + "Bundle-Activator: org.eclipse.osgi.framework.internal.core.SystemBundl\r\n" + " eActivator\r\n" + "Bundle-RequiredExecutionEnvironment: J2SE-1.4,OSGi/Minimum-1.0\r\n" + "Export-Package: org.eclipse.osgi.event;version=\"1.0\",org.eclipse.osgi.\r\n" + " framework.console;version=\"1.0\",org.eclipse.osgi.framework.eventmgr;v\r\n" + " ersion=\"1.0\",org.eclipse.osgi.framework.log;version=\"1.0\",org.eclipse\r\n" + " .osgi.service.datalocation;version=\"1.0\",org.eclipse.osgi.service.deb\r\n" + " ug;version=\"1.0\",org.eclipse.osgi.service.environment;version=\"1.0\",o\r\n" + " rg.eclipse.osgi.service.localization;version=\"1.0\",org.eclipse.osgi.s\r\n" + " ervice.pluginconversion;version=\"1.0\",org.eclipse.osgi.service.resolv\r\n"
+ + " er;version=\"1.1\",org.eclipse.osgi.service.runnable;version=\"1.0\",org.\r\n" + " eclipse.osgi.service.urlconversion;version=\"1.0\",org.eclipse.osgi.sto\r\n" + " ragemanager;version=\"1.0\",org.eclipse.osgi.util;version=\"1.0\",org.osg\r\n" + " i.framework;version=\"1.3\",org.osgi.service.condpermadmin;version=\"1.0\r\n" + " \",org.osgi.service.packageadmin;version=\"1.2\",org.osgi.service.permis\r\n" + " sionadmin;version=\"1.2\",org.osgi.service.startlevel;version=\"1.0\",org\r\n" + " .osgi.service.url;version=\"1.0\",org.osgi.util.tracker;version=\"1.3.2\"\r\n" + " ,org.eclipse.core.runtime.adaptor;x-friends:=\"org.eclipse.core.runtim\r\n" + " e\",org.eclipse.core.runtime.internal.adaptor;x-internal:=true,org.ecl\r\n"
+ + " ipse.core.runtime.internal.stats;x-friends:=\"org.eclipse.core.runtime\r\n" + " \",org.eclipse.osgi.baseadaptor;x-internal:=true,org.eclipse.osgi.base\r\n" + " adaptor.bundlefile;x-internal:=true,org.eclipse.osgi.baseadaptor.hook\r\n" + " s;x-internal:=true,org.eclipse.osgi.baseadaptor.loader;x-internal:=tr\r\n" + " ue,org.eclipse.osgi.framework.adaptor;x-internal:=true,org.eclipse.os\r\n" + " gi.framework.debug;x-internal:=true,org.eclipse.osgi.framework.intern\r\n" + " al.core;x-internal:=true,org.eclipse.osgi.framework.internal.protocol\r\n" + " ;x-internal:=true,org.eclipse.osgi.framework.internal.protocol.bundle\r\n" + " entry;x-internal:=true,org.eclipse.osgi.framework.internal.protocol.b\r\n"
+ + " undleresource;x-internal:=true,org.eclipse.osgi.framework.internal.pr\r\n" + " otocol.reference;x-internal:=true,org.eclipse.osgi.framework.internal\r\n" + " .reliablefile;x-internal:=true,org.eclipse.osgi.framework.launcher;x-\r\n" + " internal:=true,org.eclipse.osgi.framework.util;x-internal:=true,org.e\r\n" + " clipse.osgi.internal.baseadaptor;x-internal:=true,org.eclipse.osgi.in\r\n" + " ternal.module;x-internal:=true,org.eclipse.osgi.internal.profile;x-in\r\n" + " ternal:=true,org.eclipse.osgi.internal.resolver;x-internal:=true,org.\r\n" + " eclipse.osgi.internal.verifier;x-internal:=true,org.eclipse.osgi.inte\r\n" + " rnal.provisional.verifier;x-friends:=\"org.eclipse.update.core,org.ecl\r\n" + " ipse.ui.workbench\"\r\n" + "Bundle-Version: 3.3.0.v20060925\r\n"
+ + "Eclipse-SystemBundle: true\r\n" + "Bundle-Copyright: %copyright\r\n" + "Bundle-Name: %systemBundle\r\n" + "Bundle-Description: %systemBundle\r\n" + "Bundle-DocUrl: http://www.eclipse.org\r\n" + "Bundle-ManifestVersion: 2\r\n" + "Export-Service: org.osgi.service.packageadmin.PackageAdmin,org.osgi.se\r\n" + " rvice.permissionadmin.PermissionAdmin,org.osgi.service.startlevel.Sta\r\n" + " rtLevel,org.eclipse.osgi.service.debug.DebugOptions\r\n" + "Bundle-Vendor: %eclipse.org\r\n" + "Main-Class: org.eclipse.core.runtime.adaptor.EclipseStarter\r\n" + "Bundle-SymbolicName: org.eclipse.osgi; singleton:=true\r\n" + "Bundle-Localization: systembundle\r\n" + "Eclipse-ExtensibleAPI: true\r\n" + "\r\n" + "";
+ touchpointData.put("manifest", manifest);
+ touchpointData.put("configurationData", "BAD");
+
+ IResolvedInstallableUnit[] cus = new IResolvedInstallableUnit[1];
+ InstallableUnitFragment tmp = new InstallableUnitFragment();
+ tmp.setImmutableTouchpointData(new TouchpointData(touchpointData));
+ cus[0] = tmp.getResolved();
+
+ IArtifactKey key = new ArtifactKey("eclipse", "plugin", "org.eclipse.osgi", new Version("3.3.0.v20070530"));
+ iu.setArtifacts(new IArtifactKey[] {key});
+
+ ResolvedInstallableUnit result = (ResolvedInstallableUnit) iu.getResolved();
+ result.setFragments(cus);
+
+ return result;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/engine/PhaseSetTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/engine/PhaseSetTest.java
new file mode 100644
index 000000000..c9ee4556b
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/engine/PhaseSetTest.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.tests.engine;
+
+import junit.framework.TestCase;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.equinox.prov.engine.*;
+import org.eclipse.equinox.prov.metadata.InstallableUnit;
+import org.eclipse.equinox.prov.metadata.ResolvedInstallableUnit;
+
+/**
+ * Simple test of the engine API.
+ */
+public class PhaseSetTest extends TestCase {
+ public PhaseSetTest(String name) {
+ super(name);
+ }
+
+ public PhaseSetTest() {
+ super("");
+ }
+
+ public void testNullPhases() {
+ try {
+ new PhaseSet(null) {
+ // empty PhaseSet
+ };
+ } catch (IllegalArgumentException exepcted) {
+ return;
+ }
+ fail();
+ }
+
+ public void testEmptyPhases() {
+ Profile profile = new Profile("test");
+ PhaseSet phaseSet = new PhaseSet(new Phase[] {}) {
+ // empty PhaseSet
+ };
+ Operand op = new Operand(new ResolvedInstallableUnit(new InstallableUnit()), null);
+ Operand[] operands = new Operand[] {op};
+
+ IStatus result = phaseSet.perform(new EngineSession(), profile, operands, new NullProgressMonitor());
+ assertTrue(result.isOK());
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/engine/PhaseTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/engine/PhaseTest.java
new file mode 100644
index 000000000..3c76faf39
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/engine/PhaseTest.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.tests.engine;
+
+import junit.framework.TestCase;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.equinox.prov.core.helpers.MultiStatus;
+import org.eclipse.equinox.prov.engine.*;
+
+/**
+ * Simple test of the engine API.
+ */
+public class PhaseTest extends TestCase {
+ public PhaseTest(String name) {
+ super(name);
+ }
+
+ public PhaseTest() {
+ super("");
+ }
+
+ public void testNullPhaseId() {
+ try {
+ new TestPhase(null, 1, "xyz");
+ } catch (IllegalArgumentException expected) {
+ return;
+ }
+ fail();
+ }
+
+ public void testEmptyPhaseId() {
+ try {
+ new TestPhase("", 1, "xyz");
+ } catch (IllegalArgumentException expected) {
+ return;
+ }
+ fail();
+ }
+
+ public void testNegativeWeight() {
+ try {
+ new TestPhase("xyz", -1, "xyz");
+ } catch (IllegalArgumentException expected) {
+ return;
+ }
+ fail();
+ }
+
+ public void testZeroWeight() {
+ try {
+ new TestPhase("xyz", 0, "xyz");
+ } catch (IllegalArgumentException expected) {
+ return;
+ }
+ fail();
+ }
+
+ public void testNullPhaseName() {
+ try {
+ new TestPhase("xyz", 1, null);
+ } catch (IllegalArgumentException expected) {
+ return;
+ }
+ fail();
+ }
+
+ public void testEmptyPhaseName() {
+ try {
+ new TestPhase("xyz", 1, "");
+ } catch (IllegalArgumentException expected) {
+ return;
+ }
+ fail();
+ }
+
+ public static class TestPhase extends Phase {
+
+ protected TestPhase(String phaseId, int weight, String phaseName) {
+ super(phaseId, weight, phaseName);
+ }
+
+ protected void perform(MultiStatus status, EngineSession session, Profile profile, Operand[] deltas, IProgressMonitor monitor) {
+ //empty
+ }
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/engine/ProfileTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/engine/ProfileTest.java
new file mode 100644
index 000000000..77be6d95c
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/engine/ProfileTest.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.tests.engine;
+
+import junit.framework.TestCase;
+import org.eclipse.equinox.prov.engine.Profile;
+
+/**
+ * Simple test of the engine API.
+ */
+public class ProfileTest extends TestCase {
+ public ProfileTest(String name) {
+ super(name);
+ }
+
+ public ProfileTest() {
+ super("");
+ }
+
+ public void testNullProfile() {
+ try {
+ new Profile(null);
+ } catch (IllegalArgumentException exepcted) {
+ return;
+ }
+ fail();
+ }
+
+ public void testEmptyProfile() {
+ try {
+ new Profile("");
+ } catch (IllegalArgumentException exepcted) {
+ return;
+ }
+ fail();
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/full/DirectorTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/full/DirectorTest.java
new file mode 100644
index 000000000..c6441182e
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/full/DirectorTest.java
@@ -0,0 +1,145 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.tests.full;
+
+import java.util.Collection;
+import java.util.Iterator;
+import junit.framework.TestCase;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.prov.core.helpers.*;
+import org.eclipse.equinox.prov.core.location.AgentLocation;
+import org.eclipse.equinox.prov.director.IDirector;
+import org.eclipse.equinox.prov.engine.IProfileRegistry;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.metadata.IResolvedInstallableUnit;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepository;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepositoryManager;
+import org.eclipse.equinox.prov.tests.TestActivator;
+import org.eclipse.osgi.service.environment.EnvironmentInfo;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * This test installs or uninstalls the IU defined by the property "eclipse.prov.autoInstall".
+ * Metadata for the IUs to install must be generated separately before running this test.
+ */
+public class DirectorTest extends TestCase {
+
+ public void testInstallIU() {
+ ServiceReference sr = TestActivator.context.getServiceReference(IDirector.class.getName());
+ if (sr == null) {
+ throw new RuntimeException("Director service not available");
+ }
+ IDirector director = (IDirector) TestActivator.context.getService(sr);
+ if (director == null) {
+ throw new RuntimeException("Director could not be loaded");
+ }
+
+ ServiceReference sr2 = TestActivator.context.getServiceReference(IMetadataRepositoryManager.class.getName());
+ IMetadataRepositoryManager mgr = (IMetadataRepositoryManager) TestActivator.context.getService(sr2);
+ if (mgr == null) {
+ throw new RuntimeException("Repository manager could not be loaded");
+ }
+
+ IMetadataRepository[] repos = mgr.getKnownRepositories();
+ TwoTierMap allIUs = new TwoTierMap();
+ for (int i = 0; i < repos.length; i++) {
+ IInstallableUnit[] ius = repos[i].getInstallableUnits(null);
+ for (int j = 0; j < ius.length; j++) {
+ allIUs.put(ius[j].getId(), ius[j].getVersion(), ius[j]);
+ }
+ }
+
+ String installFolder = System.getProperty(Profile.PROP_INSTALL_FOLDER);
+ ServiceReference profileRegSr = TestActivator.context.getServiceReference(IProfileRegistry.class.getName());
+ IProfileRegistry profileRegistry = (IProfileRegistry) TestActivator.context.getService(profileRegSr);
+ if (profileRegistry == null) {
+ throw new RuntimeException("Profile registry service not available");
+ }
+
+ String profileId = installFolder;
+ String newFlavor = System.getProperty("eclipse.prov.configurationFlavor");
+ boolean doUninstall = (Boolean.TRUE.equals(Boolean.valueOf(System.getProperty("eclipse.prov.doUninstall"))));
+
+ Profile p = profileRegistry.getProfile(profileId);
+ if (p == null) {
+ if (doUninstall) {
+ throw new RuntimeException("Uninstalling from a nonexistent profile");
+ }
+ p = new Profile(installFolder); //Typically a profile would receive a name.
+ p.setValue(Profile.PROP_INSTALL_FOLDER, installFolder);
+ p.setValue(Profile.PROP_FLAVOR, newFlavor);
+ // TODO: should we add the profile to the registry here? instead of after test?
+ } else {
+ String currentFlavor = p.getValue(Profile.PROP_FLAVOR);
+ if (currentFlavor != null && !currentFlavor.endsWith(newFlavor)) {
+ throw new RuntimeException("Install flavor not consistent with profile flavor");
+ } else if (currentFlavor == null) {
+ p.setValue(Profile.PROP_FLAVOR, newFlavor);
+ }
+ }
+
+ EnvironmentInfo info = (EnvironmentInfo) ServiceHelper.getService(TestActivator.getContext(), EnvironmentInfo.class.getName());
+ if (info != null)
+ p.setValue(Profile.PROP_ENVIRONMENTS, "osgi.os=" + info.getOS() + ",osgi.ws=" + info.getWS() + ",osgi.arch=" + info.getOSArch());
+
+ IInstallableUnit[] allRoots = new IInstallableUnit[1];
+ Collection allJobs = allIUs.getAll(System.getProperty("eclipse.prov.autoInstall"));
+ IStatus operationStatus = null;
+ if (allJobs.size() != 0) {
+ allRoots[0] = (IInstallableUnit) allJobs.iterator().next();
+ if (!doUninstall) {
+ operationStatus = director.install(allRoots, p, null, new NullProgressMonitor());
+ } else {
+ operationStatus = director.uninstall(allRoots, p, new NullProgressMonitor());
+ }
+ } else {
+ operationStatus = new Status(IStatus.INFO, "org.eclipse.equinox.prov.director.test", "The installable unit '" + System.getProperty("eclipse.prov.autoInstall") + "' has not been found");
+ }
+
+ if (operationStatus.isOK()) {
+ System.out.println((!doUninstall ? "installation" : "uninstallation") + " complete");
+ if (profileRegistry.getProfile(p.getProfileId()) == null) {
+ profileRegistry.addProfile(p);
+ } else {
+ // TODO: should delete the profile if it is 'empty'
+ // if (p.isEmpty()) {
+ // profileRegistry.removeProfile(p);
+ // }
+ }
+ } else {
+ System.out.println((!doUninstall ? "installation" : "uninstallation") + " failed. " + operationStatus);
+ LogHelper.log(operationStatus);
+ }
+ if (!operationStatus.isOK())
+ fail("The installation has failed");
+
+ IInstallableUnit[] result = p.query(allRoots[0].getId(), null, null, false, null);
+ assertEquals(result.length, (!doUninstall ? 1 : 0));
+ result = p.query("toolingdefault", null, null, false, null);
+
+ ensureFragmentAssociationIsNotPersisted(mgr);
+ }
+
+ private void ensureFragmentAssociationIsNotPersisted(IMetadataRepositoryManager mgr) {
+ //Test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=177661
+ AgentLocation location = (AgentLocation) ServiceHelper.getService(TestActivator.getContext(), AgentLocation.class.getName());
+ mgr.removeRepository(mgr.getRepository(location.getMetadataRepositoryURL()));
+ IMetadataRepository repo = null;
+ repo = mgr.loadRepository(location.getMetadataRepositoryURL(), null);
+ Iterator it = repo.getIterator("org.eclipse.equinox.simpleconfigurator", null, null, false);
+ if (!it.hasNext())
+ return;
+ IInstallableUnit sc = (IInstallableUnit) it.next();
+ if (sc instanceof IResolvedInstallableUnit)
+ fail("The repository should not store resolved installable units");
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/full/End2EndTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/full/End2EndTest.java
new file mode 100644
index 000000000..d3e23507d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/full/End2EndTest.java
@@ -0,0 +1,248 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.tests.full;
+
+import java.util.*;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.equinox.prov.core.helpers.ServiceHelper;
+import org.eclipse.equinox.prov.director.IDirector;
+import org.eclipse.equinox.prov.director.Oracle;
+import org.eclipse.equinox.prov.engine.IProfileRegistry;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.metadata.IInstallableUnitConstants;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepository;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepositoryManager;
+import org.eclipse.equinox.prov.tests.AbstractProvisioningTest;
+import org.eclipse.equinox.prov.tests.TestActivator;
+import org.eclipse.osgi.service.environment.EnvironmentInfo;
+import org.eclipse.osgi.service.resolver.VersionRange;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.Version;
+
+public class End2EndTest extends AbstractProvisioningTest {
+
+ private IMetadataRepository[] repos;
+ private IDirector director;
+
+ protected void setUp() throws Exception {
+ ServiceReference sr = TestActivator.context.getServiceReference(IDirector.class.getName());
+ if (sr == null) {
+ throw new RuntimeException("Director service not available");
+ }
+ director = createDirector();
+ ServiceReference sr2 = TestActivator.context.getServiceReference(IMetadataRepositoryManager.class.getName());
+ IMetadataRepositoryManager mgr = (IMetadataRepositoryManager) TestActivator.context.getService(sr2);
+ if (mgr == null) {
+ throw new RuntimeException("Repository manager could not be loaded");
+ }
+ repos = mgr.getKnownRepositories();
+ }
+
+ private Profile createProfile(String profileId) {
+ String installFolder = System.getProperty(Profile.PROP_INSTALL_FOLDER);
+ ServiceReference profileRegSr = TestActivator.context.getServiceReference(IProfileRegistry.class.getName());
+ IProfileRegistry profileRegistry = (IProfileRegistry) TestActivator.context.getService(profileRegSr);
+ if (profileRegistry == null) {
+ throw new RuntimeException("Profile registry service not available");
+ }
+
+ String newFlavor = System.getProperty("eclipse.prov.configurationFlavor");
+ boolean doUninstall = (Boolean.TRUE.equals(Boolean.valueOf(System.getProperty("eclipse.prov.doUninstall"))));
+
+ Profile profile1 = profileRegistry.getProfile(profileId);
+ if (profile1 == null) {
+ if (doUninstall) {
+ throw new RuntimeException("Uninstalling from a nonexistent profile");
+ }
+ profile1 = new Profile(profileId); //Typically a profile would receive a name.
+ profile1.setValue(Profile.PROP_INSTALL_FOLDER, installFolder + '/' + profileId);
+ profile1.setValue(Profile.PROP_FLAVOR, newFlavor);
+ // TODO: should we add the profile to the registry here? instead of after test?
+ } else {
+ String currentFlavor = profile1.getValue(Profile.PROP_FLAVOR);
+ if (currentFlavor != null && !currentFlavor.endsWith(newFlavor)) {
+ throw new RuntimeException("Install flavor not consistent with profile flavor");
+ } else if (currentFlavor == null) {
+ profile1.setValue(Profile.PROP_FLAVOR, newFlavor);
+ }
+ }
+
+ EnvironmentInfo info = (EnvironmentInfo) ServiceHelper.getService(TestActivator.getContext(), EnvironmentInfo.class.getName());
+ if (info != null)
+ profile1.setValue(Profile.PROP_ENVIRONMENTS, "osgi.os=" + info.getOS() + ",osgi.ws=" + info.getWS() + ",osgi.arch=" + info.getOSArch());
+
+ return profile1;
+ }
+
+ private Collection extractIUs(Profile p) {
+ Collection result = new HashSet();
+ Iterator it = p.getInstallableUnits();
+ while (it.hasNext()) {
+ result.add(it.next());
+ }
+ return result;
+ }
+
+ public void testInstallSDKWithEntryPoint() {
+ Profile profile1 = createProfile("profile1");
+ //First we install the sdk
+ IStatus s = director.install(new IInstallableUnit[] {getIU("sdk", new Version("3.3.0"))}, profile1, "entryPoint1", new NullProgressMonitor());
+ assertOK(s);
+ Collection iusInstalled = extractIUs(profile1);
+ IInstallableUnit firstSnapshot = getIU("profile1"); //This should represent the empty profile
+ assertNotNull(firstSnapshot);
+ assertNotNull(firstSnapshot.getProperty("profileIU"));
+ IInstallableUnit firstEntryPoint = null;
+ try {
+ firstEntryPoint = getIU(IInstallableUnitConstants.ENTRYPOINT_IU_KEY, "true")[0];
+ } catch (ArrayIndexOutOfBoundsException e) {
+ fail("We expect to find an entry point");
+ }
+
+ //The uninstallation should not work since there is an entyr point
+ s = director.uninstall(new IInstallableUnit[] {getIU("sdk", new Version("3.3.0"))}, profile1, new NullProgressMonitor());
+ assertNotOK(s);
+
+ //The uninstallation of the entry point should lead to an empty profile
+ s = director.uninstall(new IInstallableUnit[] {firstEntryPoint}, profile1, new NullProgressMonitor());
+ assertOK(s);
+
+ assertEmptyProfile(profile1);
+ IInstallableUnit[] snapshots = getIUs("profile1");
+ assertEquals(2, snapshots.length);
+ assertEquals(false, profile1.getIterator("sdk", VersionRange.emptyRange, null, false).hasNext());
+
+ // Now test the rollback to a previous state, in this case we reinstall the SDK
+ s = director.become(snapshots[0].equals(firstSnapshot) ? snapshots[1] : snapshots[0], profile1, new NullProgressMonitor());
+ if (!s.isOK())
+ fail("The become operation failed");
+
+ assertNotNull(getIU("sdk"));
+ assertEquals(firstEntryPoint, getIU(firstEntryPoint.getId()));
+ Collection afterRollback = extractIUs(profile1);
+
+ //Verify that the rollback brought back everything we had
+ Collection iusInstalledCopy = new HashSet(iusInstalled);
+ iusInstalled.removeAll(afterRollback);
+ afterRollback.removeAll(iusInstalledCopy);
+ assertEquals(0, iusInstalled.size());
+ assertEquals(0, afterRollback.size());
+
+ //Now update for the SDK itself
+ Collection snapshotsBeforeUpdate = Arrays.asList(getIUs("profile1"));
+ assertEquals(1, new Oracle().hasUpdate(getIU("sdk", new Version("3.3.0"))).size());
+ s = director.replace(new IInstallableUnit[] {firstEntryPoint}, new IInstallableUnit[] {(IInstallableUnit) new Oracle().hasUpdate(getIU("sdk", new Version("3.3.0"))).iterator().next()}, profile1, new NullProgressMonitor());
+ assertOK(s);
+ assertProfileContainsAll("", profile1, new IInstallableUnit[] {getIU("sdk", new Version("3.4.0"))});
+ Collection snapsshotsAfterUpdate = new ArrayList(Arrays.asList(getIUs("profile1")));
+ snapsshotsAfterUpdate.removeAll(snapshotsBeforeUpdate);
+ IInstallableUnit former = (IInstallableUnit) snapsshotsAfterUpdate.iterator().next();
+
+ //Now come back to a 3.3 install
+ s = director.become(former, profile1, new NullProgressMonitor());
+ assertOK(s);
+
+ //Test replace the sdk 3.3 entry point with 3.4
+ assertEquals(1, new Oracle().hasUpdate(firstEntryPoint).size());
+ s = director.replace(new IInstallableUnit[] {firstEntryPoint}, new IInstallableUnit[] {(IInstallableUnit) new Oracle().hasUpdate(firstEntryPoint).iterator().next()}, profile1, new NullProgressMonitor());
+ assertOK(s);
+ assertProfileContainsAll("", profile1, new IInstallableUnit[] {getIU("sdk", new Version("3.4.0"))});
+ assertNotIUs(new IInstallableUnit[] {getIU("sdk", new Version("3.3.0"))}, profile1.getInstallableUnits());
+
+ //Remove everything from the profile by becoming an empty profile
+ s = director.become(firstSnapshot, profile1, new NullProgressMonitor());
+ assertOK(s);
+ // assertEmptyProfile(profile1);
+ }
+
+ public void testInstallSDK() {
+ Profile profile2 = createProfile("profile2");
+ //First we install the sdk
+ IStatus s = director.install(new IInstallableUnit[] {getIU("sdk", new Version("3.3.0"))}, profile2, null, new NullProgressMonitor());
+ if (!s.isOK())
+ fail("Installation failed");
+ IInstallableUnit firstSnapshot = getIU("profile2"); //This should represent the empty profile
+ assertNotNull(firstSnapshot);
+ assertNotNull(firstSnapshot.getProperty("profileIU"));
+
+ //Uninstall the SDK
+ s = director.uninstall(new IInstallableUnit[] {getIU("sdk", new Version("3.3.0"))}, profile2, new NullProgressMonitor());
+ if (!s.isOK())
+ fail("The uninstallation has failed and it was not expected");
+
+ assertEquals(false, profile2.getInstallableUnits().hasNext()); //the profile should be empty since we uninstalled everything
+ IInstallableUnit[] snapshots = getIUs("profile2");
+ assertTrue("snap" + snapshots.length, snapshots.length >= 2);//TODO Normally here it should be 2!!!
+ assertEquals(false, profile2.getIterator("sdk", VersionRange.emptyRange, null, false).hasNext());
+
+ // Now test the rollback to a previous state, in this case we reinstall the SDK
+ s = director.become(snapshots[0].equals(firstSnapshot) ? snapshots[1] : snapshots[0], profile2, new NullProgressMonitor());
+ if (!s.isOK())
+ fail("The become operation failed");
+
+ assertNotNull(getIU("sdk"));
+
+ //Test replace
+ s = director.replace(new IInstallableUnit[] {getIU("sdk", new Version("3.3.0"))}, new IInstallableUnit[] {getIU("sdk", new Version("3.4.0"))}, profile2, new NullProgressMonitor());
+ assertOK(s);
+ assertProfileContainsAll("", profile2, new IInstallableUnit[] {getIU("sdk", new Version("3.4.0"))});
+ assertNotIUs(new IInstallableUnit[] {getIU("sdk", new Version("3.3.0"))}, profile2.getInstallableUnits());
+
+ //Remove everything from the profile by becoming an empty profile
+ s = director.become(firstSnapshot, profile2, new NullProgressMonitor());
+ assertOK(s);
+ // assertEmptyProfile(profile2);
+ }
+
+ public IInstallableUnit[] getIU(String property, String value) {
+ Collection result = new ArrayList();
+ for (int i = 0; i < repos.length; i++) {
+ IInstallableUnit[] ius = repos[i].getInstallableUnits(null);
+ for (int j = 0; j < ius.length; j++) {
+ String v = ius[j].getProperty(property);
+ if (v != null && v.equals(value))
+ result.add(ius[j]);
+ }
+ }
+ return (IInstallableUnit[]) result.toArray(new IInstallableUnit[result.size()]);
+ }
+
+ public IInstallableUnit[] getIUs(String id) {
+ Collection result = new ArrayList();
+ for (int i = 0; i < repos.length; i++) {
+ Iterator it = repos[i].getIterator(id, VersionRange.emptyRange, null, false);
+ while (it.hasNext()) {
+ result.add(it.next());
+ }
+ }
+ return (IInstallableUnit[]) result.toArray(new IInstallableUnit[result.size()]);
+ }
+
+ public IInstallableUnit getIU(String id) {
+ for (int i = 0; i < repos.length; i++) {
+ Iterator it = repos[i].getIterator(id, VersionRange.emptyRange, null, false);
+ while (it.hasNext()) {
+ return (IInstallableUnit) it.next();
+ }
+ }
+ return null;
+ }
+
+ public IInstallableUnit getIU(String id, Version v) {
+ for (int i = 0; i < repos.length; i++) {
+ Iterator it = repos[i].getIterator(id, new VersionRange("[" + v.toString() + "," + v.toString() + "]"), null, false);
+ while (it.hasNext()) {
+ return (IInstallableUnit) it.next();
+ }
+ }
+ return null;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/AllTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/AllTests.java
new file mode 100644
index 000000000..4a6c0b4b1
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/AllTests.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.tests.metadata;
+
+import junit.framework.*;
+
+/**
+ * Performs all metadata tests.
+ */
+public class AllTests extends TestCase {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(AllTests.class.getName());
+ suite.addTestSuite(FragmentMethodTest.class);
+ suite.addTestSuite(FragmentTest.class);
+ suite.addTestSuite(MultipleIUAndFragmentTest.class);
+ suite.addTestSuite(RecommendationTest.class);
+ suite.addTestSuite(ResolutionHelperTest.class);
+ return suite;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/FragmentMethodTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/FragmentMethodTest.java
new file mode 100644
index 000000000..4e8613c1a
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/FragmentMethodTest.java
@@ -0,0 +1,178 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.tests.metadata;
+
+import java.util.*;
+import junit.framework.AssertionFailedError;
+import junit.framework.TestCase;
+import org.eclipse.equinox.prov.metadata.*;
+import org.eclipse.equinox.prov.resolution.ResolutionHelper;
+import org.eclipse.osgi.service.resolver.VersionRange;
+import org.osgi.framework.Version;
+
+public class FragmentMethodTest extends TestCase {
+ private static final String PROP_FRAG = "propFrag";
+ private static final String PROP_IU = "propIU";
+ private static final String TEST_REQUIRED = "testRequired";
+ IInstallableUnit iu1;
+ IInstallableUnit iu3;
+ RequiredCapability[] iu1Deps;
+ RequiredCapability[] iu3Deps;
+ ProvidedCapability[] iu1Caps;
+ ProvidedCapability[] iu3Caps;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ iu1 = createIU("iu.test1");
+ iu3 = createIUFragment("iu.fragment");
+ iu1Caps = iu1.getProvidedCapabilities();
+ iu3Caps = iu3.getProvidedCapabilities();
+ iu1Deps = iu1.getRequiredCapabilities();
+ iu3Deps = iu3.getRequiredCapabilities();
+ HashSet hash = new HashSet();
+ hash.add(iu1);
+ hash.add(iu3);
+ Collection result = new ResolutionHelper(new Hashtable(), null).attachCUs(hash);
+ for (Iterator iterator = result.iterator(); iterator.hasNext();) {
+ IResolvedInstallableUnit iu = (IResolvedInstallableUnit) iterator.next();
+ if (iu.getId().equals(iu1.getId()))
+ iu1 = iu;
+ if (iu.getId().equals(iu3.getId()))
+ iu3 = iu;
+ }
+ }
+
+ protected void tearDown() throws Exception {
+ iu1 = null;
+ iu3 = null;
+ iu1Deps = null;
+ iu3Deps = null;
+ iu1Caps = null;
+ iu3Caps = null;
+ super.tearDown();
+ }
+
+ public void testCapabilities() {
+ ProvidedCapability[] iuCapabilities = iu1Caps;
+ ProvidedCapability[] initialFragmentCapabilities = iu3Caps;
+
+ ProvidedCapability[] mergedCapabilities = iu1.getProvidedCapabilities();
+ for (int i = 0; i < iuCapabilities.length; i++) {
+ FragmentTest.assertContainsWithEquals(mergedCapabilities, iuCapabilities[i]);
+ }
+
+ //The fragment capability is not listed in the capabilities
+ assertDoesNotContain(mergedCapabilities, InstallableUnitFragment.FRAGMENT_CAPABILITY);
+
+ //The fragment does not contain iu namespace
+ for (int i = 0; i < initialFragmentCapabilities.length; i++) {
+ if (initialFragmentCapabilities[i].getNamespace().equals(IInstallableUnit.IU_NAMESPACE)) {
+ assertDoesNotContain(mergedCapabilities, initialFragmentCapabilities[i]);
+ break;
+ }
+ }
+
+ assertEquals("The fragment capabilities should not change", initialFragmentCapabilities, iu3.getProvidedCapabilities(), false);
+ }
+
+ protected void assertEquals(String message, Object[] expected, Object[] actual) {
+ if (expected == null && actual == null)
+ return;
+ if (expected == null || actual == null)
+ fail(message);
+ if (expected.length != actual.length)
+ fail(message);
+ for (int i = 0; i < expected.length; i++)
+ assertEquals(message, expected[i], actual[i]);
+ }
+
+ protected void assertEquals(String message, Object[] expected, Object[] actual, boolean orderImportant) {
+ // if the order in the array must match exactly, then call the other method
+ if (orderImportant) {
+ assertEquals(message, expected, actual);
+ return;
+ }
+ // otherwise use this method and check that the arrays are equal in any order
+ if (expected == null && actual == null)
+ return;
+ if (expected == actual)
+ return;
+ if (expected == null || actual == null)
+ assertTrue(message + ".1", false);
+ if (expected.length != actual.length)
+ assertTrue(message + ".2", false);
+ boolean[] found = new boolean[expected.length];
+ for (int i = 0; i < expected.length; i++) {
+ for (int j = 0; j < expected.length; j++) {
+ if (!found[j] && expected[i].equals(actual[j]))
+ found[j] = true;
+ }
+ }
+ for (int i = 0; i < found.length; i++)
+ if (!found[i])
+ assertTrue(message + ".3." + i, false);
+ }
+
+ public static void assertDoesNotContain(Object[] objects, Object searched) {
+ for (int i = 0; i < objects.length; i++) {
+ if (objects[i].equals(searched))
+ throw new AssertionFailedError("The array should not contain the searched element");
+ }
+ }
+
+ public void testDependencies() {
+ RequiredCapability[] iuDependencies = iu1Deps;
+ RequiredCapability[] initialFragmentDependencies = iu3Deps;
+
+ RequiredCapability[] mergedDependencies = iu1.getRequiredCapabilities();
+ for (int i = 0; i < iuDependencies.length; i++) {
+ FragmentTest.assertContains(mergedDependencies, iuDependencies[i]);
+ }
+ for (int i = 0; i < initialFragmentDependencies.length; i++) {
+ FragmentTest.assertContains(mergedDependencies, initialFragmentDependencies[i]);
+ }
+ assertEquals("The fragment dependencies should not change", initialFragmentDependencies, iu3.getRequiredCapabilities(), false);
+ }
+
+ public void testProperties() {
+ assertNotNull("The property is missing", iu3.getProperty(PROP_FRAG));
+ assertNotNull("The property is missing", iu1.getProperty(PROP_IU));
+ assertNull("The property should not be available", iu1.getProperty("doesnotexist"));
+ }
+
+ public IInstallableUnit createIUFragment(String name) {
+ InstallableUnitFragment iu = new InstallableUnitFragment();
+ iu.setId(name);
+ iu.setVersion(new Version(1, 0, 0));
+ iu.setTouchpointType(new TouchpointType("eclipse", new Version(1, 0, 0)));
+ iu.setProperty(PROP_FRAG, "value");
+
+ RequiredCapability[] reqs = new RequiredCapability[] {new RequiredCapability("eclipse.touchpoint", "bundle", VersionRange.emptyRange, null, false, true), new RequiredCapability(TEST_REQUIRED, TEST_REQUIRED, VersionRange.emptyRange, null, true, false)};
+ iu.setRequiredCapabilities(reqs);
+
+ ProvidedCapability[] cap = new ProvidedCapability[] {new ProvidedCapability("testCapabilityInFragment", "testCapabilityInFragment", new Version(1, 0, 0))};
+ iu.setCapabilities(cap);
+
+ return iu;
+ }
+
+ public IInstallableUnit createIU(String name) {
+ InstallableUnit iu = new InstallableUnit();
+ iu.setId(name);
+ iu.setVersion(new Version(1, 0, 0));
+ iu.setTouchpointType(new TouchpointType("eclipse", new Version(1, 0, 0)));
+ iu.setProperty(PROP_IU, "valueIU");
+
+ ProvidedCapability[] cap = new ProvidedCapability[] {new ProvidedCapability("eclipse.touchpoint", "bundle", new Version(1, 0, 0)), new ProvidedCapability("testCapability", "testCapability", new Version(1, 0, 0))};
+ iu.setCapabilities(cap);
+ return iu;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/FragmentTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/FragmentTest.java
new file mode 100644
index 000000000..81696d911
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/FragmentTest.java
@@ -0,0 +1,147 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.tests.metadata;
+
+import java.util.*;
+import junit.framework.AssertionFailedError;
+import junit.framework.TestCase;
+import org.eclipse.equinox.prov.metadata.*;
+import org.eclipse.equinox.prov.resolution.ResolutionHelper;
+import org.eclipse.osgi.service.resolver.VersionRange;
+import org.osgi.framework.Version;
+
+public class FragmentTest extends TestCase {
+ public void testAssociation() {
+ IInstallableUnit iu1 = createIU("ui.test1");
+ IInstallableUnit iu2 = createIUFragment("iuFragment.test1");
+ ResolutionHelper rh = new ResolutionHelper(new Hashtable(), null);
+ HashSet set = new HashSet();
+ set.add(iu1);
+ set.add(iu2);
+ Collection result = rh.attachCUs(set);
+ for (Iterator iterator = result.iterator(); iterator.hasNext();) {
+ IResolvedInstallableUnit iu = (IResolvedInstallableUnit) iterator.next();
+ if (iu.getId().equals("iu1.test1")) {
+ assertEquals(iu.getFragments().length, 1);
+ assertEquals(iu.getFragments()[0].getId(), "iuFragment.test1");
+ }
+ }
+ }
+
+ public void testAssociation2() {
+ IInstallableUnit iu1 = createIU("ui.test1");
+ IInstallableUnit iu3 = createIU("ui.test3");
+ IInstallableUnit iu2 = createIUFragment("iuFragment.test1");
+ ResolutionHelper rh = new ResolutionHelper(new Hashtable(), null);
+ HashSet set = new HashSet();
+ set.add(iu1);
+ set.add(iu2);
+ set.add(iu3);
+ Collection result = rh.attachCUs(set);
+ for (Iterator iterator = result.iterator(); iterator.hasNext();) {
+ IResolvedInstallableUnit iu = (IResolvedInstallableUnit) iterator.next();
+ if (iu.getId().equals("iu1.test1")) {
+ assertEquals(iu.getFragments().length, 1);
+ assertEquals(iu.getFragments()[0].getId(), "iuFragment.test1");
+ }
+ if (iu.getId().equals("iu1.test3")) {
+ assertEquals(iu.getFragments().length, 1);
+ assertEquals(iu.getFragments()[0].getId(), "iuFragment.test1");
+ }
+ }
+ }
+
+ public void testTouchpointData() {
+ assertEquals(createIUWithTouchpointData().getTouchpointData().length, 1);
+ assertEquals(createIUFragmentWithTouchpointData().getTouchpointData().length, 1);
+ IInstallableUnit iu1 = createIUWithTouchpointData();
+ IInstallableUnit iu2 = createIUFragmentWithTouchpointData();
+ ResolutionHelper rh = new ResolutionHelper(new Hashtable(), null);
+ HashSet set = new HashSet();
+ set.add(iu1);
+ set.add(iu2);
+ Collection result = rh.attachCUs(set);
+ for (Iterator iterator = result.iterator(); iterator.hasNext();) {
+ IResolvedInstallableUnit iu = (IResolvedInstallableUnit) iterator.next();
+ if (iu.getId().equals(iu1.getId()))
+ assertEquals(iu.getTouchpointData().length, 2);
+
+ }
+ }
+
+ public void testFragmentCapability() {
+ IInstallableUnit iu = createIUFragment("iuFragment.test1");
+ ProvidedCapability[] all = iu.getProvidedCapabilities();
+ assertContains(all, InstallableUnitFragment.FRAGMENT_CAPABILITY);
+ }
+
+ public void testDefaultIUCapability() {
+ IInstallableUnit iu = createIU("ui.test1");
+ ProvidedCapability[] cap = iu.getProvidedCapabilities();
+ for (int i = 0; i < cap.length; i++) {
+ if (cap[i].getNamespace().equals(IInstallableUnit.IU_NAMESPACE)) {
+
+ assertEquals(cap[i].getNamespace(), IInstallableUnit.IU_NAMESPACE);
+ assertEquals(cap[i].getName(), iu.getId());
+ return;
+ }
+ }
+ throw new AssertionFailedError("No capability for the iu id");
+ }
+
+ public static void assertContains(Object[] objects, Object searched) {
+ for (int i = 0; i < objects.length; i++) {
+ if (objects[i] == searched)
+ return;
+ }
+ throw new AssertionFailedError("The array does not contain the searched element");
+ }
+
+ public static void assertContainsWithEquals(Object[] objects, Object searched) {
+ for (int i = 0; i < objects.length; i++) {
+ if (objects[i].equals(searched))
+ return;
+ }
+ throw new AssertionFailedError("The array does not contain the searched element");
+ }
+
+ public static InstallableUnit createIUFragment(String name) {
+ InstallableUnitFragment iu = new InstallableUnitFragment();
+ iu.setId(name);
+ iu.setVersion(new Version(1, 0, 0));
+ iu.setTouchpointType(new TouchpointType("eclipse", new Version(1, 0, 0)));
+ iu.setRequiredCapabilities(new RequiredCapability[] {new RequiredCapability("eclipse.touchpoint", "bundle", VersionRange.emptyRange, null, false, true)});
+ return iu;
+ }
+
+ public static InstallableUnit createIU(String name) {
+ InstallableUnit iu = new InstallableUnit();
+ iu.setId(name);
+ iu.setVersion(new Version(1, 0, 0));
+ iu.setTouchpointType(new TouchpointType("eclipse", new Version(1, 0, 0)));
+
+ ProvidedCapability[] cap = new ProvidedCapability[] {new ProvidedCapability("eclipse.touchpoint", "bundle", new Version(1, 0, 0))};
+ iu.setCapabilities(cap);
+ return iu;
+ }
+
+ private IInstallableUnit createIUWithTouchpointData() {
+ InstallableUnit unit = createIU("ui.test1");
+ unit.setImmutableTouchpointData(new TouchpointData(new HashMap()));
+ return unit;
+ }
+
+ private IInstallableUnit createIUFragmentWithTouchpointData() {
+ InstallableUnit unit = createIUFragment("iuFragment.test1");
+ unit.setImmutableTouchpointData(new TouchpointData(new HashMap()));
+ return unit;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/MultipleIUAndFragmentTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/MultipleIUAndFragmentTest.java
new file mode 100644
index 000000000..760758942
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/MultipleIUAndFragmentTest.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.tests.metadata;
+
+import java.util.*;
+import junit.framework.TestCase;
+import org.eclipse.equinox.prov.metadata.*;
+import org.eclipse.equinox.prov.resolution.ResolutionHelper;
+import org.eclipse.osgi.service.resolver.VersionRange;
+import org.osgi.framework.Version;
+
+public class MultipleIUAndFragmentTest extends TestCase {
+ IInstallableUnit iu1;
+ IInstallableUnit iu2;
+ IInstallableUnit iu3;
+ Collection result;
+
+ protected void setUp() throws Exception {
+ iu1 = createIU("one");
+ iu2 = createIUWithDependencyOn("two", "one");
+ iu3 = createIUFragment("fragment");
+ HashSet set = new HashSet();
+ set.add(iu1);
+ set.add(iu2);
+ set.add(iu3);
+ result = new ResolutionHelper(new Hashtable(), null).attachCUs(set);
+ }
+
+ protected void tearDown() throws Exception {
+ iu1 = null;
+ iu2 = null;
+ iu3 = null;
+ }
+
+ public void testAttachement() {
+ for (Iterator iterator = result.iterator(); iterator.hasNext();) {
+ IResolvedInstallableUnit iu = (IResolvedInstallableUnit) iterator.next();
+ if (iu.getId().equals(iu1.getId())) {
+ assertEquals(iu.getFragments().length, 1);
+ assertEquals(iu.getFragments()[0].getId(), iu3.getId());
+ }
+ if (iu.getId().equals(iu2.getId())) {
+ assertEquals(iu.getFragments().length, 1);
+ assertEquals(iu.getFragments()[0].getId(), iu3.getId());
+ }
+ if (iu.getId().equals(iu3.getId())) {
+ assertEquals(iu.getFragments().length, 0);
+ }
+ }
+
+ }
+
+ private IInstallableUnit createIUFragment(String name) {
+ InstallableUnitFragment iu = new InstallableUnitFragment();
+ iu.setId(name);
+ iu.setVersion(new Version(1, 0, 0));
+ iu.setTouchpointType(new TouchpointType("eclipse", new Version(1, 0, 0)));
+
+ RequiredCapability[] reqs = new RequiredCapability[] {new RequiredCapability("eclipse.touchpoint", "bundle", VersionRange.emptyRange, null, false, true)};
+ iu.setRequiredCapabilities(reqs);
+ return iu;
+ }
+
+ private static IInstallableUnit createIU(String name) {
+ InstallableUnit iu = new InstallableUnit();
+ iu.setId(name);
+ iu.setVersion(new Version(1, 0, 0));
+ iu.setTouchpointType(new TouchpointType("eclipse", new Version(1, 0, 0)));
+
+ ProvidedCapability[] cap = new ProvidedCapability[] {new ProvidedCapability("eclipse.touchpoint", "bundle", new Version(1, 0, 0))};
+ iu.setCapabilities(cap);
+ return iu;
+ }
+
+ private static IInstallableUnit createIUWithDependencyOn(String name, String dependencyOn) {
+ InstallableUnit iu = new InstallableUnit();
+ iu.setId(name);
+ iu.setVersion(new Version(1, 0, 0));
+ iu.setTouchpointType(new TouchpointType("eclipse", new Version(1, 0, 0)));
+ iu.setCapabilities(new ProvidedCapability[] {new ProvidedCapability("eclipse.touchpoint", "bundle", new Version(1, 0, 0))});
+ iu.setRequiredCapabilities(new RequiredCapability[] {new RequiredCapability(IInstallableUnit.IU_NAMESPACE, dependencyOn, VersionRange.emptyRange, null, false, true)});
+ return iu;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/OldTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/OldTest.java
new file mode 100644
index 000000000..db71c19ae
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/OldTest.java
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.tests.metadata;
+
+import com.thoughtworks.xstream.XStream;
+import java.io.*;
+import java.util.ArrayList;
+import org.eclipse.equinox.prov.metadata.*;
+import org.eclipse.equinox.prov.resolution.Transformer;
+import org.eclipse.equinox.prov.tests.TestActivator;
+import org.eclipse.osgi.service.resolver.*;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.Version;
+
+public class OldTest {
+ public void testDependencyOnCapability() {
+ InstallableUnit osgi = new InstallableUnit();
+ osgi.setId("org.eclipse.osgi");
+ osgi.setVersion(new Version(3, 2, 0, null));
+
+ osgi.setRequiredCapabilities(new RequiredCapability[] {new RequiredCapability("java.runtime", "JRE", null, null, false, false)});
+
+ InstallableUnit jre = new InstallableUnit();
+ jre.setId("com.ibm.jre");
+ jre.setVersion(new Version(1, 4, 2, "sr2"));
+ jre.setCapabilities(new ProvidedCapability[] {new ProvidedCapability("java.runtime", "JRE", new Version(1, 4, 2, "sr2"))});
+
+ ServiceReference sr = TestActivator.context.getServiceReference(PlatformAdmin.class.getName());
+
+ StateObjectFactory factory = ((PlatformAdmin) TestActivator.context.getService(sr)).getFactory();
+ Transformer t = new Transformer(factory);
+ t.visitInstallableUnit(osgi);
+ BundleDescription osgiBd = t.getResult();
+
+ t = new Transformer(factory);
+ t.visitInstallableUnit(jre);
+ BundleDescription jreBd = t.getResult();
+
+ State state = factory.createState(true);
+ state.addBundle(osgiBd);
+ state.addBundle(jreBd);
+ state.resolve();
+
+ System.out.println(osgiBd + ": " + osgiBd.isResolved());
+ System.out.println(jreBd + ": " + jreBd.isResolved());
+ }
+
+ public void testNamedDependency() {
+ InstallableUnit jface = new InstallableUnit();
+ jface.setId("org.eclipse.jface");
+ jface.setVersion(new Version(3, 2, 0, null));
+
+ jface.setRequiredCapabilities(new RequiredCapability[] {RequiredCapability.createRequiredCapabilityForName("org.eclipse.swt", null, false)});
+
+ InstallableUnit swt = new InstallableUnit();
+ swt.setId("org.eclipse.swt");
+ swt.setVersion(new Version(3, 2, 0, null));
+
+ ServiceReference sr = TestActivator.context.getServiceReference(PlatformAdmin.class.getName());
+
+ StateObjectFactory factory = ((PlatformAdmin) TestActivator.context.getService(sr)).getFactory();
+ Transformer t = new Transformer(factory);
+ t.visitInstallableUnit(jface);
+ BundleDescription jfaceBd = t.getResult();
+
+ t = new Transformer(factory);
+ t.visitInstallableUnit(swt);
+ BundleDescription swtBd = t.getResult();
+
+ State state = factory.createState(true);
+ state.addBundle(jfaceBd);
+ state.addBundle(swtBd);
+ state.resolve();
+
+ System.out.println(jfaceBd + ": " + jfaceBd.isResolved());
+ System.out.println(swtBd + ": " + swtBd.isResolved());
+ }
+
+ public void testBackup() {
+ InstallableUnit osgi = new InstallableUnit();
+ osgi.setId("org.eclipse.osgi");
+ osgi.setVersion(new Version(3, 2, 0, null));
+ osgi.setRequiredCapabilities(new RequiredCapability[] {new RequiredCapability("java.runtime", "JRE", null, null, false, false)});
+
+ InstallableUnit jre = new InstallableUnit();
+ jre.setId("com.ibm.jre");
+ jre.setVersion(new Version(1, 4, 2, "sr2"));
+ jre.setCapabilities(new ProvidedCapability[] {new ProvidedCapability("java.runtime", "JRE", new Version(1, 4, 2, "sr2"))});
+
+ ArrayList all = new ArrayList();
+ all.add(osgi);
+ try {
+ new XStream().toXML(all, new FileOutputStream(new File("d:/tmp/m2.xml")));
+ } catch (FileNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/RecommendationTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/RecommendationTest.java
new file mode 100644
index 000000000..6cd05bae8
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/RecommendationTest.java
@@ -0,0 +1,178 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.tests.metadata;
+
+import java.lang.reflect.Method;
+import java.util.HashSet;
+import java.util.Set;
+import junit.framework.TestCase;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.internal.prov.director.Picker;
+import org.eclipse.equinox.prov.metadata.*;
+import org.eclipse.osgi.service.resolver.VersionRange;
+import org.osgi.framework.Version;
+
+public class RecommendationTest extends TestCase {
+ //test name dependency over
+ //test
+ //check that the picker is returning something in the range
+ public void testRecommendation() {
+ RequiredCapability applyOn, newValue;
+ applyOn = new RequiredCapability("namespace", "name", new VersionRange("[1.0, 2.0)"), null, false, false);
+ newValue = new RequiredCapability("namespace", "name", new VersionRange("[1.1, 2.0)"), null, false, false);
+ Recommendation r1 = new Recommendation(applyOn, newValue);
+
+ RequiredCapability goodMatch = new RequiredCapability("namespace", "name", new VersionRange("[1.0, 2.0)"), null, false, false);
+ assertEquals(true, r1.matches(goodMatch));
+
+ RequiredCapability badNamespace = new RequiredCapability("badNamespace", "name", new VersionRange("[1.0, 2.0)"), null, false, false);
+ assertEquals(false, r1.matches(badNamespace));
+
+ RequiredCapability badName = new RequiredCapability("namespace", "badName", new VersionRange("[1.0, 2.0)"), null, false, false);
+ assertEquals(false, r1.matches(badName));
+ }
+
+ public void testPicker() {
+ //The IUs we will pick from
+ InstallableUnit iu1 = createIU("iu1", new Version(1, 0, 0));
+ InstallableUnit iu2 = createIU("iu2", new Version(4, 0, 0));
+
+ //The recommendations to be used
+ RequiredCapability applyOn, newValue;
+ applyOn = new RequiredCapability(IInstallableUnit.IU_NAMESPACE, "iu1", new VersionRange("[1.0, 2.0)"), null, false, false);
+ newValue = new RequiredCapability(IInstallableUnit.IU_NAMESPACE, "iu1", new VersionRange("[1.1, 2.0)"), null, false, false);
+ Recommendation r1 = new Recommendation(applyOn, newValue);
+
+ RequiredCapability applyOn2, newValue2;
+ applyOn2 = new RequiredCapability(IInstallableUnit.IU_NAMESPACE, "iu2", new VersionRange("[4.2, 5.0)"), null, false, false);
+ newValue2 = new RequiredCapability(IInstallableUnit.IU_NAMESPACE, "iu2", new VersionRange("[4.0, 5.0)"), null, false, false);
+ Recommendation r2 = new Recommendation(applyOn2, newValue2);
+ Set recommendations = new HashSet();
+ recommendations.add(r1);
+ recommendations.add(r2);
+
+ Picker p = new Picker(new InstallableUnit[] {iu1, iu2}, null);
+ IInstallableUnit[][] matches = p.findInstallableUnit(null, null, new RequiredCapability[] {new RequiredCapability(IInstallableUnit.IU_NAMESPACE, "iu1", null, null, false, false)}, false);
+ assertEquals(matches[1][0], iu1);
+
+ Picker p1 = new Picker(new InstallableUnit[] {iu1, iu2}, new RecommendationDescriptor(recommendations));
+ matches = p1.findInstallableUnit(null, null, new RequiredCapability[] {new RequiredCapability(IInstallableUnit.IU_NAMESPACE, "iu1", new VersionRange("[1.0, 2.0)"), null, false, false)}, false);
+ assertEquals(matches[0].length, 0);
+ assertEquals(matches[1].length, 0);
+
+ matches = p1.findInstallableUnit(null, null, new RequiredCapability[] {new RequiredCapability(IInstallableUnit.IU_NAMESPACE, "iu1", new VersionRange("[4.2, 5.0)"), null, false, false)}, false);
+ assertEquals(matches[0].length, 0);
+ assertEquals(matches[1].length, 0);
+ }
+
+ public void testWideningRanges() {
+ //The IUs we will pick from
+ InstallableUnit iu1 = createIU("iu1", new Version(4, 0, 0));
+
+ //Here we add recommendation that widen the range of the bundle we are looking for
+ RequiredCapability applyOn2, newValue2;
+ applyOn2 = new RequiredCapability(IInstallableUnit.IU_NAMESPACE, "iu1", new VersionRange("[4.2, 5.0)"), null, false, false);
+ newValue2 = new RequiredCapability(IInstallableUnit.IU_NAMESPACE, "iu1", new VersionRange("[4.0, 5.0)"), null, false, false);
+ Recommendation r2 = new Recommendation(applyOn2, newValue2);
+ Set recommendations = new HashSet();
+ recommendations.add(r2);
+
+ //Check without the recommendations
+ Picker p2 = new Picker(new InstallableUnit[] {iu1}, null);
+ IInstallableUnit[][] matches = p2.findInstallableUnit(null, null, new RequiredCapability[] {new RequiredCapability(IInstallableUnit.IU_NAMESPACE, "iu1", new VersionRange("[4.0, 5.0)"), null, false, false)}, false);
+ assertEquals(matches[1].length, 1);
+
+ //Check the widening works
+ Picker p1 = new Picker(new InstallableUnit[] {iu1}, new RecommendationDescriptor(recommendations));
+ matches = p1.findInstallableUnit(null, null, new RequiredCapability[] {new RequiredCapability(IInstallableUnit.IU_NAMESPACE, "iu1", new VersionRange("[4.2, 5.0)"), null, false, false)}, false);
+ assertEquals(matches[1].length, 1);
+
+ }
+
+ public void testRecommendationDescriptorMerge() {
+ RequiredCapability applyOn1, newValue1;
+ applyOn1 = new RequiredCapability("namespace", "name", new VersionRange("[1.0, 2.0)"), null, false, false);
+ newValue1 = new RequiredCapability("namespace", "name", new VersionRange("[1.1, 2.0)"), null, false, false);
+ Recommendation r1 = new Recommendation(applyOn1, newValue1);
+ Set list1 = new HashSet();
+ list1.add(r1);
+ RecommendationDescriptor desc1 = new RecommendationDescriptor(list1);
+
+ RequiredCapability applyOn2, newValue2;
+ applyOn2 = new RequiredCapability("namespace", "name", new VersionRange("[1.0, 2.0)"), null, false, false);
+ newValue2 = new RequiredCapability("namespace", "name", new VersionRange("[1.3, 2.0)"), null, false, false);
+ Recommendation r2 = new Recommendation(applyOn2, newValue2);
+ Set list2 = new HashSet();
+ list2.add(r2);
+ RecommendationDescriptor desc2 = new RecommendationDescriptor(list2);
+
+ //We test that the result of the merge worked.
+ assertEquals(Status.OK_STATUS, desc1.merge(desc2));
+ assertEquals(r2, desc1.findRecommendation(new RequiredCapability("namespace", "name", new VersionRange("[1.0, 2.0)"), null, false, false)));
+ }
+
+ public void testRecommendationDescriptorMergeConflict() {
+ RequiredCapability applyOn1, newValue1;
+ applyOn1 = new RequiredCapability("namespace", "name", new VersionRange("[1.0, 2.0)"), null, false, false);
+ newValue1 = new RequiredCapability("namespace", "name", new VersionRange("[1.1, 2.0)"), null, false, false);
+ Recommendation r1 = new Recommendation(applyOn1, newValue1);
+ Set list1 = new HashSet();
+ list1.add(r1);
+ RecommendationDescriptor desc1 = new RecommendationDescriptor(list1);
+
+ RequiredCapability applyOn2, newValue2;
+ applyOn2 = new RequiredCapability("namespace", "name", new VersionRange("[1.0, 2.0)"), null, false, false);
+ newValue2 = new RequiredCapability("namespace", "name", new VersionRange("[2.1, 3.0)"), null, false, false);
+ Recommendation r2 = new Recommendation(applyOn2, newValue2);
+ Set list2 = new HashSet();
+ list2.add(r2);
+ RecommendationDescriptor desc2 = new RecommendationDescriptor(list2);
+
+ //We test that the result of the merge worked.
+ assertEquals(Status.INFO, desc1.merge(desc2).getSeverity());
+ }
+
+ public void testRangeIntersection() {
+ Recommendation rec = new Recommendation(null, null);
+ try {
+ Method m = rec.getClass().getDeclaredMethod("intersect", new Class[] {VersionRange.class, VersionRange.class});
+ m.setAccessible(true);
+ assertEquals(new VersionRange("[1.0.0, 2.0.0)"), m.invoke(rec, new Object[] {new VersionRange("[1.0.0, 2.0.0)"), new VersionRange("[0.1.0, 3.0.0]")}));
+
+ assertEquals(new VersionRange("[1.1.0, 1.9.0]"), m.invoke(rec, new Object[] {new VersionRange("[1.0.0, 2.0.0)"), new VersionRange("[1.1.0, 1.9.0]")}));
+ assertEquals(new VersionRange("[1.1.0, 2.0.0)"), m.invoke(rec, new Object[] {new VersionRange("[1.0.0, 2.0.0)"), new VersionRange("[1.1.0, 2.1.0]")}));
+ assertEquals(new VersionRange("[1.0.0, 1.3.0]"), m.invoke(rec, new Object[] {new VersionRange("[1.0.0, 2.0.0)"), new VersionRange("[0.9.0, 1.3.0]")}));
+ assertEquals(null, m.invoke(rec, new Object[] {new VersionRange("[1.0.0, 2.0.0)"), new VersionRange("[3.0.0, 4.0.0]")}));
+
+ assertEquals(new VersionRange("(1.0.0, 2.0.0]"), m.invoke(rec, new Object[] {new VersionRange("[1.0.0, 2.0.0]"), new VersionRange("(1.0.0, 2.1.0]")}));
+ assertEquals(new VersionRange("(1.0.0, 2.0.0]"), m.invoke(rec, new Object[] {new VersionRange("(1.0.0, 2.0.0]"), new VersionRange("[1.0.0, 2.1.0]")}));
+
+ assertEquals(new VersionRange("[1.0.0, 2.0.0)"), m.invoke(rec, new Object[] {new VersionRange("[1.0.0, 2.0.0)"), new VersionRange("[1.0.0, 2.0.0]")}));
+ assertEquals(new VersionRange("[1.0.0, 2.0.0)"), m.invoke(rec, new Object[] {new VersionRange("[1.0.0, 2.0.0]"), new VersionRange("[1.0.0, 2.0.0)")}));
+
+ assertEquals(new VersionRange("[1.0.0, 2.0.0]"), m.invoke(rec, new Object[] {new VersionRange("[1.0.0, 2.0.0]"), new VersionRange("[1.0.0, 2.0.0]")}));
+ assertEquals(new VersionRange("(1.0.0, 2.0.0)"), m.invoke(rec, new Object[] {new VersionRange("(1.0.0, 2.0.0)"), new VersionRange("(1.0.0, 2.0.0)")}));
+
+ assertEquals(null, m.invoke(rec, new Object[] {new VersionRange("[1.0.0, 2.0.0)"), new VersionRange("[2.0.0, 3.0.0)")}));
+ assertEquals(new VersionRange("[2.0.0, 2.0.0]"), m.invoke(rec, new Object[] {new VersionRange("[1.0.0, 2.0.0]"), new VersionRange("[2.0.0, 3.0.0)")}));
+ assertEquals(null, m.invoke(rec, new Object[] {new VersionRange("[1.0.0, 2.0.0]"), new VersionRange("(2.0.0, 3.0.0)")}));
+ } catch (Exception e) {
+ fail("Usage of reflection failed");
+ }
+ }
+
+ private static InstallableUnit createIU(String name, Version version) {
+ InstallableUnit iu = new InstallableUnit();
+ iu.setId(name);
+ iu.setVersion(version);
+ return iu;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/ResolutionHelperTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/ResolutionHelperTest.java
new file mode 100644
index 000000000..21dd45b3c
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/ResolutionHelperTest.java
@@ -0,0 +1,302 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.tests.metadata;
+
+import java.util.*;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.eclipse.equinox.prov.metadata.*;
+import org.eclipse.equinox.prov.resolution.ResolutionHelper;
+import org.eclipse.equinox.prov.resolution.UnsatisfiedCapability;
+import org.eclipse.equinox.prov.tests.AbstractProvisioningTest;
+import org.eclipse.osgi.service.resolver.VersionRange;
+import org.osgi.framework.Version;
+
+/**
+ * Tests for {@link ResolutionHelper}.
+ */
+public class ResolutionHelperTest extends AbstractProvisioningTest {
+ private static final String FILTER_KEY = "osgi.os";
+
+ public static Test suite() {
+ return new TestSuite(ResolutionHelperTest.class);
+ }
+
+ public ResolutionHelperTest() {
+ super("");
+ }
+
+ public ResolutionHelperTest(String name) {
+ super(name);
+ }
+
+ /**
+ * Tests resolving an IU that requires a capability, and the available
+ * provided capability is above the required capability's version range.
+ */
+ public void testDependencyAboveVersionRange() {
+ Version version = new Version(5, 0, 0);
+
+ //The IU that exports the capability
+ InstallableUnit required = new InstallableUnit();
+ required.setId("required");
+ required.setVersion(version);
+ required.setCapabilities(new ProvidedCapability[] {new ProvidedCapability("test.capability", "test", version)});
+
+ //an IU whose required capability falls outside available range
+ InstallableUnit toInstall = new InstallableUnit();
+ toInstall.setId("match");
+ toInstall.setVersion(version);
+ toInstall.setRequiredCapabilities(createRequiredCapabilities("test.capability", "test", new VersionRange("[2.0,5.0)"), null));
+
+ ResolutionHelper rh = new ResolutionHelper(null, null);
+ HashSet installSet = new HashSet();
+ installSet.add(toInstall);
+ HashSet available = new HashSet();
+ available.add(required);
+ UnsatisfiedCapability[] unsatisfied = rh.install(installSet, available);
+
+ assertEquals("1.0", 1, unsatisfied.length);
+ assertEquals("1.1", "match", unsatisfied[0].getUnsatisfiedUnit().getId());
+ RequiredCapability capability = unsatisfied[0].getRequiredCapability();
+ assertEquals("1.4", "test.capability", capability.getNamespace());
+ assertEquals("1.5", "test", capability.getName());
+ }
+
+ /**
+ * Tests resolving an IU that requires a capability, and the available
+ * provided capability is below the required capability's version range.
+ */
+ public void testDependencyBelowVersionRange() {
+ Version version = new Version(2, 0, 0);
+
+ //The IU that exports the capability
+ InstallableUnit required = new InstallableUnit();
+ required.setId("required");
+ required.setVersion(version);
+ required.setCapabilities(new ProvidedCapability[] {new ProvidedCapability("test.capability", "test", version)});
+
+ //an IU whose required capability falls outside available range
+ InstallableUnit toInstall = new InstallableUnit();
+ toInstall.setId("match");
+ toInstall.setVersion(version);
+ toInstall.setRequiredCapabilities(createRequiredCapabilities("test.capability", "test", new VersionRange("(2.0,3.0)"), null));
+
+ ResolutionHelper rh = new ResolutionHelper(null, null);
+ HashSet installSet = new HashSet();
+ installSet.add(toInstall);
+ HashSet available = new HashSet();
+ available.add(required);
+ UnsatisfiedCapability[] unsatisfied = rh.install(installSet, available);
+
+ assertEquals("1.0", 1, unsatisfied.length);
+ assertEquals("1.1", "match", unsatisfied[0].getUnsatisfiedUnit().getId());
+ RequiredCapability capability = unsatisfied[0].getRequiredCapability();
+ assertEquals("1.4", "test.capability", capability.getNamespace());
+ assertEquals("1.5", "test", capability.getName());
+ }
+
+ public void testDependencyWithPlatformFilter() {
+ Version version = new Version(1, 0, 0);
+
+ //The IU that exports the capability
+ InstallableUnit required = new InstallableUnit();
+ required.setId("required");
+ required.setVersion(version);
+ required.setCapabilities(new ProvidedCapability[] {new ProvidedCapability("test.capability", "test", version)});
+ required.setFilter(createFilter(FILTER_KEY, "win32"));
+
+ InstallableUnit toInstall = new InstallableUnit();
+ toInstall.setId("toInstall");
+ toInstall.setVersion(version);
+ toInstall.setRequiredCapabilities(createRequiredCapabilities("test.capability", "test", ANY_VERSION, null));
+
+ //setup context so that platform filter will satisfy dependency
+ Hashtable context = new Hashtable();
+ context.put(FILTER_KEY, "win32");
+ ResolutionHelper rh = new ResolutionHelper(context, null);
+ HashSet installSet = new HashSet();
+ installSet.add(toInstall);
+ HashSet available = new HashSet();
+ available.add(required);
+ UnsatisfiedCapability[] unsatisfied = rh.install(installSet, available);
+ assertEquals("1.0", 0, unsatisfied.length);
+
+ //now try with a null evaluation context
+ rh = new ResolutionHelper(null, null);
+ unsatisfied = rh.install(installSet, available);
+ assertEquals("1.1", 1, unsatisfied.length);
+ assertEquals("1.2", "toInstall", unsatisfied[0].getUnsatisfiedUnit().getId());
+ RequiredCapability capability = unsatisfied[0].getRequiredCapability();
+ assertEquals("1.3", "test.capability", capability.getNamespace());
+ assertEquals("1.4", "test", capability.getName());
+
+ //now use a context where platform filter will not be satisfied
+ context.put(FILTER_KEY, "nomatch");
+ rh = new ResolutionHelper(context, null);
+ unsatisfied = rh.install(installSet, available);
+ assertEquals("2.1", 1, unsatisfied.length);
+ assertEquals("2.2", "toInstall", unsatisfied[0].getUnsatisfiedUnit().getId());
+ capability = unsatisfied[0].getRequiredCapability();
+ assertEquals("2.3", "test.capability", capability.getNamespace());
+ assertEquals("2.4", "test", capability.getName());
+
+ }
+
+ /**
+ * Tests resolving an IU that has a filter on its required capability.
+ */
+ public void testSatisfiedDependencyWithMatchingFilter() {
+ //use the same version everywhere because it's not interesting for this test
+ Version version = new Version(1, 0, 0);
+
+ //The IU that exports the capability
+ InstallableUnit required = new InstallableUnit();
+ required.setId("required");
+ required.setVersion(version);
+ required.setCapabilities(new ProvidedCapability[] {new ProvidedCapability("test.capability", "test", version)});
+
+ //an IU whose filter will match the environment
+ InstallableUnit toInstall = new InstallableUnit();
+ toInstall.setId("match");
+ toInstall.setVersion(version);
+ toInstall.setRequiredCapabilities(createRequiredCapabilities("test.capability", "test", createFilter(FILTER_KEY, "matchValue")));
+
+ Dictionary environment = new Hashtable();
+ environment.put(FILTER_KEY, "matchValue");
+ ResolutionHelper rh = new ResolutionHelper(environment, null);
+ HashSet installSet = new HashSet();
+ installSet.add(toInstall);
+ HashSet available = new HashSet();
+ available.add(required);
+ UnsatisfiedCapability[] unsatisfied = rh.install(installSet, available);
+
+ assertEquals("1.0", 0, unsatisfied.length);
+ }
+
+ /**
+ * In this test we try to resolve an IU that has a required capability that is
+ * available, but there is a filter on the required capability so it should not be considered.
+ */
+ public void testSatisfiedDependencyWithUnmatchingFilter() {
+ //use the same version everywhere because it's not interesting for this test
+ Version version = new Version(1, 0, 0);
+
+ //The IU that exports the capability
+ InstallableUnit required = new InstallableUnit();
+ required.setId("required");
+ required.setVersion(version);
+ required.setCapabilities(new ProvidedCapability[] {new ProvidedCapability("test.capability", "test", version)});
+
+ //an IU whose filter will not match the environment
+ InstallableUnit toInstall = new InstallableUnit();
+ toInstall.setId("noMatch");
+ toInstall.setVersion(version);
+ toInstall.setRequiredCapabilities(createRequiredCapabilities("test.capability", "test", createFilter(FILTER_KEY, "noMatchValue")));
+
+ Dictionary environment = new Hashtable();
+ environment.put(FILTER_KEY, "matchValue");
+ ResolutionHelper rh = new ResolutionHelper(environment, null);
+ HashSet installSet = new HashSet();
+ installSet.add(toInstall);
+ HashSet available = new HashSet();
+ available.add(required);
+ UnsatisfiedCapability[] unsatisfied = rh.install(installSet, available);
+
+ assertEquals("1.0", 0, unsatisfied.length);
+ }
+
+ public void testSimpleDependency() {
+ InstallableUnit osgi = new InstallableUnit();
+ osgi.setId("org.eclipse.osgi");
+ osgi.setVersion(new Version(3, 2, 0, null));
+ osgi.setRequiredCapabilities(new RequiredCapability[] {new RequiredCapability("java.runtime", "JRE", null, null, false, false)});
+
+ InstallableUnit jre = new InstallableUnit();
+ jre.setId("com.ibm.jre");
+ jre.setVersion(new Version(1, 4, 2, "sr2"));
+ jre.setCapabilities(new ProvidedCapability[] {new ProvidedCapability("java.runtime", "JRE", new Version(1, 4, 2, "sr2"))});
+
+ ResolutionHelper rh = new ResolutionHelper(null, null);
+ HashSet osgiSet = new HashSet(1);
+ osgiSet.add(osgi);
+ HashSet jreSet = new HashSet(1);
+ jreSet.add(jre);
+ assertEquals("1.0", 0, rh.install(osgiSet, jreSet).length);
+ }
+
+ /**
+ * Tests resolving an IU that has a filter on its required capability, and
+ * the required capability is not available.
+ */
+ public void testUnsatisfiedDependencyWithMatchingFilter() {
+ //use the same version everywhere because it's not interesting for this test
+ Version version = new Version(1, 0, 0);
+
+ //The IU that exports the capability
+ InstallableUnit required = new InstallableUnit();
+ required.setId("required");
+ required.setVersion(version);
+ required.setCapabilities(new ProvidedCapability[] {new ProvidedCapability("test.capability", "test", version)});
+
+ //an IU whose filter will match the environment
+ InstallableUnit toInstall = new InstallableUnit();
+ toInstall.setId("match");
+ toInstall.setVersion(version);
+ toInstall.setRequiredCapabilities(createRequiredCapabilities("test.capability", "does.not.exist", createFilter(FILTER_KEY, "matchValue")));
+
+ Dictionary environment = new Hashtable();
+ environment.put(FILTER_KEY, "matchValue");
+ ResolutionHelper rh = new ResolutionHelper(environment, null);
+ HashSet installSet = new HashSet();
+ installSet.add(toInstall);
+ HashSet available = new HashSet();
+ available.add(required);
+ UnsatisfiedCapability[] unsatisfied = rh.install(installSet, available);
+
+ assertEquals("1.0", 1, unsatisfied.length);
+ assertEquals("1.1", "match", unsatisfied[0].getUnsatisfiedUnit().getId());
+ RequiredCapability capability = unsatisfied[0].getRequiredCapability();
+ assertEquals("1.4", "test.capability", capability.getNamespace());
+ assertEquals("1.5", "does.not.exist", capability.getName());
+ }
+
+ /**
+ * In this test we try to resolve an IU that has an unsatisfied dependency.
+ * However, there is a filter on the unresolved dependency that does not
+ * match the environment, so it should not prevent the IU being resolved.
+ */
+ public void testUnsatisfiedDependencyWithUnmatchingFilter() {
+ //use the same version everywhere because it's not interesting for this test
+ Version version = new Version(1, 0, 0);
+
+ //The IU that exports the capability
+ InstallableUnit required = new InstallableUnit();
+ required.setId("required");
+ required.setVersion(version);
+ required.setCapabilities(new ProvidedCapability[] {new ProvidedCapability("test.capability", "test", version)});
+
+ //an IU whose filter will not match the environment
+ InstallableUnit toInstall = new InstallableUnit();
+ toInstall.setId("noMatch");
+ toInstall.setVersion(version);
+ toInstall.setRequiredCapabilities(createRequiredCapabilities("test.capability", "does.not.exist", createFilter(FILTER_KEY, "noMatchValue")));
+
+ Dictionary environment = new Hashtable();
+ environment.put(FILTER_KEY, "matchValue");
+ ResolutionHelper rh = new ResolutionHelper(environment, null);
+ HashSet installSet = new HashSet();
+ installSet.add(toInstall);
+ HashSet available = new HashSet();
+ available.add(required);
+ UnsatisfiedCapability[] unsatisfied = rh.install(installSet, available);
+
+ assertEquals("1.0", 0, unsatisfied.length);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/repository/AllTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/repository/AllTests.java
new file mode 100644
index 000000000..532adb148
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/repository/AllTests.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.tests.metadata.repository;
+
+import junit.framework.*;
+
+/**
+ * Performs all automated director tests.
+ */
+public class AllTests extends TestCase {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(AllTests.class.getName());
+ suite.addTestSuite(JarURLRepositoryTest.class);
+ return suite;
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/repository/JarURLRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/repository/JarURLRepositoryTest.java
new file mode 100644
index 000000000..5277f277d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/repository/JarURLRepositoryTest.java
@@ -0,0 +1,45 @@
+package org.eclipse.equinox.prov.tests.metadata.repository;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import junit.framework.TestCase;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepository;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepositoryManager;
+import org.eclipse.equinox.prov.tests.TestActivator;
+import org.osgi.framework.ServiceReference;
+
+public class JarURLRepositoryTest extends TestCase {
+
+ private ServiceReference managerRef;
+ private IMetadataRepositoryManager manager;
+
+ public JarURLRepositoryTest(String name) {
+ super(name);
+ }
+
+ public JarURLRepositoryTest() {
+ super("");
+ }
+
+ protected void setUp() throws Exception {
+ managerRef = TestActivator.getContext().getServiceReference(IMetadataRepositoryManager.class.getName());
+ manager = (IMetadataRepositoryManager) TestActivator.getContext().getService(managerRef);
+ }
+
+ protected void tearDown() throws Exception {
+ manager = null;
+ TestActivator.getContext().ungetService(managerRef);
+ }
+
+ public void testJarURLRepository() {
+ URL engineJar = TestActivator.getContext().getBundle().getEntry("/testData/enginerepo.jar");
+ URL jarRepoURL = null;
+ try {
+ jarRepoURL = new URL("jar:" + engineJar.toString() + "!/");
+ } catch (MalformedURLException e) {
+ fail(e.getMessage());
+ }
+ IMetadataRepository repo = manager.loadRepository(jarRepoURL, null);
+ assertTrue(repo.getInstallableUnits(null).length > 0);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/enginerepo.jar b/bundles/org.eclipse.equinox.p2.tests/testData/enginerepo.jar
new file mode 100644
index 000000000..5a7fc33a4
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/testData/enginerepo.jar
Binary files differ
diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/jarprocessor.jar.pack.gz b/bundles/org.eclipse.equinox.p2.tests/testData/jarprocessor.jar.pack.gz
new file mode 100644
index 000000000..f2df489b2
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/testData/jarprocessor.jar.pack.gz
Binary files differ
diff --git a/bundles/org.eclipse.equinox.p2.tools/.classpath b/bundles/org.eclipse.equinox.p2.tools/.classpath
new file mode 100644
index 000000000..ce7393340
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tools/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.equinox.p2.tools/.cvsignore b/bundles/org.eclipse.equinox.p2.tools/.cvsignore
new file mode 100644
index 000000000..c5e82d745
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tools/.cvsignore
@@ -0,0 +1 @@
+bin \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.tools/.project b/bundles/org.eclipse.equinox.p2.tools/.project
new file mode 100644
index 000000000..24d2ab448
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tools/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.equinox.prov.tools</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.equinox.p2.tools/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.tools/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..78523cd05
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tools/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,331 @@
+#Thu Aug 16 11:00:59 EDT 2007
+eclipse.preferences.version=1
+org.eclipse.jdt.core.builder.cleanOutputFolder=clean
+org.eclipse.jdt.core.builder.duplicateResourceTask=warning
+org.eclipse.jdt.core.builder.invalidClasspath=abort
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
+org.eclipse.jdt.core.circularClasspath=error
+org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
+org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=error
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=false
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false
+org.eclipse.jdt.core.formatter.comment.format_line_comments=false
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=800
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.incompatibleJDKLevel=ignore
+org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/bundles/org.eclipse.equinox.p2.tools/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.p2.tools/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 000000000..8d299d8a0
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tools/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,57 @@
+#Sun Sep 23 11:58:57 EDT 2007
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_core
+formatter_settings_version=11
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=;
+org.eclipse.jdt.ui.ondemandthreshold=3
+org.eclipse.jdt.ui.staticondemandthreshold=3
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates/>
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.format_source_code=true
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_variable_declarations_final=true
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=false
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/bundles/org.eclipse.equinox.p2.tools/.settings/org.eclipse.pde.core.prefs b/bundles/org.eclipse.equinox.p2.tools/.settings/org.eclipse.pde.core.prefs
new file mode 100644
index 000000000..7dc047795
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tools/.settings/org.eclipse.pde.core.prefs
@@ -0,0 +1,4 @@
+#Mon Jul 30 14:52:29 EDT 2007
+eclipse.preferences.version=1
+pluginProject.extensions=false
+resolve.requirebundle=false
diff --git a/bundles/org.eclipse.equinox.p2.tools/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.tools/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..dcc9904c3
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tools/META-INF/MANIFEST.MF
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Tools Plug-in (Incubation)
+Bundle-SymbolicName: org.eclipse.equinox.prov.tools;singleton:=true
+Bundle-Version: 0.1.0.qualifier
+Import-Package: org.eclipse.equinox.app;version="1.0.0",
+ org.eclipse.equinox.internal.prov.console,
+ org.eclipse.equinox.prov.core,
+ org.eclipse.equinox.prov.engine,
+ org.eclipse.equinox.prov.metadata,
+ org.eclipse.equinox.prov.metadata.repository,
+ org.eclipse.equinox.prov.query,
+ org.eclipse.osgi.service.resolver;version="1.1.0",
+ org.osgi.framework;version="1.4.0"
+Require-Bundle: org.eclipse.equinox.common
+Bundle-RequiredExecutionEnvironment: J2SE-1.4
diff --git a/bundles/org.eclipse.equinox.p2.tools/ProvTools - compare repos.launch b/bundles/org.eclipse.equinox.p2.tools/ProvTools - compare repos.launch
new file mode 100644
index 000000000..8d39a674c
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tools/ProvTools - compare repos.launch
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<launchConfiguration type="org.eclipse.pde.ui.EquinoxLauncher">
+<booleanAttribute key="append.args" value="true"/>
+<booleanAttribute key="automaticAdd" value="false"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="false"/>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/tool - compare repos"/>
+<booleanAttribute key="default_auto_start" value="false"/>
+<intAttribute key="default_start_level" value="4"/>
+<booleanAttribute key="includeOptional" value="false"/>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-console -consolelog -application org.eclipse.equinox.prov.tools.queryableApp&#13;&#10;-source file:d:/tmp/equinox.prov/servers/metadataRepository/content.xml&#13;&#10;-target file:d:/tmp/equinox.prov/servers.old/metadataRepository/content.xml&#13;&#10;-compare"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<stringAttribute key="target_bundles" value="org.eclipse.core.jobs@default:default,org.eclipse.equinox.app@default:true,org.eclipse.equinox.common@default:default,org.eclipse.equinox.launcher@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.osgi@:,org.eclipse.osgi.services@default:default"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useDefaultConfigArea" value="true"/>
+<stringAttribute key="workspace_bundles" value="com.thoughtworks.xstream@default:default,org.eclipse.ecf@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.equinox.frameworkadmin@default:default,org.eclipse.equinox.frameworkadmin.equinox@default:true,org.eclipse.equinox.prov.artifact.repository@default:default,org.eclipse.equinox.prov.console@default:default,org.eclipse.equinox.prov.core@default:default,org.eclipse.equinox.prov.director@default:default,org.eclipse.equinox.prov.download@default:default,org.eclipse.equinox.prov.engine@default:default,org.eclipse.equinox.prov.examplarysetup@default:true,org.eclipse.equinox.prov.metadata@default:default,org.eclipse.equinox.prov.metadata.generator@default:default,org.eclipse.equinox.prov.metadata.repository@default:default,org.eclipse.equinox.prov.tools@default:default"/>
+</launchConfiguration>
diff --git a/bundles/org.eclipse.equinox.p2.tools/ProvTools - list profile.launch b/bundles/org.eclipse.equinox.p2.tools/ProvTools - list profile.launch
new file mode 100644
index 000000000..a76d8d806
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tools/ProvTools - list profile.launch
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<launchConfiguration type="org.eclipse.pde.ui.EquinoxLauncher">
+<booleanAttribute key="append.args" value="true"/>
+<booleanAttribute key="automaticAdd" value="false"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="false"/>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/tool - list profile"/>
+<booleanAttribute key="default_auto_start" value="false"/>
+<intAttribute key="default_start_level" value="4"/>
+<booleanAttribute key="includeOptional" value="false"/>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-console -consolelog -application org.eclipse.equinox.prov.tools.queryableApp&#13;&#10;-source foo&#13;&#10;-list &#13;&#10;-profile"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Declipse.prov.data.area=d:/tmp/equinox.prov/agentdata/"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<stringAttribute key="target_bundles" value="org.eclipse.core.jobs@default:default,org.eclipse.equinox.app@default:true,org.eclipse.equinox.common@default:default,org.eclipse.equinox.launcher@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.osgi@:,org.eclipse.osgi.services@default:default"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useDefaultConfigArea" value="true"/>
+<stringAttribute key="workspace_bundles" value="com.thoughtworks.xstream@default:default,org.eclipse.ecf@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.equinox.frameworkadmin@default:default,org.eclipse.equinox.frameworkadmin.equinox@default:true,org.eclipse.equinox.prov.artifact.repository@default:default,org.eclipse.equinox.prov.console@default:default,org.eclipse.equinox.prov.core@default:default,org.eclipse.equinox.prov.director@default:default,org.eclipse.equinox.prov.download@default:default,org.eclipse.equinox.prov.engine@default:default,org.eclipse.equinox.prov.examplarysetup@default:true,org.eclipse.equinox.prov.metadata@default:default,org.eclipse.equinox.prov.metadata.generator@default:default,org.eclipse.equinox.prov.metadata.repository@default:default,org.eclipse.equinox.prov.tools@default:default"/>
+</launchConfiguration>
diff --git a/bundles/org.eclipse.equinox.p2.tools/build.properties b/bundles/org.eclipse.equinox.p2.tools/build.properties
new file mode 100644
index 000000000..4a49c9482
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tools/build.properties
@@ -0,0 +1,14 @@
+###############################################################################
+# Copyright (c) 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/bundles/org.eclipse.equinox.p2.tools/plugin.xml b/bundles/org.eclipse.equinox.p2.tools/plugin.xml
new file mode 100644
index 000000000..22c251a40
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tools/plugin.xml
@@ -0,0 +1,14 @@
+<plugin>
+ <extension
+ id="queryableApp"
+ point="org.eclipse.core.runtime.applications">
+ <application
+ cardinality="1"
+ thread="main"
+ visible="true">
+ <run
+ class="org.eclipse.equinox.prov.tools.MetadataCompareApplication">
+ </run>
+ </application>
+ </extension>
+</plugin>
diff --git a/bundles/org.eclipse.equinox.p2.tools/src/org/eclipse/equinox/prov/tools/MetadataCompareApplication.java b/bundles/org.eclipse.equinox.p2.tools/src/org/eclipse/equinox/prov/tools/MetadataCompareApplication.java
new file mode 100644
index 000000000..6210583b9
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tools/src/org/eclipse/equinox/prov/tools/MetadataCompareApplication.java
@@ -0,0 +1,230 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.tools;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.*;
+import org.eclipse.equinox.app.IApplication;
+import org.eclipse.equinox.app.IApplicationContext;
+import org.eclipse.equinox.internal.prov.console.ProvisioningHelper;
+import org.eclipse.equinox.prov.core.ProvisionException;
+import org.eclipse.equinox.prov.metadata.*;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepository;
+import org.eclipse.equinox.prov.query.IQueryable;
+import org.eclipse.equinox.prov.query.Query;
+import org.eclipse.osgi.service.resolver.VersionRange;
+
+public class MetadataCompareApplication implements IApplication {
+
+ private String source;
+ private String target;
+ private boolean compare = false;
+ private boolean list = false;
+ private String type = "meta";
+
+ public Object start(IApplicationContext context) throws Exception {
+ initializeFromArguments((String[]) context.getArguments().get("application.args"));
+
+ if (compare)
+ compareMetadataRepositories(new URL(source), new URL(target));
+ if (list) {
+ list(source);
+ list(target);
+ }
+ return IApplication.EXIT_OK;
+ }
+
+ private void list(String sourceLocation) throws ProvisionException {
+ if (sourceLocation == null)
+ return;
+ IQueryable source = null;
+ if (type.equals("meta")) {
+ URL location;
+ try {
+ location = new URL(sourceLocation);
+ } catch (MalformedURLException e) {
+ return;
+ }
+ ProvisioningHelper.addMetadataRepository(location);
+ source = ProvisioningHelper.getMetadataRepository(location);
+ if (source == null)
+ return;
+ } else if (type.equals("profile")) {
+ source = ProvisioningHelper.getProfile(sourceLocation);
+ if (source == null)
+ return;
+ }
+ IInstallableUnit[] sourceIUs = source.query(null, null, null, false, null);
+ sourceIUs = sort(sourceIUs, true);
+ for (int i = 0; i < sourceIUs.length; i++) {
+ System.out.print(sourceIUs[i]);
+ System.out.println(sourceIUs[i].isFragment() ? " (fragment)" : "");
+ }
+ System.out.println("Total: " + sourceIUs.length);
+ }
+
+ private void compareMetadataRepositories(URL source, URL target) throws ProvisionException {
+ ProvisioningHelper.addMetadataRepository(source);
+ IMetadataRepository sourceRepo = ProvisioningHelper.getMetadataRepository(source);
+ if (sourceRepo == null)
+ return;
+ ProvisioningHelper.addMetadataRepository(target);
+ IMetadataRepository targetRepo = ProvisioningHelper.getMetadataRepository(target);
+ if (targetRepo == null)
+ return;
+
+ System.out.println("\n" + source.toExternalForm() + " -> " + target.toExternalForm());
+ compare(sourceRepo, targetRepo);
+
+ System.out.println("\n" + target.toExternalForm() + " -> " + source.toExternalForm());
+ compare(targetRepo, sourceRepo);
+ }
+
+ private void compare(IQueryable sourceRepo, IQueryable targetRepo) {
+ IQueryable[] target = new IQueryable[] {targetRepo};
+ IInstallableUnit[] ius = sourceRepo.query(null, null, null, false, null);
+ ius = sort(ius, true);
+ for (int i = 0; i < ius.length; i++) {
+ IInstallableUnit iu = ius[i];
+ Iterator result = Query.getIterator(target, iu.getId(), new VersionRange(iu.getVersion(), true, iu.getVersion(), true), null, false);
+ if (!result.hasNext())
+ System.out.println(iu);
+ else {
+ String comparison = compare(iu, (IInstallableUnit) result.next());
+ if (comparison.length() > 0)
+ System.out.println(iu + comparison);
+ }
+ }
+ }
+
+ private boolean compare(Object a, Object b) {
+ if (a == null)
+ return b == null;
+ return a.equals(b);
+ }
+
+ private boolean compare(Object[] a, Object b[]) {
+ if (a == null)
+ return b == null;
+ return Arrays.equals(a, b);
+ }
+
+ private String compare(IInstallableUnit iu, IInstallableUnit next) {
+ String result = "";
+ if (!iu.equals(next))
+ result += " iu";
+ if (!compare(iu.getApplicabilityFilter(), next.getApplicabilityFilter()))
+ result += " applicabilityFilter";
+ if (!compare(iu.getArtifacts(), next.getArtifacts()))
+ result += " artifactLocators";
+ if (!compare(iu.getProvidedCapabilities(), next.getProvidedCapabilities()))
+ result += " providedCapabilities";
+ if (!compareRequires(iu.getRequiredCapabilities(), next.getRequiredCapabilities()))
+ result += " requiredCapabilities";
+ if (!compare(iu.getTouchpointType(), next.getTouchpointType()))
+ result += " touchpointType";
+
+ if (iu.isFragment()) {
+ if (((InstallableUnitFragment) iu).getHostId() == null || ((InstallableUnitFragment) iu).getHostVersionRange() == null)
+ return result;
+ if (!((InstallableUnitFragment) iu).getHostId().equals(((InstallableUnitFragment) next).getHostId()))
+ result += " hostid";
+ if (!((InstallableUnitFragment) iu).getHostVersionRange().equals(((InstallableUnitFragment) next).getHostVersionRange()))
+ result += " hostversionRange";
+ }
+ return result;
+ }
+
+ private boolean compareRequires(RequiredCapability[] a, RequiredCapability[] b) {
+ if (a == null)
+ return b == null;
+ if (a.length != b.length)
+ return false;
+ if (a == b)
+ return true;
+ for (int i = 0; i < a.length; i++)
+ if (findCapability(a[i], b) == null)
+ return false;
+ return true;
+ }
+
+ private RequiredCapability findCapability(RequiredCapability target, RequiredCapability[] b) {
+ for (int i = 0; i < b.length; i++) {
+ RequiredCapability capability = b[i];
+ if (target.equals(capability))
+ return capability;
+ }
+ return null;
+ }
+
+ private IInstallableUnit[] sort(IInstallableUnit[] ius, boolean clone) {
+ Comparator comparator = new Comparator() {
+ public int compare(Object source, Object target) {
+ IInstallableUnit sourceIU = (IInstallableUnit) source;
+ IInstallableUnit targetIU = (IInstallableUnit) target;
+ int id = sourceIU.getId().compareTo(targetIU.getId());
+ if (id != 0)
+ return id;
+ int version = sourceIU.getVersion().compareTo(targetIU.getVersion());
+ if (version != 0)
+ return version;
+ return 0;
+ }
+ };
+ IInstallableUnit[] result = ius;
+ if (clone) {
+ result = new InstallableUnit[ius.length];
+ System.arraycopy(ius, 0, result, 0, ius.length);
+ }
+ Arrays.sort(result, comparator);
+ return result;
+ }
+
+ public void initializeFromArguments(String[] args) throws Exception {
+ if (args == null)
+ return;
+ for (int i = 0; i < args.length; i++) {
+ // check for args without parameters (i.e., a flag arg)
+
+ // if (args[i].equalsIgnoreCase("-sort"))
+ // sort = true;
+
+ if (args[i].equalsIgnoreCase("-meta"))
+ type = "meta";
+
+ if (args[i].equalsIgnoreCase("-compare"))
+ compare = true;
+
+ if (args[i].equalsIgnoreCase("-profile"))
+ type = "profile";
+
+ if (args[i].equalsIgnoreCase("-list"))
+ list = true;
+
+ // check for args with parameters. If we are at the last argument or
+ // if the next one
+ // has a '-' as the first character, then we can't have an arg with
+ // a parm so continue.
+ if (i == args.length - 1 || args[i + 1].startsWith("-")) //$NON-NLS-1$
+ continue;
+
+ String arg = args[++i];
+
+ if (args[i - 1].equalsIgnoreCase("-source"))
+ source = arg;
+ if (args[i - 1].equalsIgnoreCase("-target"))
+ target = arg;
+ }
+ }
+
+ public void stop() {
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/.classpath b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/.classpath
new file mode 100644
index 000000000..7cdeb7319
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/CDC-1.1%Foundation-1.1"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/.project b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/.project
new file mode 100644
index 000000000..1a7f35972
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.equinox.prov.touchpoint.eclipse</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..cc7076882
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,334 @@
+#Tue Aug 21 09:42:55 EDT 2007
+eclipse.preferences.version=1
+instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
+org.eclipse.jdt.core.builder.cleanOutputFolder=clean
+org.eclipse.jdt.core.builder.duplicateResourceTask=warning
+org.eclipse.jdt.core.builder.invalidClasspath=abort
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
+org.eclipse.jdt.core.circularClasspath=error
+org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
+org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=error
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=false
+org.eclipse.jdt.core.formatter.comment.format_comments=false
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false
+org.eclipse.jdt.core.formatter.comment.format_line_comments=false
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=800
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.incompatibleJDKLevel=ignore
+org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 000000000..8bc0190ce
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,57 @@
+#Sun Sep 23 11:59:03 EDT 2007
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_core
+formatter_settings_version=11
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=;
+org.eclipse.jdt.ui.ondemandthreshold=3
+org.eclipse.jdt.ui.staticondemandthreshold=3
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates/>
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.format_source_code=true
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_variable_declarations_final=true
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=false
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/.settings/org.eclipse.pde.core.prefs b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/.settings/org.eclipse.pde.core.prefs
new file mode 100644
index 000000000..7913d20db
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/.settings/org.eclipse.pde.core.prefs
@@ -0,0 +1,4 @@
+
+eclipse.preferences.version=1
+pluginProject.extensions=false
+resolve.requirebundle=false
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..efc2d5e49
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/META-INF/MANIFEST.MF
@@ -0,0 +1,26 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Eclipse Adaptor Plug-in (Incubation)
+Bundle-SymbolicName: org.eclipse.equinox.prov.touchpoint.eclipse;singleton:=true
+Bundle-Version: 0.1.0.qualifier
+Import-Package: org.eclipse.core.runtime;common=split,
+ org.eclipse.equinox.frameworkadmin,
+ org.eclipse.equinox.internal.frameworkadmin.utils,
+ org.eclipse.equinox.prov.artifact.repository,
+ org.eclipse.equinox.prov.core.helpers,
+ org.eclipse.equinox.prov.core.location,
+ org.eclipse.equinox.prov.core.repository,
+ org.eclipse.equinox.prov.download,
+ org.eclipse.equinox.prov.engine,
+ org.eclipse.equinox.prov.metadata,
+ org.eclipse.osgi.framework.util,
+ org.eclipse.osgi.service.datalocation;version="1.0.0",
+ org.eclipse.osgi.service.environment;version="1.0.0",
+ org.eclipse.osgi.util;version="1.1.0",
+ org.mozilla.javascript,
+ org.osgi.framework;version="1.3.0",
+ org.osgi.util.tracker;version="1.3.2"
+Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
+ J2SE-1.4
+Eclipse-LazyStart: true
+Bundle-Activator: org.eclipse.equinox.internal.prov.touchpoint.eclipse.Activator
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/about.html b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/about.html
new file mode 100644
index 000000000..460233046
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 2, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/build.properties b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/build.properties
new file mode 100644
index 000000000..8917af773
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/build.properties
@@ -0,0 +1,16 @@
+###############################################################################
+# Copyright (c) 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ about.html
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/plugin.xml b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/plugin.xml
new file mode 100644
index 000000000..8fae48c47
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/plugin.xml
@@ -0,0 +1,8 @@
+<plugin>
+ <extension point="org.eclipse.equinox.prov.engine.touchpoints" id="eclipse" name="Eclipse Touchpoint">
+ <touchpoint
+ type="eclipse"
+ class="org.eclipse.equinox.internal.prov.touchpoint.eclipse.EclipseTouchpoint"
+ version="1.0.0"/>
+ </extension>
+</plugin>
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/prov/touchpoint/eclipse/Activator.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/prov/touchpoint/eclipse/Activator.java
new file mode 100644
index 000000000..405dc205e
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/prov/touchpoint/eclipse/Activator.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.touchpoint.eclipse;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+ public static final String ID = "org.eclipse.p2.touchpoint.eclipse"; //$NON-NLS-1$
+ private static BundleContext context = null;
+
+ public void start(BundleContext ctx) throws Exception {
+ Activator.context = ctx;
+ }
+
+ public void stop(BundleContext ctx) throws Exception {
+ Activator.context = null;
+ }
+
+ public static BundleContext getContext() {
+ return Activator.context;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/prov/touchpoint/eclipse/EclipseTouchpoint.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/prov/touchpoint/eclipse/EclipseTouchpoint.java
new file mode 100644
index 000000000..de50b0ada
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/prov/touchpoint/eclipse/EclipseTouchpoint.java
@@ -0,0 +1,490 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.internal.prov.touchpoint.eclipse;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.frameworkadmin.*;
+import org.eclipse.equinox.prov.artifact.repository.*;
+import org.eclipse.equinox.prov.core.helpers.*;
+import org.eclipse.equinox.prov.core.location.AgentLocation;
+import org.eclipse.equinox.prov.engine.*;
+import org.eclipse.equinox.prov.metadata.*;
+import org.eclipse.osgi.service.environment.EnvironmentInfo;
+import org.eclipse.osgi.util.ManifestElement;
+import org.mozilla.javascript.*;
+import org.osgi.framework.*;
+import org.osgi.util.tracker.ServiceTracker;
+
+public class EclipseTouchpoint implements ITouchpoint {
+ private final static String ID = "org.eclipse.equinox.prov.touchpoint.eclipse"; //$NON-NLS-1$
+ private final static String CONFIG_FOLDER = "eclipse.configurationFolder";
+ private final static String CACHE_PATH = "eclipse.prov.cache";
+
+ private final static String CONFIGURATION_DATA = "configurationData";
+ private final static String UNCONFIGURATION_DATA = "unconfigurationData";
+
+ private static final boolean DEBUG = false;
+ static int iuCount = 0;
+
+ private final static String FILTER_OBJECTCLASS = "(" + Constants.OBJECTCLASS + "=" + FrameworkAdmin.class.getName() + ")";
+ private final static String filterFwName = "(" + FrameworkAdmin.SERVICE_PROP_KEY_FW_NAME + "=Equinox)";
+ private final static String filterLauncherName = "(" + FrameworkAdmin.SERVICE_PROP_KEY_LAUNCHER_NAME + "=Eclipse.exe)";
+ private final static String filterFwAdmin = "(&" + FILTER_OBJECTCLASS + filterFwName + filterLauncherName + ")";
+
+ private ServiceTracker fwAdminTracker;
+ private Map lastModifiedMap = new HashMap();
+ private Map manipulatorMap = new HashMap();
+
+ // TODO Need to find a better way keep track of this information, is it a generalized cache mechanism?
+ // moreover there may scenarios where the configuration data is not stored in the same IU than the bundle referring to the artifact
+ private final Set supportedPhases = new HashSet(); //TODO This should probably come from XML
+
+ {
+ supportedPhases.add("collect");
+ supportedPhases.add("install");
+ supportedPhases.add("uninstall");
+ }
+
+ public ITouchpointAction[] getActions(String phaseID, final Profile profile, final Operand operand) {
+ if (phaseID.equals("collect")) {
+ ITouchpointAction action = new ITouchpointAction() {
+ public Object execute() {
+ return collect(operand.second(), profile);
+ }
+
+ public Object undo() {
+ return null;
+ }
+ };
+ return new ITouchpointAction[] {action};
+ }
+ if (phaseID.equals("install")) {
+ ITouchpointAction action = new ITouchpointAction() {
+ public Object execute() {
+ return configure(operand.second(), profile, true);
+ }
+
+ public Object undo() {
+ return configure(operand.second(), profile, false);
+ }
+ };
+ return new ITouchpointAction[] {action};
+ }
+ if (phaseID.equals("uninstall")) {
+ ITouchpointAction action = new ITouchpointAction() {
+ public Object execute() {
+ return configure(operand.first(), profile, false);
+ }
+
+ public Object undo() {
+ return configure(operand.first(), profile, true);
+ }
+ };
+ return new ITouchpointAction[] {action};
+ }
+ throw new IllegalStateException("The phase: " + phaseID + "should not have been dispatched here.");
+ }
+
+ private URL getBundlePoolLocation(Profile profile) {
+ String path = profile.getValue(CACHE_PATH);
+ if (path == null)
+ path = Activator.getContext().getProperty(CACHE_PATH);
+ if (path != null)
+ try {
+ // TODO this is a hack for now.
+ return File.separatorChar == '/' ? new URL("file:" + path) : new URL("file:/" + path);
+ } catch (MalformedURLException e) {
+ // TODO Do nothing and use the default approach
+ }
+ AgentLocation location = getAgentLocation();
+ if (location == null)
+ return null;
+ URL result = location.getTouchpointDataArea("org.eclipse.equinox.prov.touchpoint.eclipse/");
+ try {
+ return new URL(result, "bundlepool");
+ } catch (MalformedURLException e) {
+ // TODO Auto-generated catch block
+ return null;
+ }
+ }
+
+ private static AgentLocation getAgentLocation() {
+ return (AgentLocation) ServiceHelper.getService(Activator.getContext(), AgentLocation.class.getName());
+ }
+
+ // TODO: Here we may want to consult multiple caches
+ private IArtifactRequest[] collect(IInstallableUnit installableUnit, Profile profile) {
+ IWritableArtifactRepository targetRepo = null;
+ IArtifactKey[] toDownload = installableUnit.getArtifacts();
+ if (toDownload == null)
+ return IArtifactRepositoryManager.NO_ARTIFACT_REQUEST;
+ IArtifactRequest[] requests = new IArtifactRequest[toDownload.length];
+
+ URL poolLocation = getBundlePoolLocation(profile);
+ if (isCompletelyInRepo(getBundlePoolRepo(poolLocation), toDownload))
+ return IArtifactRepositoryManager.NO_ARTIFACT_REQUEST;
+
+ //If the installable unit has installation information, then the artifact is put in the download cache
+ //otherwise it is a jar'ed bundle and we directly store it in the plugin cache
+ if (installableUnit.getTouchpointData().length > 0 && isZipped(installableUnit.getTouchpointData())) {
+ targetRepo = getDownloadCacheRepo();
+ } else {
+ targetRepo = getBundlePoolRepo(poolLocation);
+ }
+ int count = 0;
+ for (int i = 0; i < toDownload.length; i++) {
+ IArtifactKey key = toDownload[i];
+ if (!targetRepo.contains(key)) {
+ requests[count++] = getArtifactRepositoryManager().createMirrorRequest(key, targetRepo);
+ }
+ }
+
+ if (requests.length == count)
+ return requests;
+ IArtifactRequest[] result = new IArtifactRequest[count];
+ System.arraycopy(requests, 0, result, 0, count);
+ return result;
+ }
+
+ private boolean isCompletelyInRepo(IArtifactRepository repo, IArtifactKey[] toDownload) {
+ for (int i = 0; i < toDownload.length; i++) {
+ if (!repo.contains(toDownload[i]))
+ return false;
+ }
+ return true;
+ }
+
+ //TODO We need to find a way to clean those caches. Maybe in response to a lifecycle post install.
+ private Manipulator getManipulator(Profile profile) throws CoreException {
+ File configurationFolder = getConfigurationFolder(profile);
+ File installFolder = getInstallFolder(profile);
+ Manipulator manipulator = (Manipulator) manipulatorMap.get(configurationFolder);
+ if (manipulator == null) {
+ manipulator = getFrameworkManipulator(profile);
+ if (manipulator != null) {
+ manipulatorMap.put(configurationFolder, manipulator);
+ } else
+ throw new CoreException(new Status(IStatus.ERROR, ID, "Could not acquire the framework manipulator service."));
+ }
+
+ Long lastModified = (Long) lastModifiedMap.get(configurationFolder);
+ if (lastModified == null || lastModified.longValue() < manipulator.getTimeStamp()) {
+ LauncherData launcherData = manipulator.getLauncherData();
+ launcherData.setFwConfigLocation(configurationFolder);
+ launcherData.setLauncher(new File(installFolder, getLauncherName(profile)));
+ try {
+ manipulator.load();
+ lastModifiedMap.put(configurationFolder, new Long(manipulator.getTimeStamp()));
+ } catch (IllegalStateException e2) {
+ // TODO if fwJar is not included, this exception will be thrown. But ignore it.
+ // e2.printStackTrace();
+ } catch (FrameworkAdminRuntimeException e2) {
+ // TODO Auto-generated catch block
+ e2.printStackTrace();
+ } catch (IOException e2) {
+ // TODO Auto-generated catch block
+ e2.printStackTrace();
+ }
+ }
+ return manipulator;
+ }
+
+ private boolean isZipped(TouchpointData[] data) {
+ if (data == null || data.length == 0)
+ return false;
+ for (int i = 0; i < data.length; i++) {
+ if (data[i].getInstructions("zipped") != null)
+ return true;
+ }
+ return false;
+ }
+
+ private IStatus configure(IInstallableUnit unit, Profile profile, boolean isInstall) {
+ if (unit.isFragment())
+ return Status.OK_STATUS;
+
+ // Construct and initialize the java script context
+ Context cx = Context.enter();
+ Scriptable scope = cx.initStandardObjects();
+
+ // Construct and wrap the manipulator for the configuration in the profile
+ Manipulator manipulator = null;
+ try {
+ manipulator = getManipulator(profile);
+ } catch (CoreException ce) {
+ return ce.getStatus();
+ }
+ //TODO These values should be inserted by a configuration unit (bug 204124)
+ manipulator.getConfigData().setFwDependentProp("eclipse.prov.profile", profile.getProfileId());
+ manipulator.getConfigData().setFwDependentProp("eclipse.prov.data.area", computeRelativeAgentLocation(profile));
+ Object wrappedOut = Context.javaToJS(manipulator, scope);
+ ScriptableObject.putProperty(scope, "manipulator", wrappedOut);
+
+ // Get the touchpoint data from the installable unit
+ TouchpointData[] touchpointData = unit.getTouchpointData();
+
+ boolean flag = false;
+ if (touchpointData.length > 0 && unit.getArtifacts() != null && unit.getArtifacts().length > 0) {
+ boolean zippedPlugin = isZipped(touchpointData);
+ boolean alreadyInCache = false;
+
+ //Always try to check in the cache first
+ IWritableArtifactRepository repoToCheck = getBundlePoolRepo(getBundlePoolLocation(profile));
+ IArtifactKey artifactKey = unit.getArtifacts()[0];
+ URI artifact = repoToCheck.getArtifact(artifactKey);
+ if (artifact != null) {
+ alreadyInCache = true;
+ } else if (zippedPlugin) {
+ repoToCheck = getDownloadCacheRepo();
+ artifact = repoToCheck.getArtifact(artifactKey);
+ }
+
+ // TODO: Needs fixing - See Bug 204161
+ File fileLocation = null;
+ if (artifact != null) {
+ fileLocation = new File(artifact);
+ if (!fileLocation.exists())
+ return new Status(IStatus.ERROR, ID, "The file is not available" + fileLocation.getAbsolutePath());
+ } else if (isInstall) {
+ return new Status(IStatus.ERROR, ID, "The artifact " + artifactKey.toString() + " to install has not been found.");
+ }
+
+ // TODO: Here we unzip the plug-in.This is ugly. We need to deal with addition into the plug-in cache
+ // TODO: Will we ever need to unzip in order to remove a bundle?
+ if (!alreadyInCache && zippedPlugin) {
+ if (isInstall) {
+ File extractionFolder = new File(getBundlePoolLocation(profile).getFile(), "/plugins/" + artifactKey.getId() + '_' + artifactKey.getVersion());
+ if (!extractionFolder.exists()) {
+ if (!extractionFolder.mkdir())
+ return new Status(IStatus.ERROR, ID, "can't create the folder: " + extractionFolder);
+ try {
+ FileUtils.unzipFile(fileLocation, extractionFolder.getParentFile());
+ } catch (IOException e) {
+ return new Status(IStatus.ERROR, ID, "can't extract " + fileLocation + " into the folder " + extractionFolder);
+ }
+ }
+ fileLocation = extractionFolder;
+ } else {
+ fileLocation = new File(new File(getBundlePoolLocation(profile).getFile()), "/plugins/" + artifactKey.getId() + '_' + artifactKey.getVersion());
+ }
+ //check if the target folder exists
+
+ //if it does then stop
+ //if it does not create the folder and extract the archive... Be careful here with the permissions.... We may need to have a proper unzip technology here that supports file permissions for linux
+ // request.getProfile().getValue(CACHE_PATH);
+ }
+ ScriptableObject.putProperty(scope, "artifact", fileLocation.getAbsolutePath());
+ BundleInfo bundle = new BundleInfo();
+ try {
+ bundle.setLocation(fileLocation.toURL().toExternalForm());
+ } catch (MalformedURLException e) {
+ // Ignore;
+ e.printStackTrace();
+ }
+ String[] manifestData = getInstructionsFor("manifest", touchpointData); //TODO Here we only take one set of manifest data
+ this.initFromManifest(manifestData[0], bundle);
+ ScriptableObject.putProperty(scope, (isInstall ? "bundleToInstall" : "bundleToRemove"), bundle);
+ }
+
+ String[] instructions = getInstructionsFor((isInstall ? CONFIGURATION_DATA : UNCONFIGURATION_DATA), touchpointData);
+ for (int i = 0; i < instructions.length; i++) {
+ logConfiguation(unit, instructions[i], isInstall);
+ try {
+ cx.evaluateString(scope, instructions[i], unit.getId(), 1, null);
+ flag = true;
+ //TODO Need to get the result of the operations
+ } catch (RuntimeException ex) {
+ return new Status(IStatus.ERROR, Activator.ID, "Exception while executing " + instructions[i], ex);
+ }
+ }
+
+ if (flag) {
+ try {
+ manipulator.save(false);
+ lastModifiedMap.put(getConfigurationFolder(profile), new Long(manipulator.getTimeStamp()));
+ } catch (FrameworkAdminRuntimeException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * Returns the agent location, if possible as a path relative to the configuration
+ * directory using the @config.dir substitution variable. AgentLocation will
+ * substitute this variable with the configuration folder location on startup.
+ * If the agent location is not a sub-directory of the configuration folder, this
+ * method simply returns the absolute agent location expressed as a URL.
+ */
+ private String computeRelativeAgentLocation(Profile profile) {
+ URL agentURL = getAgentLocation().getURL();
+ //TODO handle proper path/url conversion
+ IPath agentPath = new Path(agentURL.getPath());
+ IPath configPath = new Path(getConfigurationFolder(profile).getAbsolutePath());
+ if (configPath.isPrefixOf(agentPath))
+ return "@config.dir/" + agentPath.removeFirstSegments(configPath.segmentCount()).makeRelative().setDevice(null); //$NON-NLS-1$
+ return agentURL.toString();
+ }
+
+ public void initFromManifest(String manifest, BundleInfo bInfo) {
+ try {
+ bInfo.setManifest(manifest);
+ Headers headers = Headers.parseManifest(new ByteArrayInputStream(manifest.getBytes()));
+ ManifestElement[] element = ManifestElement.parseHeader("bsn", (String) headers.get(Constants.BUNDLE_SYMBOLICNAME));
+ bInfo.setSymbolicName(element[0].getValue());
+ bInfo.setVersion((String) headers.get(Constants.BUNDLE_VERSION));
+ } catch (BundleException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ private Manipulator getFrameworkManipulator(Profile profile) {
+ FrameworkAdmin fwAdmin = getFrameworkAdmin();
+ return fwAdmin == null ? null : fwAdmin.getManipulator();
+ }
+
+ private FrameworkAdmin getFrameworkAdmin() {
+ if (fwAdminTracker == null) {
+ Filter filter;
+ try {
+ filter = Activator.getContext().createFilter(filterFwAdmin);
+ fwAdminTracker = new ServiceTracker(Activator.getContext(), filter, null);
+ fwAdminTracker.open();
+ } catch (InvalidSyntaxException e) {
+ // never happens
+ e.printStackTrace();
+ }
+ }
+ return (FrameworkAdmin) fwAdminTracker.getService();
+ }
+
+ private String[] getInstructionsFor(String key, TouchpointData[] data) {
+ String[] matches = new String[data.length];
+ int count = 0;
+ for (int i = 0; i < data.length; i++) {
+ matches[count] = data[i].getInstructions(key);
+ if (matches[count] != null)
+ count++;
+ }
+ if (count == data.length)
+ return matches;
+ String[] result = new String[count];
+ System.arraycopy(matches, 0, result, 0, count);
+ return result;
+ }
+
+ public TouchpointType getTouchpointType() {
+ return new TouchpointType("eclipse", new Version("1.0")); //TODO this data probably needs to come from the XML
+ }
+
+ public boolean supports(String phaseID) { //TODO this data probably needs to come from the XML
+ return supportedPhases.contains(phaseID);
+ }
+
+ private File getInstallFolder(Profile profile) {
+ return new File(profile.getValue(Profile.PROP_INSTALL_FOLDER));
+ }
+
+ private File getConfigurationFolder(Profile profile) {
+ String config = profile.getValue(CONFIG_FOLDER);
+ if (config != null)
+ return new File(config);
+ return new File(getInstallFolder(profile), "configuration"); //$NON-NLS-1$
+ }
+
+ /**
+ * Returns the name of the Eclipse application launcher.
+ */
+ private String getLauncherName(Profile profile) {
+ String name = profile.getValue(FrameworkAdmin.SERVICE_PROP_KEY_LAUNCHER_NAME);
+ if (name != null)
+ return name;
+ //create a default name based on platform
+ //TODO Need a better solution for launcher name branding
+ EnvironmentInfo info = (EnvironmentInfo) ServiceHelper.getService(Activator.getContext(), EnvironmentInfo.class.getName());
+ if (info.getOS() == org.eclipse.osgi.service.environment.Constants.OS_WIN32)
+ return "eclipse.exe"; //$NON-NLS-1$
+ return "eclipse"; //$NON-NLS-1$
+ }
+
+ private IWritableArtifactRepository getBundlePoolRepo(URL location) {
+ IArtifactRepositoryManager manager = getArtifactRepositoryManager();
+ IArtifactRepository repository = manager.loadRepository(location, null);
+ if (repository != null) {
+ IWritableArtifactRepository result = (IWritableArtifactRepository) repository.getAdapter(IWritableArtifactRepository.class);
+ if (result != null)
+ return result;
+ throw new IllegalArgumentException("BundlePool repository not writeable: " + location); //$NON-NLS-1$
+ }
+ // the given repo location is not an existing repo so we have to create something
+ // TODO for now create a random repo by default.
+ String repositoryName = location + " - bundle pool"; //$NON-NLS-1$
+ IWritableArtifactRepository result = (IWritableArtifactRepository) manager.createRepository(location, repositoryName, "org.eclipse.equinox.prov.artifact.repository.simpleRepository");
+ return tagAsImplementation(result);
+ }
+
+ private IArtifactRepositoryManager getArtifactRepositoryManager() {
+ return (IArtifactRepositoryManager) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.class.getName());
+ }
+
+ private IWritableArtifactRepository getDownloadCacheRepo() {
+ IArtifactRepositoryManager manager = getArtifactRepositoryManager();
+ URL location = getDownloadCacheLocation();
+ IArtifactRepository repository = manager.loadRepository(location, null);
+ if (repository != null) {
+ IWritableArtifactRepository result = (IWritableArtifactRepository) repository.getAdapter(IWritableArtifactRepository.class);
+ if (result != null)
+ return result;
+ throw new IllegalArgumentException("Agent download cache not writeable: " + location); //$NON-NLS-1$
+ }
+ // the given repo location is not an existing repo so we have to create something
+ // TODO for now create a random repo by default.
+ String repositoryName = location + " - Agent download cache"; //$NON-NLS-1$
+ IWritableArtifactRepository result = (IWritableArtifactRepository) manager.createRepository(location, repositoryName, "org.eclipse.equinox.prov.artifact.repository.simpleRepository");
+ return tagAsImplementation(result);
+ }
+
+ static private URL getDownloadCacheLocation() {
+ AgentLocation location = getAgentLocation();
+ return (location != null ? location.getArtifactRepositoryURL() : null);
+ }
+
+ // TODO: Will there be other repositories to tag as implementation? Should this
+ // method to some utility?
+ static private IWritableArtifactRepository tagAsImplementation(IWritableArtifactRepository repository) {
+ // if (repository != null && repository.getProperties().getProperty(IRepositoryInfo.IMPLEMENTATION_ONLY_KEY) == null) {
+ // IWritableRepositoryInfo writableInfo = (IWritableRepositoryInfo) repository.getAdapter(IWritableRepositoryInfo.class);
+ // if (writableInfo != null) {
+ // writableInfo.getModifiableProperties().setProperty(IRepositoryInfo.IMPLEMENTATION_ONLY_KEY, Boolean.valueOf(true).toString());
+ // }
+ // }
+ return repository;
+ }
+
+ private void logConfiguation(IInstallableUnit unit, String instructions, boolean isInstall) {
+ // TODO: temporary for debugging; replace by logging
+ if (DEBUG) {
+ System.out.print("[" + iuCount + "] ");
+ if (isInstall) {
+ System.out.println("Installing " + unit + " with: " + instructions);
+ } else {
+ System.out.println("Uninstalling " + unit + " with: " + instructions);
+ }
+ iuCount++;
+ }
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/.classpath b/bundles/org.eclipse.equinox.p2.touchpoint.natives/.classpath
new file mode 100644
index 000000000..7cdeb7319
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/CDC-1.1%Foundation-1.1"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/.project b/bundles/org.eclipse.equinox.p2.touchpoint.natives/.project
new file mode 100644
index 000000000..1d3f5d6a5
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.equinox.prov.touchpoint.natives</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.touchpoint.natives/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..78523cd05
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,331 @@
+#Thu Aug 16 11:00:59 EDT 2007
+eclipse.preferences.version=1
+org.eclipse.jdt.core.builder.cleanOutputFolder=clean
+org.eclipse.jdt.core.builder.duplicateResourceTask=warning
+org.eclipse.jdt.core.builder.invalidClasspath=abort
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
+org.eclipse.jdt.core.circularClasspath=error
+org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
+org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=error
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=false
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false
+org.eclipse.jdt.core.formatter.comment.format_line_comments=false
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=800
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.incompatibleJDKLevel=ignore
+org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.p2.touchpoint.natives/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 000000000..6eacd08fa
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,57 @@
+#Sun Sep 23 11:59:07 EDT 2007
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_core
+formatter_settings_version=11
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=;
+org.eclipse.jdt.ui.ondemandthreshold=3
+org.eclipse.jdt.ui.staticondemandthreshold=3
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates/>
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.format_source_code=true
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_variable_declarations_final=true
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=false
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/.settings/org.eclipse.pde.core.prefs b/bundles/org.eclipse.equinox.p2.touchpoint.natives/.settings/org.eclipse.pde.core.prefs
new file mode 100644
index 000000000..7913d20db
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/.settings/org.eclipse.pde.core.prefs
@@ -0,0 +1,4 @@
+
+eclipse.preferences.version=1
+pluginProject.extensions=false
+resolve.requirebundle=false
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.touchpoint.natives/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..62a2bcc44
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/META-INF/MANIFEST.MF
@@ -0,0 +1,22 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Native Adatpor Plug-in (Incubation)
+Bundle-SymbolicName: org.eclipse.equinox.prov.touchpoint.natives;singleton:=true
+Bundle-Version: 0.1.0.qualifier
+Bundle-Activator: org.eclipse.equinox.internal.prov.touchpoint.natives.Activator
+Import-Package: org.eclipse.equinox.prov.artifact.repository,
+ org.eclipse.equinox.prov.core.helpers,
+ org.eclipse.equinox.prov.core.location,
+ org.eclipse.equinox.prov.core.repository,
+ org.eclipse.equinox.prov.download,
+ org.eclipse.equinox.prov.engine,
+ org.eclipse.equinox.prov.metadata,
+ org.eclipse.osgi.service.datalocation;version="1.0.0",
+ org.eclipse.osgi.util;version="1.0.0",
+ org.mozilla.javascript,
+ org.osgi.framework;version="1.3.0",
+ org.osgi.util.tracker;version="1.3.3"
+Eclipse-LazyStart: true
+Require-Bundle: org.eclipse.equinox.common
+Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
+ J2SE-1.4
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/about.html b/bundles/org.eclipse.equinox.p2.touchpoint.natives/about.html
new file mode 100644
index 000000000..460233046
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 2, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/build.properties b/bundles/org.eclipse.equinox.p2.touchpoint.natives/build.properties
new file mode 100644
index 000000000..8917af773
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/build.properties
@@ -0,0 +1,16 @@
+###############################################################################
+# Copyright (c) 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ about.html
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/plugin.xml b/bundles/org.eclipse.equinox.p2.touchpoint.natives/plugin.xml
new file mode 100644
index 000000000..12d7e399e
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/plugin.xml
@@ -0,0 +1,8 @@
+<plugin>
+ <extension point="org.eclipse.equinox.prov.engine.touchpoints" id="native" name="Native Touchpoint">
+ <touchpoint
+ type="native"
+ class="org.eclipse.equinox.internal.prov.touchpoint.natives.NativeTouchpoint"
+ version="1.0.0"/>
+ </extension>
+</plugin>
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/prov/touchpoint/natives/Activator.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/prov/touchpoint/natives/Activator.java
new file mode 100644
index 000000000..07ab96fb5
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/prov/touchpoint/natives/Activator.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.touchpoint.natives;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+ public static final String ID = "org.eclipse.equinox.prov.touchpoint.native"; //$NON-NLS-1$
+ private static BundleContext context = null;
+
+ public static BundleContext getContext() {
+ return context;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext aContext) throws Exception {
+ Activator.context = aContext;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext aContext) throws Exception {
+ context = null;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/prov/touchpoint/natives/BackupFiles.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/prov/touchpoint/natives/BackupFiles.java
new file mode 100644
index 000000000..7c47ebb7b
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/prov/touchpoint/natives/BackupFiles.java
@@ -0,0 +1,319 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.touchpoint.natives;
+
+import java.io.*;
+import java.net.URL;
+import java.util.*;
+import java.util.zip.*;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.equinox.prov.core.helpers.FileUtils;
+import org.eclipse.osgi.util.NLS;
+
+public class BackupFiles {
+
+ private static final String ZIP_SUFFIX = ".zip"; //$NON-NLS-1$
+ private static final String PROPERTIES_SUFFIX = ".properties"; //$NON-NLS-1$
+
+ private final File backupDir;
+ private boolean doBackup;
+
+ /**
+ * Save or restore backups of files in backupDir
+ */
+ public BackupFiles(File backupDir) {
+ this.doBackup = true;
+ this.backupDir = backupDir;
+ this.backupDir.mkdirs();
+ }
+
+ // /**
+ // * If doBackup is set to false, files are deleted on uninstall, instead of restored.
+ // */
+ // public void setDoBackup(boolean doBackup) {
+ // this.doBackup = doBackup;
+ // }
+
+ /**
+ * Restore all backups made in this dir.
+ */
+ public void restore(IProgressMonitor monitor) throws IOException {
+ // find backup properties files, do in reverse order
+ List propsFiles = new LinkedList();
+ for (int i = 0;; i += 1) {
+ File propsFile = getBackupProperties(i);
+ if (!propsFile.exists()) {
+ break;
+ }
+ propsFiles.add(0, propsFile);
+ }
+ IProgressMonitor[] pm = Util.splitProgressMonitor(monitor, propsFiles.size());
+ int j = 0;
+ for (Iterator i = propsFiles.iterator(); i.hasNext();) {
+ File propsFile = (File) i.next();
+ restoreFilesFromBackup(propsFile, pm[j++]);
+ }
+ if (!this.backupDir.delete()) {
+ //not empty? log a warning?
+ } else {
+ // delete the parent if empty
+ this.backupDir.getParentFile().delete();
+ }
+ monitor.done();
+ }
+
+ /**
+ * Find files under outputDir that will be overwritten in unzipURL
+ * and save under backupDir, and delete.
+ * Include properties file to indicate files to delete or restore on rolled back.
+ * The progress monitor is used only to display sub-tasks; we don't update it otherwise.
+ */
+ public void backupFilesInZip(String identifier, URL zipURL, File outputDir, IProgressMonitor monitor) throws IOException {
+ BackupProperties backupProps = new BackupProperties(identifier, outputDir);
+ ZipOutputStream zos = null;
+ String prevDir = null;
+ try {
+ ZipInputStream in = new ZipInputStream(zipURL.openStream());
+ ZipEntry ze;
+ while ((ze = in.getNextEntry()) != null) {
+ String name = ze.getName();
+ int i = name.lastIndexOf('/');
+ if (i != -1) {
+ String dir = name.substring(0, i);
+ if (this.doBackup && !dir.equals(prevDir)) {
+ monitor.subTask(name.substring(0, i));
+ prevDir = dir;
+ }
+ }
+ if (!ze.isDirectory()) {
+ File origFile = new File(outputDir, name);
+ if (this.doBackup && origFile.exists()) {
+ if (zos == null) {
+ File zipFile = backupProps.getArchive();
+ zos = new ZipOutputStream(new FileOutputStream(zipFile));
+ }
+ ZipEntry zipEntry = new ZipEntry(name);
+ zipEntry.setTime(origFile.lastModified());
+ zos.putNextEntry(zipEntry);
+ FileUtils.copyStream(new FileInputStream(origFile), true, zos, false);
+ zos.closeEntry();
+ } else {
+ backupProps.addFileToDelete(name);
+ }
+ origFile.delete();
+ }
+ in.closeEntry();
+ }
+ in.close();
+ } finally {
+ backupProps.store();
+ if (zos != null) {
+ zos.close();
+ }
+ }
+ }
+
+ private void restoreFilesFromBackup(File propsFile, IProgressMonitor monitor) throws IOException {
+ BackupProperties backupProps = new BackupProperties(propsFile);
+ monitor.beginTask(NLS.bind(Messages.restoring, propsFile.toString()), 3);
+ monitor.subTask("");
+ for (Iterator i = backupProps.getFilesToDelete().iterator(); i.hasNext();) {
+ String name = (String) i.next();
+ File full = new File(backupProps.getRootDir(), name);
+ full.delete();
+ }
+ monitor.worked(1);
+ File zipFile = backupProps.getArchive();
+ if (zipFile.exists()) { // only exists if files were saved
+ SubProgressMonitor sub = new SubProgressMonitor(monitor, 1, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK);
+ FileUtils.unzipFile(zipFile, backupProps.getRootDir(), "", sub);
+ zipFile.delete();
+ } else {
+ monitor.worked(1);
+ }
+ for (Iterator i = backupProps.getDirsToDelete().iterator(); i.hasNext();) {
+ String name = (String) i.next();
+ File full = new File(backupProps.getRootDir(), name);
+ FileUtils.deleteEmptyDirs(full);
+ }
+ propsFile.delete();
+ monitor.worked(1);
+ monitor.done();
+ }
+
+ // Backup files are just 0.properties, 1.properties, etc.
+ // Get the next unused one.
+ private File getBackupProperties() {
+ for (int i = 0;; i += 1) {
+ File result = getBackupProperties(i);
+ if (!result.exists())
+ return result;
+ }
+ }
+
+ private File getBackupProperties(int i) {
+ return new File(BackupFiles.this.backupDir, Integer.toString(i) + PROPERTIES_SUFFIX);
+ }
+
+ private class BackupProperties extends Properties {
+ private static final long serialVersionUID = 2268313492348533029L;
+ private static final char FILE_KIND = 'f';
+ private static final char DIR_KIND = 'd';
+ private static final String ROOT_DIR = "rootDir"; //$NON-NLS-1$
+ private static final String ARTIFACT_KEY = "artifactKey"; //$NON-NLS-1$
+ // private static final String ARTIFACT_USER = "artifactUser"; //$NON-NLS-1$
+
+ private int n = 0; // number of properties
+ private File file; // file to store properties in
+ private List keys = new LinkedList(); // keys, in order they were added or read
+ private final File rootDir; // root of where files are going
+ private Set dirsToCreate = new TreeSet(); // set of dirs we will create
+
+ // create properties based on file we are backing up to
+ public BackupProperties(String identifier, File rootDir) {
+ this.file = BackupFiles.this.getBackupProperties();
+ this.rootDir = rootDir;
+ setProperty(ROOT_DIR, rootDir.getPath().replace('\\', '/'));
+ setProperty(ARTIFACT_KEY, (identifier != null ? identifier : rootDir.getAbsolutePath()));
+ // setProperty(ARTIFACT_USER, artifact.toUserString());
+ // make sure rootDir is deleted if appropriate
+ addDir("./"); //$NON-NLS-1$
+ }
+
+ // create backup properties from a previously saved BackupProperties
+ public BackupProperties(File file) throws IOException {
+ this.file = file;
+ FileInputStream stream = new FileInputStream(file);
+ try {
+ load(stream);
+ } finally {
+ stream.close();
+ }
+ this.rootDir = new File(getProperty(ROOT_DIR));
+ }
+
+ // public String getArtifactKey() {
+ // return getProperty(ARTIFACT_KEY);
+ // }
+
+ // public String getArtifactUserString() {
+ // String result = getProperty(ARTIFACT_USER);
+ // if (result != null) {
+ // return result;
+ // } else {
+ // // return something if the key wasn't saved
+ // result = getArtifactKey();
+ // result = result.replaceFirst(",native,", ","); //$NON-NLS-1$ //$NON-NLS-2$
+ // return result.replace(',', ' ').trim();
+ // }
+ // }
+
+ public File getRootDir() {
+ return this.rootDir;
+ }
+
+ // We are backing up files for this artifact.
+ // Create a backup zip based on the artifact key (as a hint).
+ public File getArchive() {
+ String path = this.file.getPath();
+ if (path.endsWith(PROPERTIES_SUFFIX)) {
+ path = path.substring(0, path.length() - PROPERTIES_SUFFIX.length());
+ }
+ return new File(path + ZIP_SUFFIX);
+ }
+
+ public List getFilesToDelete() {
+ return getMatchingProperties(FILE_KIND);
+ }
+
+ public List getDirsToDelete() {
+ return getMatchingProperties(DIR_KIND);
+ }
+
+ private List getMatchingProperties(char c) {
+ List result = new LinkedList();
+ for (Enumeration e = propertyNames(); e.hasMoreElements();) {
+ String key = (String) e.nextElement();
+ if (key.equals(BackupProperties.ROOT_DIR)) {
+ continue;
+ }
+ if (key.charAt(0) == c) {
+ result.add(getProperty(key));
+ }
+ }
+ return result;
+ }
+
+ public void addFileToDelete(String name) {
+ add(FILE_KIND, name);
+ addDir(name);
+ }
+
+ public void store() throws IOException {
+ // add the directories -- at end because we want them all in order
+ for (Iterator i = this.dirsToCreate.iterator(); i.hasNext();) {
+ String name = (String) i.next();
+ add(DIR_KIND, name);
+ }
+ FileOutputStream stream = new FileOutputStream(this.file);
+ try {
+ store(stream, /*header*/null);
+ } finally {
+ stream.close();
+ }
+ }
+
+ public Object put(Object key, Object value) {
+ if (!(key instanceof String))
+ throw new AssertionError("expected String: " + key); //$NON-NLS-1$
+ if (!(value instanceof String))
+ throw new AssertionError("expected String: " + value); //$NON-NLS-1$
+ this.keys.add(key);
+ return super.put(key, value);
+ }
+
+ // return keys in the order they were added
+ public synchronized Enumeration keys() {
+ final Iterator iterator = this.keys.iterator();
+ return new Enumeration() {
+ public boolean hasMoreElements() {
+ return iterator.hasNext();
+ }
+
+ public Object nextElement() {
+ return iterator.next();
+ }
+ };
+ }
+
+ private void add(char kind, String name) {
+ StringBuffer key = new StringBuffer(4);
+ key.append(kind).append(n++);
+ setProperty(key.toString(), name.replace('\\', '/'));
+ }
+
+ // if we're going to create this dir, remember that so we delete it
+ private void addDir(String name) {
+ int slash = name.lastIndexOf('/');
+ if (slash == -1)
+ return; // no dir
+ String dirName = name.substring(0, slash);
+ if (this.dirsToCreate.contains(dirName))
+ return; // already have it
+ if (new File(this.rootDir, dirName).exists())
+ return; // already exists
+ this.dirsToCreate.add(dirName);
+ }
+
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/prov/touchpoint/natives/Messages.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/prov/touchpoint/natives/Messages.java
new file mode 100644
index 000000000..acc98cd94
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/prov/touchpoint/natives/Messages.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.touchpoint.natives;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.equinox.internal.prov.touchpoint.natives.messages"; //$NON-NLS-1$
+
+ static {
+ // load message values from bundle file and assign to fields below
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ public static String unzipping;
+ public static String restoring;
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/prov/touchpoint/natives/NativeTouchpoint.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/prov/touchpoint/natives/NativeTouchpoint.java
new file mode 100644
index 000000000..0db12daa0
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/prov/touchpoint/natives/NativeTouchpoint.java
@@ -0,0 +1,178 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.touchpoint.natives;
+
+import java.io.File;
+import java.net.URL;
+import java.util.HashSet;
+import java.util.Set;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.prov.artifact.repository.*;
+import org.eclipse.equinox.prov.core.helpers.ServiceHelper;
+import org.eclipse.equinox.prov.core.location.AgentLocation;
+import org.eclipse.equinox.prov.engine.*;
+import org.eclipse.equinox.prov.metadata.*;
+import org.mozilla.javascript.*;
+import org.osgi.framework.Version;
+
+public class NativeTouchpoint implements ITouchpoint {
+ private final static String CONFIGURATION_DATA = "configurationData";
+ private static final String ID = "org.eclipse.equinox.prov.touchpoint.natives"; //$NON-NLS-1$
+
+ private final Set supportedPhases = new HashSet(); //TODO This should probably come from XML
+ {
+ supportedPhases.add("collect");
+ supportedPhases.add("install");
+ supportedPhases.add("uninstall");
+ }
+
+ public boolean supports(String phaseId) {
+ return supportedPhases.contains(phaseId);
+ }
+
+ public ITouchpointAction[] getActions(String phaseID, final Profile profile, final Operand operand) {
+ if (phaseID.equals("collect")) {
+ ITouchpointAction action = new ITouchpointAction() {
+ public Object execute() {
+ return collect(operand.second(), profile);
+ }
+
+ public Object undo() {
+ return null;
+ }
+ };
+ return new ITouchpointAction[] {action};
+ }
+
+ if (phaseID.equals("install")) {
+ ITouchpointAction action = new ITouchpointAction() {
+ public Object execute() {
+ return doInstall(operand.second(), profile);
+ }
+
+ public Object undo() {
+ return doUninstall(operand.second(), profile);
+ }
+ };
+ return new ITouchpointAction[] {action};
+ }
+ if (phaseID.equals("uninstall")) {
+ ITouchpointAction action = new ITouchpointAction() {
+ public Object execute() {
+ return doUninstall(operand.first(), profile);
+ }
+
+ public Object undo() {
+ return doInstall(operand.first(), profile);
+ }
+ };
+ return new ITouchpointAction[] {action};
+ }
+
+ throw new IllegalStateException("The phase: " + phaseID + "should not have been dispatched here.");
+ }
+
+ private IStatus doInstall(IInstallableUnit unitToInstall, Profile profile) {
+ //Get the cache
+ IArtifactRepository dlCache = getDownloadCacheRepo();
+ if (unitToInstall.getArtifacts() == null || unitToInstall.getArtifacts().length == 0)
+ return Status.OK_STATUS;
+
+ File fileLocation = new File(dlCache.getArtifact(unitToInstall.getArtifacts()[0]));
+ if (!fileLocation.exists())
+ return new Status(IStatus.ERROR, ID, "The file is not available" + fileLocation.getAbsolutePath());
+
+ TouchpointData[] touchpointData = unitToInstall.getTouchpointData();
+ Context cx = Context.enter();
+ Scriptable scope = cx.initStandardObjects();
+ ScriptableObject.putProperty(scope, "artifact", fileLocation.getAbsolutePath());
+ ScriptableObject.putProperty(scope, "currentDir", getInstallFolder(profile));
+ ScriptableObject.putProperty(scope, "Zip", new Zip());
+ ScriptableObject.putProperty(scope, "Permissions", new Permissions());
+ String[] configurationData = getInstructionsFor(CONFIGURATION_DATA, touchpointData);
+ for (int i = 0; i < configurationData.length; i++) {
+ try {
+ cx.evaluateString(scope, configurationData[i], unitToInstall.getId(), 1, null);
+ } catch (RuntimeException e) {
+ return new Status(IStatus.ERROR, Activator.ID, "Exception while executing " + configurationData[i], e);
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ private IStatus doUninstall(IInstallableUnit unitToInstall, Profile profile) {
+ // TODO: implement uninstall
+ return Status.OK_STATUS;
+ }
+
+ private String[] getInstructionsFor(String key, TouchpointData[] data) {
+ String[] matches = new String[data.length];
+ int count = 0;
+ for (int i = 0; i < data.length; i++) {
+ matches[count] = data[i].getInstructions(key);
+ if (matches[count] != null)
+ count++;
+ }
+ if (count == data.length)
+ return matches;
+ String[] result = new String[count];
+ System.arraycopy(matches, 0, result, 0, count);
+ return result;
+ }
+
+ public TouchpointType getTouchpointType() {
+ return new TouchpointType("native", new Version(1, 0, 0));
+ }
+
+ private IArtifactRequest[] collect(IInstallableUnit installableUnit, Profile profile) {
+ IWritableArtifactRepository destination = getDownloadCacheRepo();
+ IArtifactKey[] toDownload = installableUnit.getArtifacts();
+ if (toDownload == null)
+ return new IArtifactRequest[0];
+ IArtifactRequest[] requests = new IArtifactRequest[toDownload.length];
+ int count = 0;
+ for (int i = 0; i < toDownload.length; i++) {
+ //TODO Here there are cases where the download is not necessary again because what needs to be done is just a configuration step
+ requests[count++] = getArtifactRepositoryManager().createMirrorRequest(toDownload[i], destination);
+ }
+
+ if (requests.length == count)
+ return requests;
+ IArtifactRequest[] result = new IArtifactRequest[count];
+ System.arraycopy(requests, 0, result, 0, count);
+ return result;
+ }
+
+ private String getInstallFolder(Profile profile) {
+ return profile.getValue(Profile.PROP_INSTALL_FOLDER);
+ }
+
+ private IArtifactRepositoryManager getArtifactRepositoryManager() {
+ return (IArtifactRepositoryManager) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.class.getName());
+ }
+
+ private IWritableArtifactRepository getDownloadCacheRepo() {
+ IArtifactRepository repo = getArtifactRepositoryManager().getRepository(getDownloadCacheLocation());
+ IWritableArtifactRepository result = (IWritableArtifactRepository) repo.getAdapter(IWritableArtifactRepository.class);
+ if (result == null)
+ throw new IllegalStateException("Download cache is not writable: " + repo.getLocation()); //$NON-NLS-1$
+ return result;
+ }
+
+ private URL getDownloadCacheLocation() {
+ AgentLocation location = (AgentLocation) ServiceHelper.getService(Activator.getContext(), AgentLocation.class.getName());
+ if (location == null)
+ return null;
+ return location.getArtifactRepositoryURL();
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/prov/touchpoint/natives/Permissions.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/prov/touchpoint/natives/Permissions.java
new file mode 100644
index 000000000..ab3f06e80
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/prov/touchpoint/natives/Permissions.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat Incorporated
+ * 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:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.touchpoint.natives;
+
+import java.io.IOException;
+import org.eclipse.core.runtime.IPath;
+
+public class Permissions {
+ public void chmod(String targetDir, String targetFile, String perms) {
+ Runtime r = Runtime.getRuntime();
+ try {
+ r.exec("chmod " + perms + " " + targetDir + IPath.SEPARATOR + targetFile);
+ } catch (IOException e) {
+ // FIXME: we should probably throw some sort of error here
+ }
+ }
+
+ public void chmod(String target, String targetFile, int perms) {
+ chmod(target, targetFile, Integer.toString(perms));
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/prov/touchpoint/natives/Util.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/prov/touchpoint/natives/Util.java
new file mode 100644
index 000000000..bb474964d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/prov/touchpoint/natives/Util.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.touchpoint.natives;
+
+import org.eclipse.core.runtime.*;
+
+public class Util {
+
+ public static void log(String msg) {
+ log(new Status(IStatus.OK, Activator.ID, IStatus.OK, msg, null));
+ }
+
+ public static void log(IStatus status) {
+ System.out.println(Util.class.getName() + " " + status);
+ }
+
+ public static CoreException coreException(String msg) {
+ return new CoreException(errorStatus(msg, null));
+ }
+
+ public static CoreException coreException(Throwable e, String msg) {
+ return new CoreException(errorStatus(msg, e));
+ }
+
+ public static IStatus errorStatus(String msg, Throwable e) {
+ return new Status(IStatus.ERROR, Activator.ID, IStatus.OK, msg, e);
+ }
+
+ /**
+ * Split monitor into n equal sub-monitors and return them.
+ * This calls beginTask on monitor and assigns all its time to the sub-monitors.
+ * monitor may be null.
+ */
+ public static IProgressMonitor[] splitProgressMonitor(IProgressMonitor monitor, int n) {
+ if (monitor == null || monitor instanceof NullProgressMonitor) {
+ monitor = null;
+ } else {
+ monitor.beginTask("", n);
+ }
+ IProgressMonitor[] result = new IProgressMonitor[n];
+ for (int i = 0; i < n; i += 1) {
+ result[i] = createSubProgressMonitor(monitor, 1);
+ }
+ return result;
+ }
+
+ private static IProgressMonitor createSubProgressMonitor(IProgressMonitor monitor, int ticks) {
+ if (monitor == null)
+ return new NullProgressMonitor();
+ else
+ return new SubProgressMonitor(monitor, ticks, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK);
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/prov/touchpoint/natives/Zip.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/prov/touchpoint/natives/Zip.java
new file mode 100644
index 000000000..979919647
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/prov/touchpoint/natives/Zip.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.prov.touchpoint.natives;
+
+import java.io.File;
+import java.io.IOException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.equinox.prov.core.helpers.FileUtils;
+import org.eclipse.osgi.util.NLS;
+
+//TODO Be careful here with the permissions.... We may need to have a proper unzip technology here that supports file permissions for linux
+public class Zip {
+ public void unzip(String source, String destination, String backupDir) {
+ // IArtifact artifact = data.getArtifact();
+ // String destination = performVariableSubstitutions(data.getDestination());
+ // if (canInstallArtifact()) {
+ //TODO if artifact has isExploded==true should pass in progress monitor
+ // for unzipping
+ File zipFile = new File(source);
+ if (zipFile == null || !zipFile.exists()) {
+ // internal error?
+ System.out.println(this.getClass().getName() + " the files to be unzipped is not here");
+ // throw Util.coreException(null, NLS.bind(Messages.failed_to_download_artifact, source));
+ }
+
+ // IProgressMonitor[] pm = new SplitProgressMonitor(new NullProgressMonitor(), 2);
+ // IProgressMonitor backupPM = pm[0];
+ // IProgressMonitor unzipPM = pm[1];
+ try {
+ // Set Destination location
+ // Path destPath = new Path(destination);
+ // if (destPath.isAbsolute()) {
+ // destinationDir = destPath.toFile();
+ // } else {
+ // destinationDir = new File(getLocation(Profile.INSTALL_LOCATION));
+ // if (!destination.equals(".")) { //$NON-NLS-1$
+ // destinationDir = new File(destinationDir, destination);
+ // }
+ // }
+
+ if (backupDir != null) {
+ try {
+ // backupPM.beginTask(Messages.backing_up, 1);
+ BackupFiles backupFiles = new BackupFiles(new File(backupDir));
+ backupFiles.backupFilesInZip(backupDir, zipFile.toURL(), new File(destination), null);
+ } catch (IOException e) {
+ System.out.println(this.getClass().getName() + " something went wrong when bakcing up the files");
+ // throw Util.coreException(e, NLS.bind(Messages.error_backing_up, zipFile));
+ } finally {
+ // backupPM.done();
+ }
+ }
+ try {
+ String taskName = NLS.bind(Messages.unzipping, source);
+ FileUtils.unzipFile(zipFile, new File(destination), taskName, new NullProgressMonitor());
+ } catch (IOException e) {
+ System.out.println(this.getClass().getName() + " something went wrong when unzipping");
+ // throw Util.coreException(e.getMessage());
+ } finally {
+ // unzipPM.done();
+ }
+ } finally {
+ // monitor.done();
+ }
+ // }
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/prov/touchpoint/natives/messages.properties b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/prov/touchpoint/natives/messages.properties
new file mode 100644
index 000000000..15e212e95
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/prov/touchpoint/natives/messages.properties
@@ -0,0 +1,18 @@
+###############################################################################
+# Copyright (c) 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+
+# NativeInstallAdapter
+restoring=Restoring {0}
+
+# Util
+unzipping=Extracting {0}
+
+
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin.rcp/.classpath b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/.classpath
new file mode 100644
index 000000000..ce7393340
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin.rcp/.cvsignore b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/.cvsignore
new file mode 100644
index 000000000..c5e82d745
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/.cvsignore
@@ -0,0 +1 @@
+bin \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin.rcp/.project b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/.project
new file mode 100644
index 000000000..064dd1a5c
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.equinox.prov.ui.admin.rcp</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin.rcp/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..78523cd05
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,331 @@
+#Thu Aug 16 11:00:59 EDT 2007
+eclipse.preferences.version=1
+org.eclipse.jdt.core.builder.cleanOutputFolder=clean
+org.eclipse.jdt.core.builder.duplicateResourceTask=warning
+org.eclipse.jdt.core.builder.invalidClasspath=abort
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
+org.eclipse.jdt.core.circularClasspath=error
+org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
+org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=error
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=false
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false
+org.eclipse.jdt.core.formatter.comment.format_line_comments=false
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=800
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.incompatibleJDKLevel=ignore
+org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin.rcp/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 000000000..b85a3687d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,57 @@
+#Sun Sep 23 11:59:25 EDT 2007
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_core
+formatter_settings_version=11
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=;
+org.eclipse.jdt.ui.ondemandthreshold=3
+org.eclipse.jdt.ui.staticondemandthreshold=3
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates/>
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.format_source_code=true
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_variable_declarations_final=true
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=false
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin.rcp/.settings/org.eclipse.pde.core.prefs b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/.settings/org.eclipse.pde.core.prefs
new file mode 100644
index 000000000..0d1ef4bc1
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/.settings/org.eclipse.pde.core.prefs
@@ -0,0 +1,3 @@
+#Thu Jul 26 19:13:12 EDT 2007
+eclipse.preferences.version=1
+resolve.requirebundle=false
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin.rcp/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..f14bd06ee
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/META-INF/MANIFEST.MF
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %bundleName
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Bundle-SymbolicName: org.eclipse.equinox.prov.ui.admin.rcp; singleton:=true
+Bundle-Version: 0.1.0.qualifier
+Bundle-Activator: org.eclipse.equinox.prov.ui.admin.rcp.Activator
+Bundle-RequiredExecutionEnvironment: J2SE-1.4,
+ CDC-1.1/Foundation-1.1
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime
+Eclipse-LazyStart: true
+Import-Package: org.eclipse.equinox.prov.ui.admin
+Export-Package: org.eclipse.equinox.prov.ui.admin.rcp,
+ org.eclipse.equinox.prov.ui.admin.rcp.internal;x-internal:=true
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin.rcp/ProvAdminUI.launch b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/ProvAdminUI.launch
new file mode 100644
index 000000000..0ac80976a
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/ProvAdminUI.launch
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<launchConfiguration type="org.eclipse.pde.ui.EquinoxLauncher">
+<booleanAttribute key="append.args" value="true"/>
+<booleanAttribute key="automaticAdd" value="false"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="true"/>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/ProvAdminUI"/>
+<booleanAttribute key="default_auto_start" value="false"/>
+<intAttribute key="default_start_level" value="4"/>
+<booleanAttribute key="includeOptional" value="false"/>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -console -consolelog -product org.eclipse.equinox.prov.ui.admin.rcp.product"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Declipse.prov.data.area=d:/tmp/equinox.prov/agentData/"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<stringAttribute key="target_bundles" value="com.ibm.icu@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.databinding@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.runtime@default:default,org.eclipse.equinox.app@default:true,org.eclipse.equinox.common@default:default,org.eclipse.equinox.launcher@default:default,org.eclipse.equinox.launcher.win32.win32.x86@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.help@default:default,org.eclipse.jface@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.osgi.services@default:default,org.eclipse.swt@default:default,org.eclipse.swt.win32.win32.x86@default:default,org.eclipse.ui@default:default,org.eclipse.ui.workbench@default:default"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useDefaultConfigArea" value="true"/>
+<stringAttribute key="workspace_bundles" value="com.thoughtworks.xstream@default:default,org.eclipse.ecf@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.ecf.provider.filetransfer@default:default,org.eclipse.equinox.frameworkadmin@default:default,org.eclipse.equinox.frameworkadmin.equinox@default:true,org.eclipse.equinox.prov.artifact.repository@default:default,org.eclipse.equinox.prov.console@default:true,org.eclipse.equinox.prov.core@default:default,org.eclipse.equinox.prov.director@default:default,org.eclipse.equinox.prov.download@default:default,org.eclipse.equinox.prov.engine@default:default,org.eclipse.equinox.prov.examplarysetup@default:true,org.eclipse.equinox.prov.metadata@default:default,org.eclipse.equinox.prov.metadata.repository@default:default,org.eclipse.equinox.prov.touchpoint.eclipse@default:default,org.eclipse.equinox.prov.touchpoint.natives@default:default,org.eclipse.equinox.prov.ui@default:default,org.eclipse.equinox.prov.ui.admin@default:default,org.eclipse.equinox.prov.ui.admin.rcp@default:default,org.eclipse.equinox.prov.ui.sdk@default:default,org.eclipse.equinox.simpleconfigurator@default:true,org.eclipse.equinox.simpleconfigurator.manipulator@default:default,org.eclipse.osgi@:,org.mozilla.rhino@default:default"/>
+</launchConfiguration>
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin.rcp/about.html b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/about.html
new file mode 100644
index 000000000..460233046
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 2, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin.rcp/build.properties b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/build.properties
new file mode 100644
index 000000000..35011865d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/build.properties
@@ -0,0 +1,21 @@
+###############################################################################
+# Copyright (c) 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+bin.includes = plugin.properties,\
+ icons/,\
+ .,\
+ plugin.xml,\
+ about.html,\
+ META-INF/
+src.includes = about.html
+source.. = src/
+
+
+
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin.rcp/config.ini b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/config.ini
new file mode 100644
index 000000000..c3e1629ad
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/config.ini
@@ -0,0 +1,49 @@
+osgi.bundles=\
+ com.ibm.icu,\
+ com.thoughtworks.xstream,\
+ org.eclipse.core.commands,\
+ org.eclipse.core.contenttype,\
+ org.eclipse.core.databinding,\
+ org.eclipse.core.expressions,\
+ org.eclipse.core.jobs,\
+ org.eclipse.core.runtime,\
+ org.eclipse.ecf,\
+ org.eclipse.ecf.filetransfer,\
+ org.eclipse.ecf.identity,\
+ org.eclipse.ecf.provider.filetransfer,\
+ org.eclipse.equinox.app@start,\
+ org.eclipse.equinox.common,\
+ org.eclipse.equinox.frameworkadmin,\
+ org.eclipse.equinox.frameworkadmin.equinox@start,\
+ org.eclipse.equinox.launcher,\
+ org.eclipse.equinox.launcher.win32.win32.x86,\
+ org.eclipse.equinox.preferences,\
+ org.eclipse.equinox.prov.artifact.repository,\
+ org.eclipse.equinox.prov.console,\
+ org.eclipse.equinox.prov.core,\
+ org.eclipse.equinox.prov.director,\
+ org.eclipse.equinox.prov.download,\
+ org.eclipse.equinox.prov.engine,\
+ org.eclipse.equinox.prov.examplarysetup@start,\
+ org.eclipse.equinox.prov.metadata,\
+ org.eclipse.equinox.prov.metadata.repository,\
+ org.eclipse.equinox.prov.touchpoint.eclipse,\
+ org.eclipse.equinox.prov.touchpoint.natives,\
+ org.eclipse.equinox.prov.ui,\
+ org.eclipse.equinox.prov.ui.admin,\
+ org.eclipse.equinox.prov.ui.admin.rcp,\
+ org.eclipse.equinox.registry,\
+ org.eclipse.equinox.simpleconfigurator@1:start,\
+ org.eclipse.equinox.simpleconfigurator.manipulator@start,\
+ org.eclipse.help,\
+ org.eclipse.jface,\
+ org.eclipse.jface.databinding,\
+ org.eclipse.osgi.services,\
+ org.eclipse.swt,\
+ org.eclipse.swt.win32.win32.x86,\
+ org.eclipse.ui,\
+ org.eclipse.ui.workbench,\
+ org.mozilla.rhino
+eclipse.product=org.eclipse.equinox.prov.ui.admin.rcp.product
+org.eclipse.equinox.simpleconfigurator.useReference=true
+org.eclipse.update.reconcile=false \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin.rcp/icons/provision.gif b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/icons/provision.gif
new file mode 100644
index 000000000..c984fba70
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/icons/provision.gif
Binary files differ
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin.rcp/plugin.properties b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/plugin.properties
new file mode 100644
index 000000000..e9a7ecb2e
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/plugin.properties
@@ -0,0 +1,20 @@
+###############################################################################
+# Copyright (c) 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+#
+# Provisioning Admin UI RCP app
+#
+providerName=Eclipse.org
+bundleName=Provisioning Admin UI RCP (Incubation)
+productName=Eclipse Provisioning
+appName=Eclipse Provisioning Admin UI
+perspectiveName=Eclipse Provisioning
+aboutText= Eclipse Provisioning Admin UI \n\n\
+(c) Copyright Eclipse contributors and others 2007. All rights reserved.\n\
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin.rcp/plugin.xml b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/plugin.xml
new file mode 100644
index 000000000..c63da009f
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/plugin.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+
+ <extension
+ id="org.eclipse.equinox.prov.ui.admin.rcp.application"
+ point="org.eclipse.core.runtime.applications">
+ <application>
+ <run
+ class="org.eclipse.equinox.prov.ui.admin.rcp.Application">
+ </run>
+ </application>
+ </extension>
+ <extension
+ point="org.eclipse.core.runtime.products"
+ id="product">
+ <product
+ name="%productName"
+ application="org.eclipse.equinox.prov.ui.admin.rcp.application">
+ <property
+ name="appName"
+ value="%productName"/>
+ <property
+ name="aboutText"
+ value="%aboutText"/>
+ <property
+ name="windowImages"
+ value="platform:/plugin/org.eclipse.equinox.prov.ui.admin/icons/provision.gif"/>
+
+ </product>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.perspectives">
+ <perspective
+ name="%perspectiveName"
+ class="org.eclipse.equinox.prov.ui.admin.rcp.ProvisioningRCPPerspective"
+ id="org.eclipse.equinox.prov.ui.admin.rcp.ProvisioningRCPPerspective">
+ </perspective>
+ </extension>
+
+</plugin>
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin.rcp/plugin_customization.ini b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/plugin_customization.ini
new file mode 100644
index 000000000..939a62ec9
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/plugin_customization.ini
@@ -0,0 +1,2 @@
+org.eclipse.ui/DOCK_PERSPECTIVE_BAR=topRight
+org.eclipse.ui/SHOW_PROGRESS_ON_STARTUP = false
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin.rcp/rcp.product b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/rcp.product
new file mode 100644
index 000000000..f22b139ee
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/rcp.product
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?pde version="3.1"?>
+
+<product name="%productName" id="org.eclipse.equinox.prov.ui.admin.rcp.product" application="org.eclipse.equinox.prov.ui.admin.rcp.application" useFeatures="false">
+
+ <aboutInfo>
+ <text>
+ %aboutText
+ </text>
+ </aboutInfo>
+
+ <configIni use="custom" path="/org.eclipse.equinox.prov.ui.admin.rcp/config.ini"/>
+
+ <launcherArgs>
+ <vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts</vmArgsMac>
+ </launcherArgs>
+
+ <windowImages i16="/org.eclipse.equinox.prov.ui.admin/icons/provision.gif"/>
+
+ <launcher name="eclipse">
+ <solaris/>
+ <win useIco="false">
+ <bmp/>
+ </win>
+ </launcher>
+
+ <vm>
+ </vm>
+
+ <plugins>
+ <plugin id="com.ibm.icu"/>
+ <plugin id="com.thoughtworks.xstream"/>
+ <plugin id="org.eclipse.core.commands"/>
+ <plugin id="org.eclipse.core.contenttype"/>
+ <plugin id="org.eclipse.core.databinding"/>
+ <plugin id="org.eclipse.core.expressions"/>
+ <plugin id="org.eclipse.core.jobs"/>
+ <plugin id="org.eclipse.core.runtime"/>
+ <plugin id="org.eclipse.ecf"/>
+ <plugin id="org.eclipse.ecf.filetransfer"/>
+ <plugin id="org.eclipse.ecf.identity"/>
+ <plugin id="org.eclipse.ecf.provider.filetransfer"/>
+ <plugin id="org.eclipse.equinox.app"/>
+ <plugin id="org.eclipse.equinox.common"/>
+ <plugin id="org.eclipse.equinox.frameworkadmin"/>
+ <plugin id="org.eclipse.equinox.frameworkadmin.equinox"/>
+ <plugin id="org.eclipse.equinox.launcher"/>
+ <plugin id="org.eclipse.equinox.launcher.win32.win32.x86" fragment="true"/>
+ <plugin id="org.eclipse.equinox.preferences"/>
+ <plugin id="org.eclipse.equinox.prov.artifact.repository"/>
+ <plugin id="org.eclipse.equinox.prov.console"/>
+ <plugin id="org.eclipse.equinox.prov.core"/>
+ <plugin id="org.eclipse.equinox.prov.director"/>
+ <plugin id="org.eclipse.equinox.prov.download"/>
+ <plugin id="org.eclipse.equinox.prov.engine"/>
+ <plugin id="org.eclipse.equinox.prov.examplarysetup"/>
+ <plugin id="org.eclipse.equinox.prov.metadata"/>
+ <plugin id="org.eclipse.equinox.prov.metadata.repository"/>
+ <plugin id="org.eclipse.equinox.prov.touchpoint.eclipse"/>
+ <plugin id="org.eclipse.equinox.prov.touchpoint.natives"/>
+ <plugin id="org.eclipse.equinox.prov.ui"/>
+ <plugin id="org.eclipse.equinox.prov.ui.admin"/>
+ <plugin id="org.eclipse.equinox.prov.ui.admin.rcp"/>
+ <plugin id="org.eclipse.equinox.registry"/>
+ <plugin id="org.eclipse.equinox.simpleconfigurator"/>
+ <plugin id="org.eclipse.equinox.simpleconfigurator.manipulator"/>
+ <plugin id="org.eclipse.help"/>
+ <plugin id="org.eclipse.jface"/>
+ <plugin id="org.eclipse.jface.databinding"/>
+ <plugin id="org.eclipse.osgi"/>
+ <plugin id="org.eclipse.osgi.services"/>
+ <plugin id="org.eclipse.swt"/>
+ <plugin id="org.eclipse.swt.win32.win32.x86" fragment="true"/>
+ <plugin id="org.eclipse.ui"/>
+ <plugin id="org.eclipse.ui.workbench"/>
+ <plugin id="org.mozilla.rhino"/>
+ </plugins>
+
+</product>
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin.rcp/src/org/eclipse/equinox/prov/ui/admin/rcp/Activator.java b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/src/org/eclipse/equinox/prov/ui/admin/rcp/Activator.java
new file mode 100644
index 000000000..832c8a5ba
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/src/org/eclipse/equinox/prov/ui/admin/rcp/Activator.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.admin.rcp;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.equinox.prov.ui.admin.rcp"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ public Activator() {
+ // contstructor
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext bundleContext) throws Exception {
+ super.start(bundleContext);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext bundleContext) throws Exception {
+ plugin = null;
+ super.stop(bundleContext);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin.rcp/src/org/eclipse/equinox/prov/ui/admin/rcp/Application.java b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/src/org/eclipse/equinox/prov/ui/admin/rcp/Application.java
new file mode 100644
index 000000000..08892b0b0
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/src/org/eclipse/equinox/prov/ui/admin/rcp/Application.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.admin.rcp;
+
+import org.eclipse.equinox.app.IApplication;
+import org.eclipse.equinox.app.IApplicationContext;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * This class controls all aspects of the application's execution
+ */
+public class Application implements IApplication {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext)
+ */
+ public Object start(IApplicationContext context) throws Exception {
+ Display display = PlatformUI.createDisplay();
+ try {
+ int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor());
+ if (returnCode == PlatformUI.RETURN_RESTART)
+ return IApplication.EXIT_RESTART;
+ return IApplication.EXIT_OK;
+ } finally {
+ display.dispose();
+ }
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.app.IApplication#stop()
+ */
+ public void stop() {
+ final IWorkbench workbench = PlatformUI.getWorkbench();
+ if (workbench == null)
+ return;
+ final Display display = workbench.getDisplay();
+ display.syncExec(new Runnable() {
+ public void run() {
+ if (!display.isDisposed())
+ workbench.close();
+ }
+ });
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin.rcp/src/org/eclipse/equinox/prov/ui/admin/rcp/ApplicationActionBarAdvisor.java b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/src/org/eclipse/equinox/prov/ui/admin/rcp/ApplicationActionBarAdvisor.java
new file mode 100644
index 000000000..ed92eb3df
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/src/org/eclipse/equinox/prov/ui/admin/rcp/ApplicationActionBarAdvisor.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.admin.rcp;
+
+import org.eclipse.equinox.prov.ui.admin.rcp.internal.ProvAdminUIMessages;
+import org.eclipse.jface.action.*;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.application.ActionBarAdvisor;
+import org.eclipse.ui.application.IActionBarConfigurer;
+
+public class ApplicationActionBarAdvisor extends ActionBarAdvisor {
+
+ IAction prefsAction, aboutAction, quitAction;
+
+ public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) {
+ super(configurer);
+ }
+
+ protected void makeActions(IWorkbenchWindow window) {
+ quitAction = ActionFactory.QUIT.create(window);
+ prefsAction = ActionFactory.PREFERENCES.create(window);
+ aboutAction = ActionFactory.ABOUT.create(window);
+ }
+
+ protected void fillMenuBar(IMenuManager menuBar) {
+ IMenuManager fileMenu = new MenuManager(ProvAdminUIMessages.ApplicationActionBarAdvisor_FileMenuName, "file"); //$NON-NLS-1$
+ menuBar.add(fileMenu);
+ fileMenu.add(quitAction);
+
+ IMenuManager windowMenu = new MenuManager(ProvAdminUIMessages.ApplicationActionBarAdvisor_WindowMenuName, "window"); //$NON-NLS-1$
+ menuBar.add(windowMenu);
+ windowMenu.add(prefsAction);
+
+ IMenuManager helpMenu = new MenuManager(ProvAdminUIMessages.ApplicationActionBarAdvisor_HelpMenuName, "help"); //$NON-NLS-1$
+ menuBar.add(helpMenu);
+ helpMenu.add(aboutAction);
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin.rcp/src/org/eclipse/equinox/prov/ui/admin/rcp/ApplicationWorkbenchAdvisor.java b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/src/org/eclipse/equinox/prov/ui/admin/rcp/ApplicationWorkbenchAdvisor.java
new file mode 100644
index 000000000..2d1e4ba9f
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/src/org/eclipse/equinox/prov/ui/admin/rcp/ApplicationWorkbenchAdvisor.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.admin.rcp;
+
+import org.eclipse.ui.application.*;
+
+public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {
+
+ public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) {
+ return new ApplicationWorkbenchWindowAdvisor(configurer);
+ }
+
+ public String getInitialWindowPerspectiveId() {
+ return "org.eclipse.equinox.prov.ui.admin.rcp.ProvisioningRCPPerspective"; //$NON-NLS-1$
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin.rcp/src/org/eclipse/equinox/prov/ui/admin/rcp/ApplicationWorkbenchWindowAdvisor.java b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/src/org/eclipse/equinox/prov/ui/admin/rcp/ApplicationWorkbenchWindowAdvisor.java
new file mode 100644
index 000000000..2b3fd8179
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/src/org/eclipse/equinox/prov/ui/admin/rcp/ApplicationWorkbenchWindowAdvisor.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.admin.rcp;
+
+import org.eclipse.equinox.prov.ui.admin.rcp.internal.ProvAdminUIMessages;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.ui.application.*;
+
+public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
+
+ public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) {
+ super(configurer);
+ }
+
+ public ActionBarAdvisor createActionBarAdvisor(IActionBarConfigurer configurer) {
+ return new ApplicationActionBarAdvisor(configurer);
+ }
+
+ public void preWindowOpen() {
+ IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
+ configurer.setInitialSize(new Point(800, 600));
+ configurer.setShowCoolBar(false);
+ configurer.setShowStatusLine(false);
+ configurer.setTitle(ProvAdminUIMessages.ApplicationWindowTitle);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin.rcp/src/org/eclipse/equinox/prov/ui/admin/rcp/ProvisioningRCPPerspective.java b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/src/org/eclipse/equinox/prov/ui/admin/rcp/ProvisioningRCPPerspective.java
new file mode 100644
index 000000000..80498e8b9
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/src/org/eclipse/equinox/prov/ui/admin/rcp/ProvisioningRCPPerspective.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.admin.rcp;
+
+import org.eclipse.ui.*;
+
+/**
+ * Perspective which makes the standard provisioning views available.
+ *
+ * @since 3.4
+ *
+ */
+public class ProvisioningRCPPerspective implements IPerspectiveFactory {
+
+ private IPageLayout factory;
+ private static final String METADATA_REPOSITORIES = "org.eclipse.prov.ui.admin.MetadataRepositoriesView"; //$NON-NLS-1$
+ private static final String ARTIFACT_REPOSITORIES = "org.eclipse.prov.ui.admin.ArtifactRepositoriesView"; //$NON-NLS-1$
+ private static final String PROFILES = "org.eclipse.prov.ui.admin.ProfilesView"; //$NON-NLS-1$
+
+ public ProvisioningRCPPerspective() {
+ super();
+ }
+
+ public void createInitialLayout(IPageLayout layout) {
+ this.factory = layout;
+ addViews();
+ }
+
+ private void addViews() {
+ IFolderLayout top = factory.createFolder("top", //$NON-NLS-1$
+ IPageLayout.TOP, 0.5f, factory.getEditorArea());
+ top.addView(METADATA_REPOSITORIES);
+ factory.getViewLayout(METADATA_REPOSITORIES).setCloseable(false);
+ top.addView(ARTIFACT_REPOSITORIES);
+ factory.getViewLayout(ARTIFACT_REPOSITORIES).setCloseable(false);
+ factory.addView(PROFILES, IPageLayout.BOTTOM, 0.65f, "top"); //$NON-NLS-1$
+ factory.getViewLayout(PROFILES).setCloseable(false);
+ factory.setEditorAreaVisible(false);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin.rcp/src/org/eclipse/equinox/prov/ui/admin/rcp/internal/ProvAdminUIMessages.java b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/src/org/eclipse/equinox/prov/ui/admin/rcp/internal/ProvAdminUIMessages.java
new file mode 100644
index 000000000..d24ca11c6
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/src/org/eclipse/equinox/prov/ui/admin/rcp/internal/ProvAdminUIMessages.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.prov.ui.admin.rcp.internal;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Message class for provisioning UI messages.
+ *
+ * @since 3.4
+ */
+public class ProvAdminUIMessages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.equinox.prov.ui.admin.rcp.internal.messages"; //$NON-NLS-1$
+ static {
+ // load message values from bundle file
+ NLS.initializeMessages(BUNDLE_NAME, ProvAdminUIMessages.class);
+ }
+ public static String ApplicationActionBarAdvisor_FileMenuName;
+ public static String ApplicationActionBarAdvisor_HelpMenuName;
+ public static String ApplicationActionBarAdvisor_WindowMenuName;
+ public static String ApplicationWindowTitle;
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin.rcp/src/org/eclipse/equinox/prov/ui/admin/rcp/internal/messages.properties b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/src/org/eclipse/equinox/prov/ui/admin/rcp/internal/messages.properties
new file mode 100644
index 000000000..e5decd174
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin.rcp/src/org/eclipse/equinox/prov/ui/admin/rcp/internal/messages.properties
@@ -0,0 +1,15 @@
+###############################################################################
+# Copyright (c) 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+
+ApplicationWindowTitle=Eclipse Provisioning
+ApplicationActionBarAdvisor_FileMenuName=&File
+ApplicationActionBarAdvisor_WindowMenuName=&Window
+ApplicationActionBarAdvisor_HelpMenuName=&Help
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/.classpath b/bundles/org.eclipse.equinox.p2.ui.admin/.classpath
new file mode 100644
index 000000000..ce7393340
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/.cvsignore b/bundles/org.eclipse.equinox.p2.ui.admin/.cvsignore
new file mode 100644
index 000000000..c5e82d745
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/.cvsignore
@@ -0,0 +1 @@
+bin \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/.project b/bundles/org.eclipse.equinox.p2.ui.admin/.project
new file mode 100644
index 000000000..d05dfc699
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.equinox.prov.ui.admin</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.ui.admin/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..78523cd05
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,331 @@
+#Thu Aug 16 11:00:59 EDT 2007
+eclipse.preferences.version=1
+org.eclipse.jdt.core.builder.cleanOutputFolder=clean
+org.eclipse.jdt.core.builder.duplicateResourceTask=warning
+org.eclipse.jdt.core.builder.invalidClasspath=abort
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
+org.eclipse.jdt.core.circularClasspath=error
+org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
+org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=error
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=false
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false
+org.eclipse.jdt.core.formatter.comment.format_line_comments=false
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=800
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.incompatibleJDKLevel=ignore
+org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.p2.ui.admin/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 000000000..c94f55995
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,57 @@
+#Sun Sep 23 11:59:19 EDT 2007
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_core
+formatter_settings_version=11
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=;
+org.eclipse.jdt.ui.ondemandthreshold=3
+org.eclipse.jdt.ui.staticondemandthreshold=3
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates/>
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.format_source_code=true
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_variable_declarations_final=true
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=false
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.ui.admin/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..9d6aa5300
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/META-INF/MANIFEST.MF
@@ -0,0 +1,33 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %bundleName
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Bundle-SymbolicName: org.eclipse.equinox.prov.ui.admin;singleton:=true
+Bundle-Version: 0.1.0.qualifier
+Bundle-Activator: org.eclipse.equinox.prov.ui.admin.ProvAdminUIActivator
+Bundle-RequiredExecutionEnvironment: J2SE-1.4,
+ CDC-1.1/Foundation-1.1
+Import-Package: org.eclipse.equinox.prov.artifact.repository,
+ org.eclipse.equinox.prov.core.eventbus,
+ org.eclipse.equinox.prov.core.helpers,
+ org.eclipse.equinox.prov.core.repository,
+ org.eclipse.equinox.prov.engine,
+ org.eclipse.equinox.prov.metadata,
+ org.eclipse.equinox.prov.metadata.repository,
+ org.eclipse.equinox.prov.ui,
+ org.eclipse.equinox.prov.ui.actions,
+ org.eclipse.equinox.prov.ui.dialogs,
+ org.eclipse.equinox.prov.ui.model,
+ org.eclipse.equinox.prov.ui.operations,
+ org.eclipse.equinox.prov.ui.viewers,
+ org.eclipse.osgi.service.environment;version="1.0.0",
+ org.eclipse.osgi.util;version="1.1.0",
+ org.osgi.framework;version="1.3.0"
+Export-Package: org.eclipse.equinox.prov.ui.admin,
+ org.eclipse.equinox.prov.ui.admin.internal;x-internal:=true,
+ org.eclipse.equinox.prov.ui.admin.internal.dialogs;x-internal:=true,
+ org.eclipse.equinox.prov.ui.admin.internal.preferences;x-internal:=true
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.ui
+Eclipse-LazyStart: true
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/about.html b/bundles/org.eclipse.equinox.p2.ui.admin/about.html
new file mode 100644
index 000000000..460233046
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 2, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/build.properties b/bundles/org.eclipse.equinox.p2.ui.admin/build.properties
new file mode 100644
index 000000000..35011865d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/build.properties
@@ -0,0 +1,21 @@
+###############################################################################
+# Copyright (c) 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+bin.includes = plugin.properties,\
+ icons/,\
+ .,\
+ plugin.xml,\
+ about.html,\
+ META-INF/
+src.includes = about.html
+source.. = src/
+
+
+
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/icons/obj/artifact_repo_obj.gif b/bundles/org.eclipse.equinox.p2.ui.admin/icons/obj/artifact_repo_obj.gif
new file mode 100644
index 000000000..0470e1588
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/icons/obj/artifact_repo_obj.gif
Binary files differ
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/icons/obj/iu_obj.gif b/bundles/org.eclipse.equinox.p2.ui.admin/icons/obj/iu_obj.gif
new file mode 100644
index 000000000..8706680c7
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/icons/obj/iu_obj.gif
Binary files differ
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/icons/obj/metadata_repo_obj.gif b/bundles/org.eclipse.equinox.p2.ui.admin/icons/obj/metadata_repo_obj.gif
new file mode 100644
index 000000000..b8568f4f8
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/icons/obj/metadata_repo_obj.gif
Binary files differ
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/icons/obj/profile_obj.gif b/bundles/org.eclipse.equinox.p2.ui.admin/icons/obj/profile_obj.gif
new file mode 100644
index 000000000..c984fba70
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/icons/obj/profile_obj.gif
Binary files differ
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/icons/obj/uninstalled_iu.gif b/bundles/org.eclipse.equinox.p2.ui.admin/icons/obj/uninstalled_iu.gif
new file mode 100644
index 000000000..f192b8486
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/icons/obj/uninstalled_iu.gif
Binary files differ
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/icons/provision.gif b/bundles/org.eclipse.equinox.p2.ui.admin/icons/provision.gif
new file mode 100644
index 000000000..c984fba70
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/icons/provision.gif
Binary files differ
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/plugin.properties b/bundles/org.eclipse.equinox.p2.ui.admin/plugin.properties
new file mode 100644
index 000000000..422c4cd5d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/plugin.properties
@@ -0,0 +1,25 @@
+###############################################################################
+# Copyright (c) 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+#
+# Provisioning Admin UI plugin resources
+#
+providerName=Eclipse.org
+bundleName=Provisioning Admin UI (Incubation)
+
+perspectiveName=Provisioning
+viewCategoryName=Provisioning
+MetadataRepositories.name=Metadata Repositories
+ArtifactRepositories.name=Artifact Repositories
+Profiles.name=Profiles
+Provisioning.title=Provisioning
+Profile.name=Profile
+IU.name=Installable Unit
+Repository.name=Repository \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/plugin.xml b/bundles/org.eclipse.equinox.p2.ui.admin/plugin.xml
new file mode 100644
index 000000000..2c435a539
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/plugin.xml
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ name="%Provisioning.title"
+ class="org.eclipse.equinox.prov.ui.admin.internal.preferences.ProvisioningPrefPage"
+ id="org.eclipse.prov.ui.preferences.ProvisioningPrefPage">
+ </page>
+ </extension>
+ <extension
+ point="org.eclipse.core.runtime.preferences">
+ <initializer
+ class="org.eclipse.equinox.prov.ui.admin.internal.preferences.ProvUIPreferenceInitializer">
+ </initializer>
+ </extension>
+ <extension
+ point="org.eclipse.ui.views">
+ <category
+ name="%viewCategoryName"
+ id="org.eclipse.prov.ui.admin">
+ </category>
+ <view
+ name="%MetadataRepositories.name"
+ icon="$nl$/icons/obj/metadata_repo_obj.gif"
+ category="org.eclipse.prov.ui.admin"
+ class="org.eclipse.equinox.prov.ui.admin.internal.MetadataRepositoriesView"
+ id="org.eclipse.prov.ui.admin.MetadataRepositoriesView">
+ </view>
+ </extension>
+ <extension
+ point="org.eclipse.ui.views">
+ <view
+ name="%ArtifactRepositories.name"
+ icon="$nl$/icons/obj/artifact_repo_obj.gif"
+ category="org.eclipse.prov.ui.admin"
+ class="org.eclipse.equinox.prov.ui.admin.internal.ArtifactRepositoriesView"
+ id="org.eclipse.prov.ui.admin.ArtifactRepositoriesView">
+ </view>
+ </extension>
+ <extension
+ point="org.eclipse.ui.views">
+ <view
+ name="%Profiles.name"
+ icon="$nl$/icons/obj/profile_obj.gif"
+ category="org.eclipse.prov.ui.admin"
+ class="org.eclipse.equinox.prov.ui.admin.internal.ProfilesView"
+ id="org.eclipse.prov.ui.admin.ProfilesView">
+ </view>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.perspectives">
+ <perspective
+ name="%perspectiveName"
+ icon="$nl$/icons/provision.gif"
+ class="org.eclipse.equinox.prov.ui.admin.internal.ProvisioningPerspective"
+ id="org.eclipse.equinox.prov.ui.admin.ProvisioningPerspective">
+ </perspective>
+ </extension>
+ <extension
+ point="org.eclipse.ui.propertyPages">
+ <page
+ name="%Profile.name"
+ class="org.eclipse.equinox.prov.ui.dialogs.ProfilePropertyPage"
+ id="org.eclipse.equinox.prov.ui.admin.internal.dialogs.ProfilePropertyPage">
+ <enabledWhen>
+ <instanceof
+ value="org.eclipse.equinox.prov.engine.Profile">
+ </instanceof>
+ </enabledWhen>
+ </page>
+ <page
+ name="%IU.name"
+ class="org.eclipse.equinox.prov.ui.dialogs.IUImplementationPropertyPage"
+ id="org.eclipse.equinox.prov.ui.admin.internal.dialogs.IUPropertyPage">
+ <enabledWhen>
+ <or>
+ <instanceof
+ value="org.eclipse.equinox.prov.metadata.InstallableUnit">
+ </instanceof>
+ <instanceof
+ value="org.eclipse.equinox.prov.ui.model.InstalledIUElement">
+ </instanceof>
+
+ </or>
+ </enabledWhen>
+ </page>
+
+ <page
+ name="%Repository.name"
+ class="org.eclipse.equinox.prov.ui.dialogs.RepositoryImplementationPropertyPage"
+ id="org.eclipse.equinox.prov.ui.admin.internal.dialogs.RepositoryPropertyPage">
+ <enabledWhen>
+ <or>
+ <instanceof
+ value="org.eclipse.equinox.prov.metadata.repository.IMetadataRepository">
+ </instanceof>
+ <instanceof
+ value="org.eclipse.equinox.prov.artifact.repository.IArtifactRepository">
+ </instanceof>
+
+ </or>
+ </enabledWhen>
+ </page>
+
+ </extension>
+
+</plugin>
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/ProvAdminUIActivator.java b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/ProvAdminUIActivator.java
new file mode 100644
index 000000000..a46fd9cfc
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/ProvAdminUIActivator.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.admin;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * Activator class for the admin UI.
+ */
+public class ProvAdminUIActivator extends AbstractUIPlugin {
+
+ private static ProvAdminUIActivator plugin;
+ private static BundleContext context;
+
+ public static final String PLUGIN_ID = "org.eclipse.equinox.prov.ui.admin"; //$NON-NLS-1$
+ public static final String PERSPECTIVE_ID = "org.eclipse.equinox.prov.ui.admin.ProvisioningPerspective"; //$NON-NLS-1$
+
+ public static BundleContext getContext() {
+ return context;
+ }
+
+ /**
+ * Returns the singleton plugin instance
+ *
+ * @return the instance
+ */
+ public static ProvAdminUIActivator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given plug-in
+ * relative path
+ *
+ * @param path
+ * the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+
+ public ProvAdminUIActivator() {
+ // constructor
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext bundleContext) throws Exception {
+ super.start(bundleContext);
+ plugin = this;
+ ProvAdminUIActivator.context = bundleContext;
+ }
+
+ public void stop(BundleContext bundleContext) throws Exception {
+ plugin = null;
+ super.stop(bundleContext);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/ArtifactRepositoriesView.java b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/ArtifactRepositoriesView.java
new file mode 100644
index 000000000..f5e8968e5
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/ArtifactRepositoriesView.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.admin.internal;
+
+import java.util.ArrayList;
+import org.eclipse.core.commands.operations.IUndoableOperation;
+import org.eclipse.equinox.prov.artifact.repository.IArtifactRepository;
+import org.eclipse.equinox.prov.ui.admin.internal.dialogs.AddArtifactRepositoryDialog;
+import org.eclipse.equinox.prov.ui.model.AllArtifactRepositories;
+import org.eclipse.equinox.prov.ui.model.ArtifactRepositoryContentProvider;
+import org.eclipse.equinox.prov.ui.operations.RemoveArtifactRepositoryOperation;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * This view allows users to interact with artifact repositories
+ *
+ * @since 3.4
+ */
+public class ArtifactRepositoriesView extends RepositoriesView {
+
+ /**
+ *
+ */
+ public ArtifactRepositoriesView() {
+ // constructor
+ }
+
+ protected IContentProvider getContentProvider() {
+ return new ArtifactRepositoryContentProvider();
+ }
+
+ protected Object getInput() {
+ return new AllArtifactRepositories();
+ }
+
+ protected String getAddCommandLabel() {
+ return ProvAdminUIMessages.ArtifactRepositoriesView_AddRepositoryLabel;
+ }
+
+ protected String getAddCommandTooltip() {
+ return ProvAdminUIMessages.ArtifactRepositoriesView_AddRepositoryTooltip;
+ }
+
+ protected String getRemoveCommandLabel() {
+ return ProvAdminUIMessages.ArtifactRepositoriesView_RemoveRepositoryLabel;
+ }
+
+ protected String getRemoveCommandTooltip() {
+ return ProvAdminUIMessages.ArtifactRepositoriesView_RemoveRepositoryTooltip;
+ }
+
+ protected int openAddRepositoryDialog(Shell shell, Object[] elements) {
+ return new AddArtifactRepositoryDialog(shell, (IArtifactRepository[]) elements).open();
+ }
+
+ protected IUndoableOperation getRemoveOperation(Object[] elements) {
+ ArrayList repos = new ArrayList();
+ for (int i = 0; i < elements.length; i++) {
+ if (elements[i] instanceof IArtifactRepository) {
+ repos.add(elements[i]);
+ }
+ }
+ return new RemoveArtifactRepositoryOperation(ProvAdminUIMessages.ArtifactRepositoriesView_RemoveRepositoryOperationLabel, (IArtifactRepository[]) repos.toArray(new IArtifactRepository[repos.size()]));
+ }
+
+ protected boolean isRepository(Object element) {
+ return element instanceof IArtifactRepository;
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/MetadataRepositoriesView.java b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/MetadataRepositoriesView.java
new file mode 100644
index 000000000..3309fe1ad
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/MetadataRepositoriesView.java
@@ -0,0 +1,175 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.admin.internal;
+
+import java.util.ArrayList;
+import org.eclipse.core.commands.operations.IUndoableOperation;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.metadata.IInstallableUnitConstants;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepository;
+import org.eclipse.equinox.prov.ui.IProfileChooser;
+import org.eclipse.equinox.prov.ui.actions.BecomeAction;
+import org.eclipse.equinox.prov.ui.actions.InstallAction;
+import org.eclipse.equinox.prov.ui.admin.internal.dialogs.AddMetadataRepositoryDialog;
+import org.eclipse.equinox.prov.ui.admin.internal.dialogs.AddProfileDialog;
+import org.eclipse.equinox.prov.ui.model.*;
+import org.eclipse.equinox.prov.ui.operations.RemoveMetadataRepositoryOperation;
+import org.eclipse.equinox.prov.ui.viewers.IUDragAdapter;
+import org.eclipse.equinox.prov.ui.viewers.ProvElementLabelProvider;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.dnd.*;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.dialogs.ListDialog;
+import org.eclipse.ui.part.PluginTransfer;
+
+/**
+ * This view allows users to interact with metadata repositories
+ *
+ * @since 3.4
+ */
+public class MetadataRepositoriesView extends RepositoriesView {
+
+ private InstallAction installAction;
+ private BecomeAction becomeAction;
+
+ /**
+ * The constructor.
+ */
+ public MetadataRepositoriesView() {
+ // constructor
+ }
+
+ protected IContentProvider getContentProvider() {
+ return new MetadataRepositoryContentProvider();
+ }
+
+ protected Object getInput() {
+ return new AllMetadataRepositories();
+ }
+
+ protected String getAddCommandLabel() {
+ return ProvAdminUIMessages.MetadataRepositoriesView_AddRepositoryLabel;
+ }
+
+ protected String getAddCommandTooltip() {
+ return ProvAdminUIMessages.MetadataRepositoriesView_AddRepositoryTooltip;
+ }
+
+ protected String getRemoveCommandLabel() {
+ return ProvAdminUIMessages.MetadataRepositoriesView_RemoveRepositoryLabel;
+ }
+
+ protected String getRemoveCommandTooltip() {
+ return ProvAdminUIMessages.MetadataRepositoriesView_RemoveRepositoryTooltip;
+ }
+
+ protected int openAddRepositoryDialog(Shell shell, Object[] elements) {
+ return new AddMetadataRepositoryDialog(shell, (IMetadataRepository[]) elements).open();
+ }
+
+ protected IUndoableOperation getRemoveOperation(Object[] elements) {
+ ArrayList repos = new ArrayList();
+ for (int i = 0; i < elements.length; i++) {
+ if (elements[i] instanceof IMetadataRepository) {
+ repos.add(elements[i]);
+ }
+ }
+ return new RemoveMetadataRepositoryOperation(ProvAdminUIMessages.MetadataRepositoriesView_RemoveRepositoryOperationLabel, (IMetadataRepository[]) repos.toArray(new IMetadataRepository[repos.size()]));
+ }
+
+ protected void makeActions() {
+ super.makeActions();
+ installAction = new InstallAction(ProvAdminUIMessages.InstallIUCommandLabel, viewer, null, null, getProfileChooser(), getShell());
+ installAction.setEntryPointStrategy(InstallAction.ENTRYPOINT_OPTIONAL);
+ becomeAction = new BecomeAction(ProvAdminUIMessages.BecomeIUCommandLabel, viewer, null, null, getProfileChooser(), getShell());
+ }
+
+ private IProfileChooser getProfileChooser() {
+ return new IProfileChooser() {
+
+ public Profile getProfile() {
+ // TODO would be nice if the profile chooser dialog let you
+ // create a new profile
+ ProfileContentProvider provider = new ProfileContentProvider();
+ if (provider.getElements(null).length == 0) {
+ AddProfileDialog dialog = new AddProfileDialog(getShell(), new Profile[0]);
+ if (dialog.open() == Window.OK) {
+ return dialog.getAddedProfile();
+ }
+ return null;
+ }
+
+ ListDialog dialog = new ListDialog(getShell());
+ dialog.setTitle(ProvAdminUIMessages.MetadataRepositoriesView_ChooseProfileDialogTitle);
+ dialog.setLabelProvider(new ProvElementLabelProvider());
+ dialog.setInput(new AllProfiles());
+ dialog.setContentProvider(provider);
+ dialog.open();
+ Object[] result = dialog.getResult();
+ if (result != null && result.length > 0 && result[0] instanceof Profile) {
+ return (Profile) result[0];
+ }
+ return null;
+ }
+
+ public String getLabel() {
+ return ProvAdminUIMessages.MetadataRepositoriesView_ChooseProfileDialogTitle;
+ }
+ };
+ }
+
+ protected void selectionChanged(IStructuredSelection selection) {
+ super.selectionChanged(selection);
+ if (selection.size() < 1) {
+ installAction.setEnabled(false);
+ becomeAction.setEnabled(false);
+ }
+ Object[] selectionArray = selection.toArray();
+ if (selectionArray.length == 1 && selectionArray[0] instanceof IInstallableUnit) {
+ IInstallableUnit iu = (IInstallableUnit) selectionArray[0];
+ becomeAction.setEnabled(Boolean.valueOf(iu.getProperty(IInstallableUnitConstants.PROFILE_IU_KEY)).booleanValue());
+ } else {
+ becomeAction.setEnabled(false);
+ }
+ for (int i = 0; i < selectionArray.length; i++) {
+ if (!(selectionArray[i] instanceof IInstallableUnit)) {
+ installAction.setEnabled(false);
+ return;
+ }
+ }
+ installAction.setEnabled(true);
+ }
+
+ protected void fillContextMenu(IMenuManager manager) {
+ if (installAction.isEnabled()) {
+ manager.add(new Separator());
+ manager.add(installAction);
+ manager.add(becomeAction);
+ }
+ super.fillContextMenu(manager);
+ }
+
+ protected boolean isRepository(Object element) {
+ return element instanceof IMetadataRepository;
+ }
+
+ protected void configureViewer(final TreeViewer treeViewer) {
+ super.configureViewer(treeViewer);
+ // Add drag support for IU's
+ Transfer[] transfers = new Transfer[] {org.eclipse.jface.util.LocalSelectionTransfer.getTransfer(), PluginTransfer.getInstance(), TextTransfer.getInstance(),};
+ treeViewer.addDragSupport(DND.DROP_COPY, transfers, new IUDragAdapter(treeViewer));
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/ProfilesView.java b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/ProfilesView.java
new file mode 100644
index 000000000..fd8db7c60
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/ProfilesView.java
@@ -0,0 +1,310 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.admin.internal;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.IUndoableOperation;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.ui.*;
+import org.eclipse.equinox.prov.ui.actions.*;
+import org.eclipse.equinox.prov.ui.admin.ProvAdminUIActivator;
+import org.eclipse.equinox.prov.ui.admin.internal.dialogs.AddProfileDialog;
+import org.eclipse.equinox.prov.ui.admin.internal.dialogs.UpdateAndInstallDialog;
+import org.eclipse.equinox.prov.ui.admin.internal.preferences.PreferenceConstants;
+import org.eclipse.equinox.prov.ui.model.*;
+import org.eclipse.equinox.prov.ui.operations.*;
+import org.eclipse.equinox.prov.ui.viewers.InstallIUDropAdapter;
+import org.eclipse.equinox.prov.ui.viewers.StructuredViewerProvisioningListener;
+import org.eclipse.jface.action.*;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialogWithToggle;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.jface.window.Window;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.dialogs.PropertyDialogAction;
+
+/**
+ * This view allows users to interact with installed profiles.
+ *
+ * @since 3.4
+ */
+public class ProfilesView extends ProvView {
+ private Action addProfileAction, removeProfileAction, uninstallAction, updateAction, installAction;
+ private PropertyDialogAction propertiesAction;
+ private StructuredViewerProvisioningListener listener;
+
+ private class RemoveProfileAction extends Action {
+ RemoveProfileAction() {
+ setText(ProvAdminUIMessages.ProfilesView_RemoveProfileLabel);
+ setToolTipText(ProvAdminUIMessages.ProfilesView_RemoveProfileTooltip);
+ setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
+ setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_DISABLED));
+
+ }
+
+ public void run() {
+ List list = getSelection().toList();
+ List profilesOnly = new ArrayList();
+ for (int i = 0; i < list.size(); i++) {
+ Object element;
+ if ((element = list.get(i)) instanceof Profile) {
+ profilesOnly.add(element);
+ }
+ }
+ IUndoableOperation op = new RemoveProfilesOperation(ProvAdminUIMessages.Ops_RemoveProfileOperationLabel, (Profile[]) profilesOnly.toArray(new Profile[profilesOnly.size()]));
+ try {
+ // TODO hook into platform progress service
+ IStatus status = PlatformUI.getWorkbench().getOperationSupport().getOperationHistory().execute(op, null, ProvUI.getUIInfoAdapter(ProfilesView.this.getShell()));
+ if (status.isOK()) {
+ viewer.refresh();
+ }
+ } catch (ExecutionException e) {
+ ProvUI.handleException(e.getCause(), null);
+ }
+ }
+ }
+
+ private class AddProfileAction extends Action {
+ AddProfileAction() {
+ setText(ProvAdminUIMessages.ProfilesView_AddProfileLabel);
+ setToolTipText(ProvAdminUIMessages.ProfilesView_AddProfileTooltip);
+ setImageDescriptor(ProvUIImages.getImageDescriptor(ProvUIImages.IMG_PROFILE));
+ }
+
+ public void run() {
+ Profile[] profiles = (Profile[]) ((ITreeContentProvider) viewer.getContentProvider()).getElements(null);
+ new AddProfileDialog(viewer.getControl().getShell(), profiles).open();
+ }
+ }
+
+ private class InstallIntoProfileAction extends Action {
+ InstallIntoProfileAction() {
+ setText(ProvAdminUIMessages.InstallIUCommandLabel);
+ setToolTipText(ProvAdminUIMessages.InstallIUCommandTooltip);
+ }
+
+ public void run() {
+ Profile profile = getProfileChooser().getProfile();
+ if (profile != null) {
+ UpdateAndInstallDialog dialog = new UpdateAndInstallDialog(getShell(), profile);
+ dialog.open();
+ }
+ }
+ }
+
+ public ProfilesView() {
+ // constructor
+ }
+
+ protected void addListeners() {
+ super.addListeners();
+ listener = new StructuredViewerProvisioningListener(viewer, StructuredViewerProvisioningListener.PROV_EVENT_IU | StructuredViewerProvisioningListener.PROV_EVENT_PROFILE);
+ ProvUIActivator.getDefault().addProvisioningListener(listener);
+ }
+
+ protected void removeListeners() {
+ super.removeListeners();
+ ProvUIActivator.getDefault().removeProvisioningListener(listener);
+ }
+
+ protected void configureViewer(TreeViewer treeViewer) {
+ super.configureViewer(treeViewer);
+ treeViewer.setInput(new AllProfiles());
+ InstallIUDropAdapter adapter = new InstallIUDropAdapter(treeViewer, getOperationConfirmer());
+ adapter.setFeedbackEnabled(false);
+ adapter.setEntryPointStrategy(InstallAction.ENTRYPOINT_OPTIONAL);
+ Transfer[] transfers = new Transfer[] {org.eclipse.jface.util.LocalSelectionTransfer.getTransfer()};
+ treeViewer.addDropSupport(DND.DROP_COPY, transfers, adapter);
+ }
+
+ protected void fillLocalPullDown(IMenuManager manager) {
+ manager.add(addProfileAction);
+ manager.add(removeProfileAction);
+ manager.add(propertiesAction);
+ manager.add(new Separator());
+ manager.add(installAction);
+ manager.add(updateAction);
+ manager.add(uninstallAction);
+ }
+
+ protected void fillContextMenu(IMenuManager manager) {
+ manager.add(addProfileAction);
+ if (removeProfileAction.isEnabled()) {
+ manager.add(removeProfileAction);
+ }
+ if (propertiesAction.isEnabled()) {
+ manager.add(propertiesAction);
+ }
+ if (updateAction.isEnabled()) {
+ manager.add(new Separator());
+ manager.add(updateAction);
+ manager.add(uninstallAction);
+ }
+ if (installAction.isEnabled()) {
+ manager.add(new Separator());
+ manager.add(installAction);
+ }
+ }
+
+ protected void fillLocalToolBar(IToolBarManager manager) {
+ manager.add(new Separator());
+ manager.add(addProfileAction);
+ manager.add(removeProfileAction);
+ }
+
+ protected void makeActions() {
+ super.makeActions();
+ addProfileAction = new AddProfileAction();
+ removeProfileAction = new RemoveProfileAction();
+ uninstallAction = new UninstallAction(ProvAdminUIMessages.UninstallIUCommandLabel, viewer, getOperationConfirmer(), null, getProfileChooser(), getShell());
+ uninstallAction.setToolTipText(ProvAdminUIMessages.UninstallIUCommandTooltip);
+ updateAction = new UpdateAction(ProvAdminUIMessages.UpdateIUCommandLabel, viewer, getOperationConfirmer(), null, getProfileChooser(), getShell());
+ updateAction.setToolTipText(ProvAdminUIMessages.UpdateIUCommandTooltip);
+ propertiesAction = new PropertyDialogAction(this.getSite(), viewer);
+ installAction = new InstallIntoProfileAction();
+
+ getViewSite().getActionBars().setGlobalActionHandler(ActionFactory.PROPERTIES.getId(), propertiesAction);
+ viewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ IStructuredSelection ss = (IStructuredSelection) event.getSelection();
+ ProfilesView.this.selectionChanged(ss);
+ }
+ });
+
+ // prime the action validation
+ selectionChanged((IStructuredSelection) viewer.getSelection());
+ }
+
+ protected void selectionChanged(IStructuredSelection ss) {
+ super.selectionChanged(ss);
+ if (ss.size() == 1) {
+ propertiesAction.setEnabled(true);
+ if (ss.getFirstElement() instanceof Profile)
+ installAction.setEnabled(true);
+ else
+ installAction.setEnabled(false);
+ } else {
+ propertiesAction.setEnabled(false);
+ }
+ Object[] selectionArray = ss.toArray();
+ Object parent = null;
+ if (selectionArray.length > 0) {
+ uninstallAction.setEnabled(true);
+ updateAction.setEnabled(true);
+ removeProfileAction.setEnabled(true);
+
+ for (int i = 0; i < selectionArray.length; i++) {
+ if (selectionArray[i] instanceof InstalledIUElement) {
+ InstalledIUElement element = (InstalledIUElement) selectionArray[i];
+ if (parent == null) {
+ parent = element.getParent(null);
+ } else if (parent != element.getParent(null)) {
+ uninstallAction.setEnabled(false);
+ updateAction.setEnabled(false);
+ break;
+ }
+ } else {
+ uninstallAction.setEnabled(false);
+ updateAction.setEnabled(false);
+ break;
+ }
+ }
+ // If the selections weren't all IU's, see if they are all
+ // profiles
+ if (!uninstallAction.isEnabled()) {
+ for (int i = 0; i < selectionArray.length; i++) {
+ if (!(selectionArray[i] instanceof Profile)) {
+ removeProfileAction.setEnabled(false);
+ break;
+ }
+ }
+ } else {
+ removeProfileAction.setEnabled(false);
+ }
+ } else {
+ uninstallAction.setEnabled(false);
+ updateAction.setEnabled(false);
+ removeProfileAction.setEnabled(false);
+ }
+ }
+
+ protected IAction getDoubleClickAction() {
+ return propertiesAction;
+ }
+
+ protected IContentProvider getContentProvider() {
+ return new ProfileContentProvider();
+ }
+
+ protected Object getInput() {
+ return new AllProfiles();
+ }
+
+ IProfileChooser getProfileChooser() {
+ return new IProfileChooser() {
+ public Profile getProfile() {
+ Object firstElement = getSelection().getFirstElement();
+ if (firstElement instanceof InstalledIUElement) {
+ return ((InstalledIUElement) firstElement).getProfile();
+ }
+ if (firstElement instanceof Profile) {
+ return (Profile) firstElement;
+ }
+ return null;
+ }
+
+ public String getLabel() {
+ return ProvAdminUIMessages.MetadataRepositoriesView_ChooseProfileDialogTitle;
+ }
+ };
+ }
+
+ private IOperationConfirmer getOperationConfirmer() {
+ return new IOperationConfirmer() {
+
+ public boolean continuePerformingOperation(ProvisioningOperation op, Shell shell) {
+ String confirmMessage;
+ if (op instanceof InstallOperation) {
+ confirmMessage = NLS.bind(ProvAdminUIMessages.Ops_ConfirmIUInstall, ((InstallOperation) op).getProfileId());
+ } else if (op instanceof UninstallOperation) {
+ confirmMessage = ProvAdminUIMessages.ProfilesView_ConfirmUninstallMessage;
+ } else {
+ return true;
+ }
+ boolean proceed = true;
+ IPreferenceStore store = ProvAdminUIActivator.getDefault().getPreferenceStore();
+ if (store.getBoolean(PreferenceConstants.PREF_CONFIRM_SELECTION_INSTALL)) {
+ MessageDialogWithToggle dlg = MessageDialogWithToggle.openYesNoCancelQuestion(shell, op.getLabel(), confirmMessage, ProvAdminUIMessages.ProfilesView_AlwaysConfirmSelectionInstallOps, true, null, null);
+ int ret = dlg.getReturnCode();
+ if (!(ret == Window.CANCEL || ret == -1)) { // return
+ // code of -1 corresponds with ESC
+ // even if no was pressed, we still want to store
+ // the toggle state.
+ store.setValue(PreferenceConstants.PREF_CONFIRM_SELECTION_INSTALL, dlg.getToggleState());
+ }
+ proceed = dlg.getReturnCode() == IDialogConstants.YES_ID;
+ }
+ return proceed;
+ }
+ };
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/ProvAdminUIMessages.java b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/ProvAdminUIMessages.java
new file mode 100644
index 000000000..daf98a5ca
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/ProvAdminUIMessages.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.prov.ui.admin.internal;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Message class for provisioning UI messages.
+ *
+ * @since 3.4
+ */
+public class ProvAdminUIMessages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.equinox.prov.ui.admin.internal.messages"; //$NON-NLS-1$
+ static {
+ // load message values from bundle file
+ NLS.initializeMessages(BUNDLE_NAME, ProvAdminUIMessages.class);
+ }
+ public static String AddArtifactRepositoryDialog_OperationLabel;
+ public static String AddProfileDialog_Title;
+ public static String AddRepositoryDialog_InvalidURL;
+ public static String AddMetadataRepositoryDialog_OperationLabel;
+ public static String ProfilesView_AlwaysConfirmSelectionInstallOps;
+ public static String MetadataRepositoriesView_AddRepositoryTooltip;
+ public static String MetadataRepositoriesView_AddRepositoryLabel;
+ public static String MetadataRepositoriesView_ChooseProfileDialogTitle;
+ public static String MetadataRepositoriesView_RemoveRepositoryLabel;
+ public static String MetadataRepositoriesView_RemoveRepositoryTooltip;
+ public static String MetadataRepositoriesView_RemoveRepositoryOperationLabel;
+ public static String ArtifactRepositoriesView_AddRepositoryTooltip;
+ public static String ArtifactRepositoriesView_AddRepositoryLabel;
+ public static String ArtifactRepositoriesView_RemoveRepositoryLabel;
+ public static String ArtifactRepositoriesView_RemoveRepositoryTooltip;
+ public static String ArtifactRepositoriesView_RemoveRepositoryOperationLabel;
+ public static String ProfilesView_AddProfileTooltip;
+ public static String ProfilesView_AddProfileLabel;
+ public static String ProfilesView_ConfirmUninstallMessage;
+ public static String ProfilesView_RemoveProfileLabel;
+ public static String ProfilesView_RemoveProfileTooltip;
+ // Preferences
+ public static String ProvisioningPrefPage_ConfirmSelectionInstallOps;
+ public static String ProvisioningPrefPage_HideInternalRepos;
+ public static String ProvisioningPrefPage_ShowGroupsOnly;
+ public static String ProvisioningPrefPage_Description;
+
+ public static String Ops_RemoveProfileOperationLabel;
+ public static String Ops_ConfirmIUInstall;
+ public static String AddProfileDialog_OperationLabel;
+ public static String AddProfileDialog_DuplicateProfileID;
+ public static String UpdateAndInstallDialog_AvailableIUsPageLabel;
+ public static String UpdateAndInstallDialog_InstalledIUsPageLabel;
+
+ public static String Ops_InstallIUOperationLabel;
+ public static String Ops_UninstallIUOperationLabel;
+ public static String Ops_UpdateIUOperationLabel;
+
+ public static String InstallIUCommandLabel;
+ public static String BecomeIUCommandLabel;
+ public static String InstallIUCommandTooltip;
+ public static String UninstallIUCommandLabel;
+ public static String UninstallIUCommandTooltip;
+ public static String UpdateIUCommandLabel;
+ public static String UpdateIUCommandTooltip;
+ public static String ProvView_RefreshCommandLabel;
+ public static String ProvView_RefreshCommandTooltip;
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/ProvView.java b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/ProvView.java
new file mode 100644
index 000000000..ac99fd8e8
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/ProvView.java
@@ -0,0 +1,220 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.admin.internal;
+
+import java.util.ArrayList;
+import org.eclipse.equinox.prov.ui.ProvisioningUndoSupport;
+import org.eclipse.equinox.prov.ui.admin.ProvAdminUIActivator;
+import org.eclipse.equinox.prov.ui.admin.internal.preferences.PreferenceConstants;
+import org.eclipse.equinox.prov.ui.viewers.*;
+import org.eclipse.jface.action.*;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.operations.UndoRedoActionGroup;
+import org.eclipse.ui.part.ViewPart;
+
+/**
+ * This class supports the common characteristics for views that manipulate
+ * provisioning models.
+ *
+ * @since 3.4
+ */
+abstract class ProvView extends ViewPart {
+ TreeViewer viewer;
+ private UndoRedoActionGroup undoRedoGroup;
+ Action refreshAction;
+ private IPropertyChangeListener preferenceListener;
+ protected Display display;
+
+ /**
+ * The constructor.
+ */
+ public ProvView() {
+ // constructor
+ }
+
+ /**
+ * Create and initialize the viewer
+ */
+ public void createPartControl(Composite parent) {
+ // Store the display so we can make async calls from listeners
+ display = parent.getDisplay();
+ viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
+ setTreeColumns(viewer.getTree());
+ viewer.getTree().setHeaderVisible(true);
+ viewer.setContentProvider(getContentProvider());
+ viewer.setInput(getInput());
+ viewer.setLabelProvider(new ProvElementLabelProvider());
+ viewer.setComparator(new ViewerComparator());
+ configureViewer(viewer);
+ addListeners();
+ makeActions();
+ hookContextMenu();
+ hookDoubleClickAction();
+ contributeToActionBars();
+ }
+
+ private void hookContextMenu() {
+ MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
+ menuMgr.setRemoveAllWhenShown(true);
+ menuMgr.addMenuListener(new IMenuListener() {
+ public void menuAboutToShow(IMenuManager manager) {
+ ProvView.this.fillContextMenu(manager);
+ manager.add(new Separator());
+ manager.add(refreshAction);
+ manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ }
+ });
+ Menu menu = menuMgr.createContextMenu(viewer.getControl());
+ viewer.getControl().setMenu(menu);
+ getSite().registerContextMenu(menuMgr, viewer);
+ }
+
+ private void hookDoubleClickAction() {
+ viewer.addDoubleClickListener(new IDoubleClickListener() {
+ public void doubleClick(DoubleClickEvent event) {
+ IAction action = getDoubleClickAction();
+ if (action != null && action.isEnabled()) {
+ action.run();
+ }
+ }
+ });
+ }
+
+ private void contributeToActionBars() {
+ IActionBars bars = getViewSite().getActionBars();
+ IMenuManager manager = bars.getMenuManager();
+ fillLocalPullDown(manager);
+ manager.add(new Separator());
+ manager.add(refreshAction);
+
+ fillLocalToolBar(bars.getToolBarManager());
+ undoRedoGroup.fillActionBars(bars);
+ }
+
+ protected abstract void fillLocalPullDown(IMenuManager manager);
+
+ protected abstract void fillContextMenu(IMenuManager manager);
+
+ protected abstract void fillLocalToolBar(IToolBarManager manager);
+
+ protected abstract IAction getDoubleClickAction();
+
+ protected void makeActions() {
+ undoRedoGroup = new UndoRedoActionGroup(getSite(), ProvisioningUndoSupport.getProvisioningUndoContext(), true);
+ refreshAction = new Action(ProvAdminUIMessages.ProvView_RefreshCommandLabel) {
+ public void run() {
+ viewer.refresh();
+ }
+ };
+ refreshAction.setToolTipText(ProvAdminUIMessages.ProvView_RefreshCommandTooltip);
+ }
+
+ /**
+ * Passing the focus request to the viewer's control.
+ */
+ public void setFocus() {
+ viewer.getControl().setFocus();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.part.WorkbenchPart#dispose()
+ */
+ public void dispose() {
+ if (undoRedoGroup != null) {
+ undoRedoGroup.dispose();
+ }
+ removeListeners();
+ super.dispose();
+ }
+
+ protected void addListeners() {
+ IPreferenceStore store = ProvAdminUIActivator.getDefault().getPreferenceStore();
+ preferenceListener = new IPropertyChangeListener() {
+
+ public void propertyChange(PropertyChangeEvent event) {
+ if (event.getProperty().equals(PreferenceConstants.PREF_SHOW_GROUPS_ONLY) || event.getProperty().equals(PreferenceConstants.PREF_HIDE_IMPLEMENTATION_REPOS)) {
+ configureViewerFilter(viewer);
+ }
+ }
+
+ };
+ store.addPropertyChangeListener(preferenceListener);
+
+ }
+
+ protected void removeListeners() {
+ if (preferenceListener != null) {
+ IPreferenceStore store = ProvAdminUIActivator.getDefault().getPreferenceStore();
+ store.removePropertyChangeListener(preferenceListener);
+
+ }
+ }
+
+ Shell getShell() {
+ return viewer.getControl().getShell();
+ }
+
+ Control getViewerControl() {
+ return viewer.getControl();
+ }
+
+ IStructuredSelection getSelection() {
+ return (IStructuredSelection) viewer.getSelection();
+ }
+
+ protected void configureViewer(final TreeViewer treeViewer) {
+ // Filter IU's by group if the preference calls for it
+ // TODO probably want a filter menu on the view
+ configureViewerFilter(treeViewer);
+ }
+
+ protected void selectionChanged(IStructuredSelection selection) {
+ // subclasses may override. Do nothing here.
+ }
+
+ protected abstract IContentProvider getContentProvider();
+
+ protected Object getInput() {
+ return null;
+ }
+
+ protected void configureViewerFilter(TreeViewer treeViewer) {
+ ArrayList filters = new ArrayList();
+ IPreferenceStore store = ProvAdminUIActivator.getDefault().getPreferenceStore();
+ if (store.getBoolean(PreferenceConstants.PREF_SHOW_GROUPS_ONLY)) {
+ filters.add(new IUGroupFilter());
+ }
+ if (store.getBoolean(PreferenceConstants.PREF_HIDE_IMPLEMENTATION_REPOS)) {
+ filters.add(new InternalRepositoryFilter());
+ }
+ treeViewer.setFilters((ViewerFilter[]) filters.toArray(new ViewerFilter[filters.size()]));
+ }
+
+ protected void setTreeColumns(Tree tree) {
+ // TODO generalize?
+ // For now we set two columns and the content depends on the elements
+ TreeColumn tc = new TreeColumn(tree, SWT.LEFT, 0);
+ tc.setResizable(true);
+ tc.setWidth(400);
+ tc = new TreeColumn(tree, SWT.LEFT, 1);
+ tc.setWidth(600);
+ tc.setResizable(true);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/ProvisioningPerspective.java b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/ProvisioningPerspective.java
new file mode 100644
index 000000000..5b2cf5dd9
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/ProvisioningPerspective.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.admin.internal;
+
+import org.eclipse.ui.*;
+
+/**
+ * Perspective which makes the standard provisioning views available.
+ *
+ * @since 3.4
+ *
+ */
+public class ProvisioningPerspective implements IPerspectiveFactory {
+
+ private IPageLayout factory;
+
+ public ProvisioningPerspective() {
+ super();
+ }
+
+ public void createInitialLayout(IPageLayout layout) {
+ this.factory = layout;
+ addViews();
+ addActionSets();
+ addNewWizardShortcuts();
+ addPerspectiveShortcuts();
+ addViewShortcuts();
+ }
+
+ private void addViews() {
+ // Creates the overall folder layout.
+ // Note that each new Folder uses a percentage of the remaining
+ // EditorArea.
+
+ IFolderLayout bottom = factory.createFolder("bottomRight", //$NON-NLS-1$
+ IPageLayout.BOTTOM, 0.75f, factory.getEditorArea());
+ bottom.addView("org.eclipse.prov.ui.admin.ProfilesView"); //$NON-NLS-1$
+
+ IFolderLayout topLeft = factory.createFolder("topLeft", //$NON-NLS-1$
+ IPageLayout.LEFT, 0.4f, factory.getEditorArea());
+ topLeft.addView("org.eclipse.prov.ui.admin.MetadataRepositoriesView"); //$NON-NLS-1$
+ topLeft.addView("org.eclipse.prov.ui.admin.ArtifactRepositoriesView"); //$NON-NLS-1$
+ }
+
+ private void addActionSets() {
+ factory.addActionSet(IPageLayout.ID_NAVIGATE_ACTION_SET); // NON-NLS-1
+ }
+
+ private void addPerspectiveShortcuts() {
+ factory.addPerspectiveShortcut("org.eclipse.ui.resourcePerspective"); //$NON-NLS-1$
+ }
+
+ private void addNewWizardShortcuts() {
+ // factory.addNewWizardShortcut("org.eclipse.ui.wizards.new.folder");//NON-NLS-1
+ }
+
+ private void addViewShortcuts() {
+ factory.addShowViewShortcut("org.eclipse.prov.ui.admin.MetadataRepositoriesView"); //$NON-NLS-1$
+ factory.addShowViewShortcut("org.eclipse.prov.ui.admin.ArtifactRepositoriesView"); //$NON-NLS-1$
+ factory.addShowViewShortcut("org.eclipse.prov.ui.admin.ProfilesView"); //$NON-NLS-1$
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/RepositoriesView.java b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/RepositoriesView.java
new file mode 100644
index 000000000..3c393d59f
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/RepositoriesView.java
@@ -0,0 +1,167 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.admin.internal;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.IUndoableOperation;
+import org.eclipse.equinox.prov.metadata.InstallableUnit;
+import org.eclipse.equinox.prov.ui.*;
+import org.eclipse.equinox.prov.ui.viewers.StructuredViewerProvisioningListener;
+import org.eclipse.jface.action.*;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.dialogs.PropertyDialogAction;
+
+/**
+ * This class supports the common characteristics for views that manipulate
+ * provisioning repositories.
+ *
+ * @since 3.4
+ */
+abstract class RepositoriesView extends ProvView {
+
+ private class RemoveRepositoryAction extends Action {
+ RemoveRepositoryAction() {
+ setText(getRemoveCommandLabel());
+ setToolTipText(getRemoveCommandTooltip());
+ setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
+ setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_DISABLED));
+
+ }
+
+ public void run() {
+ IUndoableOperation op = getRemoveOperation(getSelection().toArray());
+ try {
+ // TODO hook into platform progress service
+ PlatformUI.getWorkbench().getOperationSupport().getOperationHistory().execute(op, null, ProvUI.getUIInfoAdapter(getShell()));
+ } catch (ExecutionException e) {
+ ProvUI.handleException(e.getCause(), null);
+ }
+ }
+ }
+
+ private class AddRepositoryAction extends Action {
+ AddRepositoryAction() {
+ setText(getAddCommandLabel());
+ setToolTipText(getAddCommandTooltip());
+ setImageDescriptor(ProvUIImages.getImageDescriptor(ProvUIImages.IMG_ARTIFACT_REPOSITORY));
+
+ }
+
+ public void run() {
+ openAddRepositoryDialog(getShell(), ((ITreeContentProvider) viewer.getContentProvider()).getElements(null));
+ }
+ }
+
+ private Action addRepositoryAction, removeRepositoryAction;
+ private PropertyDialogAction propertiesAction;
+
+ private StructuredViewerProvisioningListener listener;
+
+ /**
+ * The constructor.
+ */
+ public RepositoriesView() {
+ // nothing to do
+ }
+
+ protected void addListeners() {
+ super.addListeners();
+ listener = new StructuredViewerProvisioningListener(viewer, StructuredViewerProvisioningListener.PROV_EVENT_REPOSITORY);
+ ProvUIActivator.getDefault().addProvisioningListener(listener);
+ }
+
+ protected void removeListeners() {
+ super.removeListeners();
+ ProvUIActivator.getDefault().removeProvisioningListener(listener);
+ }
+
+ protected void fillLocalPullDown(IMenuManager manager) {
+ manager.add(addRepositoryAction);
+ manager.add(removeRepositoryAction);
+ manager.add(propertiesAction);
+ }
+
+ protected void fillContextMenu(IMenuManager manager) {
+ manager.add(addRepositoryAction);
+ if (removeRepositoryAction.isEnabled()) {
+ manager.add(removeRepositoryAction);
+ }
+ if (propertiesAction.isEnabled()) {
+ manager.add(new Separator());
+ manager.add(propertiesAction);
+ }
+ }
+
+ protected void fillLocalToolBar(IToolBarManager manager) {
+ manager.add(addRepositoryAction);
+ manager.add(removeRepositoryAction);
+ }
+
+ protected void makeActions() {
+ super.makeActions();
+ addRepositoryAction = new AddRepositoryAction();
+ removeRepositoryAction = new RemoveRepositoryAction();
+ getViewSite().getActionBars().setGlobalActionHandler(ActionFactory.DELETE.getId(), removeRepositoryAction);
+
+ propertiesAction = new PropertyDialogAction(this.getSite(), viewer);
+ getViewSite().getActionBars().setGlobalActionHandler(ActionFactory.PROPERTIES.getId(), propertiesAction);
+ IStructuredSelection selection = getSelection();
+ if (selection.size() == 1 && isRepository(selection.getFirstElement())) {
+ propertiesAction.setEnabled(true);
+ removeRepositoryAction.setEnabled(true);
+ } else {
+ propertiesAction.setEnabled(false);
+ removeRepositoryAction.setEnabled(false);
+ }
+ viewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ IStructuredSelection ss = (IStructuredSelection) event.getSelection();
+ RepositoriesView.this.selectionChanged(ss);
+ }
+ });
+ }
+
+ protected IAction getDoubleClickAction() {
+ return propertiesAction;
+ }
+
+ protected void selectionChanged(IStructuredSelection selection) {
+ propertiesAction.setEnabled(selection.size() == 1 && ((selection.getFirstElement() instanceof InstallableUnit) || (isRepository(selection.getFirstElement()))));
+ boolean enabled = false;
+ Object[] selectionArray = selection.toArray();
+ for (int i = 0; i < selectionArray.length; i++) {
+ if (!isRepository(selectionArray[i])) {
+ enabled = false;
+ break;
+ }
+ enabled = true;
+ }
+ removeRepositoryAction.setEnabled(enabled);
+ }
+
+ protected abstract int openAddRepositoryDialog(Shell shell, Object[] elements);
+
+ protected abstract IUndoableOperation getRemoveOperation(Object[] elements);
+
+ protected abstract String getAddCommandLabel();
+
+ protected abstract String getAddCommandTooltip();
+
+ protected abstract String getRemoveCommandLabel();
+
+ protected abstract String getRemoveCommandTooltip();
+
+ protected abstract boolean isRepository(Object element);
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/dialogs/AddArtifactRepositoryDialog.java b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/dialogs/AddArtifactRepositoryDialog.java
new file mode 100644
index 000000000..4359dce73
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/dialogs/AddArtifactRepositoryDialog.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.admin.internal.dialogs;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import org.eclipse.core.commands.operations.IUndoableOperation;
+import org.eclipse.equinox.prov.artifact.repository.IArtifactRepository;
+import org.eclipse.equinox.prov.ui.ProvUI;
+import org.eclipse.equinox.prov.ui.admin.internal.ProvAdminUIMessages;
+import org.eclipse.equinox.prov.ui.dialogs.AddRepositoryDialog;
+import org.eclipse.equinox.prov.ui.operations.AddArtifactRepositoryOperation;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * Dialog that allows an artifact repository to be defined and added.
+ *
+ * @since 3.4
+ *
+ */
+public class AddArtifactRepositoryDialog extends AddRepositoryDialog {
+
+ public AddArtifactRepositoryDialog(Shell parentShell, IArtifactRepository[] knownRepositories) {
+ super(parentShell, knownRepositories);
+ }
+
+ protected IUndoableOperation getOperation(URL url, String name) {
+ return new AddArtifactRepositoryOperation(ProvAdminUIMessages.AddArtifactRepositoryDialog_OperationLabel, url, name);
+ }
+
+ protected URL makeRepositoryURL(String urlString) {
+ try {
+ return new URL(urlString);
+ } catch (MalformedURLException e) {
+ // TODO need friendlier user message rather than just reporting exception
+ ProvUI.handleException(e, ProvAdminUIMessages.AddRepositoryDialog_InvalidURL);
+ return null;
+ }
+ }
+
+ protected String repositoryFileName() {
+ return null;
+ }
+
+ protected boolean repositoryIsFile() {
+ return false;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/dialogs/AddMetadataRepositoryDialog.java b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/dialogs/AddMetadataRepositoryDialog.java
new file mode 100644
index 000000000..f226b99c5
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/dialogs/AddMetadataRepositoryDialog.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.admin.internal.dialogs;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import org.eclipse.core.commands.operations.IUndoableOperation;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepository;
+import org.eclipse.equinox.prov.ui.ProvUI;
+import org.eclipse.equinox.prov.ui.admin.internal.ProvAdminUIMessages;
+import org.eclipse.equinox.prov.ui.dialogs.AddRepositoryDialog;
+import org.eclipse.equinox.prov.ui.operations.AddMetadataRepositoryOperation;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * Dialog that allows a metadata repository to be defined and added.
+ *
+ * @since 3.4
+ *
+ */
+public class AddMetadataRepositoryDialog extends AddRepositoryDialog {
+
+ public AddMetadataRepositoryDialog(Shell parentShell, IMetadataRepository[] knownRepositories) {
+ super(parentShell, knownRepositories);
+ }
+
+ protected IUndoableOperation getOperation(URL url, String name) {
+ return new AddMetadataRepositoryOperation(ProvAdminUIMessages.AddMetadataRepositoryDialog_OperationLabel, url, name);
+ }
+
+ protected URL makeRepositoryURL(String urlString) {
+ try {
+ return new URL(urlString);
+ } catch (MalformedURLException e) {
+ // TODO need friendlier user message rather than just reporting exception
+ ProvUI.handleException(e, ProvAdminUIMessages.AddRepositoryDialog_InvalidURL);
+ return null;
+ }
+ }
+
+ protected String repositoryFileName() {
+ return null;
+ }
+
+ protected boolean repositoryIsFile() {
+ return false;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/dialogs/AddProfileDialog.java b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/dialogs/AddProfileDialog.java
new file mode 100644
index 000000000..55affe105
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/dialogs/AddProfileDialog.java
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.admin.internal.dialogs;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.IUndoableOperation;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.ui.ProvUI;
+import org.eclipse.equinox.prov.ui.admin.ProvAdminUIActivator;
+import org.eclipse.equinox.prov.ui.admin.internal.ProvAdminUIMessages;
+import org.eclipse.equinox.prov.ui.dialogs.ProfileGroup;
+import org.eclipse.equinox.prov.ui.operations.AddProfileOperation;
+import org.eclipse.jface.dialogs.*;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Dialog that allows a profile to be defined and added.
+ *
+ * @since 3.4
+ *
+ */
+public class AddProfileDialog extends StatusDialog {
+
+ private ProfileGroup profileGroup;
+ private Button okButton;
+ private Profile[] knownProfiles;
+ private Profile addedProfile;
+
+ public AddProfileDialog(Shell parentShell, Profile[] knownProfiles) {
+
+ super(parentShell);
+ this.knownProfiles = knownProfiles;
+ setTitle(ProvAdminUIMessages.AddProfileDialog_Title);
+ }
+
+ protected void createButtonsForButtonBar(Composite parent) {
+ okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
+ createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
+ }
+
+ protected Control createDialogArea(Composite parent) {
+ profileGroup = new ProfileGroup(parent, null, new ModifyListener() {
+ public void modifyText(ModifyEvent event) {
+ verifyComplete();
+ }
+ });
+ Dialog.applyDialogFont(profileGroup.getComposite());
+ return profileGroup.getComposite();
+ }
+
+ protected void okPressed() {
+ if (addProfile()) {
+ super.okPressed();
+ }
+ }
+
+ /*
+ * We only get here if already validated (ok was pressed)
+ */
+ private boolean addProfile() {
+ profileGroup.updateProfile();
+ addedProfile = profileGroup.getProfile();
+ if (addedProfile == null) {
+ return false;
+ }
+ IUndoableOperation op = new AddProfileOperation(ProvAdminUIMessages.AddProfileDialog_OperationLabel, addedProfile);
+ try {
+ // TODO hook into platform progress service
+ PlatformUI.getWorkbench().getOperationSupport().getOperationHistory().execute(op, null, ProvUI.getUIInfoAdapter(getShell()));
+ } catch (ExecutionException e) {
+ ProvUI.handleException(e.getCause(), null);
+ return false;
+ }
+ return true;
+
+ }
+
+ void verifyComplete() {
+ if (okButton == null) {
+ return;
+ }
+ IStatus status = profileGroup.verify();
+ if (!status.isOK()) {
+ this.updateStatus(status);
+ setOkEnablement(false);
+ return;
+ }
+ if (isDuplicate()) {
+ return;
+ }
+ okButton.setEnabled(true);
+ this.updateStatus(new Status(IStatus.OK, ProvAdminUIActivator.PLUGIN_ID, IStatus.OK, "", null)); //$NON-NLS-1$
+
+ }
+
+ private boolean isDuplicate() {
+ if (knownProfiles == null) {
+ return false;
+ }
+
+ for (int i = 0; i < knownProfiles.length; i++) {
+ if (knownProfiles[i].getProfileId().equals(profileGroup.getProfileId())) {
+ setOkEnablement(false);
+ this.updateStatus(new Status(IStatus.ERROR, ProvAdminUIActivator.PLUGIN_ID, IStatus.OK, ProvAdminUIMessages.AddProfileDialog_DuplicateProfileID, null));
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected void updateButtonsEnableState(IStatus status) {
+ setOkEnablement(!status.matches(IStatus.ERROR));
+ }
+
+ protected void setOkEnablement(boolean enable) {
+ if (okButton != null && !okButton.isDisposed())
+ okButton.setEnabled(enable);
+ }
+
+ /**
+ * Return the profile that was added with this dialog, or null
+ * if no profile has been added. This method will not return
+ * a valid profile until the user has pressed OK and the profile
+ * has been added to the profile registry.
+ * @return the added profile
+ */
+ public Profile getAddedProfile() {
+ return addedProfile;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/dialogs/UpdateAndInstallDialog.java b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/dialogs/UpdateAndInstallDialog.java
new file mode 100644
index 000000000..a09e789f7
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/dialogs/UpdateAndInstallDialog.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.admin.internal.dialogs;
+
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.ui.admin.ProvAdminUIActivator;
+import org.eclipse.equinox.prov.ui.admin.internal.ProvAdminUIMessages;
+import org.eclipse.equinox.prov.ui.admin.internal.preferences.PreferenceConstants;
+import org.eclipse.equinox.prov.ui.dialogs.UpdateAndInstallGroup;
+import org.eclipse.equinox.prov.ui.viewers.IUGroupFilter;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.TrayDialog;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.swt.graphics.FontMetrics;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.widgets.*;
+
+/**
+ * Dialog that allows users to update their installed IU's or find new ones.
+ *
+ * @since 3.4
+ */
+public class UpdateAndInstallDialog extends TrayDialog {
+
+ private final static int TAB_WIDTH_IN_DLUS = 480;
+ private final static int TAB_HEIGHT_IN_DLUS = 240;
+ private Profile profile;
+
+ /**
+ * Create an instance of this Dialog.
+ *
+ */
+ public UpdateAndInstallDialog(Shell shell, Profile profile) {
+ super(shell);
+ this.profile = profile;
+ }
+
+ protected void configureShell(Shell shell) {
+ shell.setText(ProvAdminUIMessages.Ops_InstallIUOperationLabel);
+ super.configureShell(shell);
+ }
+
+ protected Control createDialogArea(Composite parent) {
+ GC gc = new GC(parent);
+ gc.setFont(JFaceResources.getDialogFont());
+ FontMetrics fontMetrics = gc.getFontMetrics();
+ gc.dispose();
+
+ IPreferenceStore store = ProvAdminUIActivator.getDefault().getPreferenceStore();
+ ViewerFilter[] filters = null;
+ if (store.getBoolean(PreferenceConstants.PREF_SHOW_GROUPS_ONLY)) {
+ filters = new ViewerFilter[] {new IUGroupFilter()};
+ }
+ UpdateAndInstallGroup group = new UpdateAndInstallGroup(parent, profile, filters, filters, ProvAdminUIMessages.UpdateAndInstallDialog_InstalledIUsPageLabel, ProvAdminUIMessages.UpdateAndInstallDialog_AvailableIUsPageLabel, null, null, TAB_WIDTH_IN_DLUS, TAB_HEIGHT_IN_DLUS, fontMetrics);
+ Dialog.applyDialogFont(group.getControl());
+ return group.getControl();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.dialogs.Dialog#isResizable()
+ */
+ protected boolean isResizable() {
+ return true;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/messages.properties b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/messages.properties
new file mode 100644
index 000000000..cfa8be90e
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/messages.properties
@@ -0,0 +1,54 @@
+###############################################################################
+# Copyright (c) 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+
+ProvisioningPrefPage_Description=Provisioning
+ProvisioningPrefPage_ConfirmSelectionInstallOps=&Confirm install and uninstall operations
+ProvisioningPrefPage_ShowGroupsOnly=Show only &group IU's
+ProvisioningPrefPage_HideInternalRepos=Hide internal repositories in repository views
+AddRepositoryDialog_InvalidURL=Invalid URL
+AddProfileDialog_Title=Add Profile
+AddProfileDialog_OperationLabel=Add Profile
+AddMetadataRepositoryDialog_OperationLabel=Add Metadata Repository
+AddArtifactRepositoryDialog_OperationLabel=Add Artifact Repository
+MetadataRepositoriesView_AddRepositoryLabel=Add repository...
+MetadataRepositoriesView_AddRepositoryTooltip=Add a new metadata repository
+MetadataRepositoriesView_RemoveRepositoryLabel=Remove
+MetadataRepositoriesView_RemoveRepositoryTooltip=Remove the selected metadata repositories
+MetadataRepositoriesView_ChooseProfileDialogTitle=Choose Profile
+MetadataRepositoriesView_RemoveRepositoryOperationLabel=Remove Metadata Repositories
+ArtifactRepositoriesView_AddRepositoryLabel=Add repository...
+ArtifactRepositoriesView_AddRepositoryTooltip=Add a new artifact repository
+ArtifactRepositoriesView_RemoveRepositoryLabel=Remove repositories
+ArtifactRepositoriesView_RemoveRepositoryTooltip=Remove the selected artifact repositories
+ArtifactRepositoriesView_RemoveRepositoryOperationLabel=Remove Artifact Repositories
+ProfilesView_AddProfileTooltip=Add profile...
+ProvView_RefreshCommandTooltip=Refresh the items in the view.
+ProfilesView_AddProfileLabel=Add a new profile
+ProvView_RefreshCommandLabel=Refresh
+ProfilesView_RemoveProfileLabel=Remove
+ProfilesView_RemoveProfileTooltip=Remove the selected profiles
+ProfilesView_ConfirmUninstallMessage=Uninstall selected IU's?
+AddProfileDialog_DuplicateProfileID=The profile ID is already in use.
+Ops_RemoveProfileOperationLabel=Remove Profiles
+Ops_ConfirmIUInstall=Install selected IUs into {0}?
+ProfilesView_AlwaysConfirmSelectionInstallOps=Always confirm install and uninstall operations
+UpdateAndInstallDialog_InstalledIUsPageLabel=Installed IUs
+UpdateAndInstallDialog_AvailableIUsPageLabel=Available IUs
+Ops_InstallIUOperationLabel=Install
+InstallIUCommandLabel=&Install...
+InstallIUCommandTooltip=Install the selected IUs
+BecomeIUCommandLabel=&Become...
+Ops_UninstallIUOperationLabel=Uninstall
+UninstallIUCommandLabel=&Uninstall...
+UninstallIUCommandTooltip=Uninstall the selected IUs
+Ops_UpdateIUOperationLabel=Update
+UpdateIUCommandLabel=Check for u&pdates...
+UpdateIUCommandTooltip=See if updates are available for the selected IUs
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/preferences/PreferenceConstants.java b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/preferences/PreferenceConstants.java
new file mode 100644
index 000000000..628c1fb77
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/preferences/PreferenceConstants.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.admin.internal.preferences;
+
+/**
+ * Constant definitions for plug-in preferences
+ */
+public class PreferenceConstants {
+
+ public static final String PREF_CONFIRM_SELECTION_INSTALL = "org.eclipse.equinox.prov.ui.admin.confirmDragInstall"; //$NON-NLS-1$
+ public static final String PREF_SHOW_GROUPS_ONLY = "org.eclipse.equinox.prov.ui.admin.showGroupsOnly"; //$NON-NLS-1$
+ public static final String PREF_HIDE_IMPLEMENTATION_REPOS = "org.eclipse.equinox.prov.ui.admin.hideImplementationRepos"; //$NON-NLS-1$
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/preferences/ProvUIPreferenceInitializer.java b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/preferences/ProvUIPreferenceInitializer.java
new file mode 100644
index 000000000..ab9b5043d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/preferences/ProvUIPreferenceInitializer.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.admin.internal.preferences;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.equinox.prov.ui.admin.ProvAdminUIActivator;
+import org.eclipse.jface.preference.IPreferenceStore;
+
+/**
+ * Initializes the preferences for the provisioning UI.
+ * @since 3.4
+ *
+ */
+public class ProvUIPreferenceInitializer extends AbstractPreferenceInitializer {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
+ */
+ public void initializeDefaultPreferences() {
+ IPreferenceStore store = ProvAdminUIActivator.getDefault().getPreferenceStore();
+ store.setDefault(PreferenceConstants.PREF_CONFIRM_SELECTION_INSTALL, true);
+ store.setDefault(PreferenceConstants.PREF_SHOW_GROUPS_ONLY, true);
+ store.setDefault(PreferenceConstants.PREF_HIDE_IMPLEMENTATION_REPOS, true);
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/preferences/ProvisioningPrefPage.java b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/preferences/ProvisioningPrefPage.java
new file mode 100644
index 000000000..68dffc4b9
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/prov/ui/admin/internal/preferences/ProvisioningPrefPage.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.admin.internal.preferences;
+
+import org.eclipse.equinox.prov.ui.admin.ProvAdminUIActivator;
+import org.eclipse.equinox.prov.ui.admin.internal.ProvAdminUIMessages;
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+/**
+ * Preference page for provisioning preferences.
+ *
+ * @since 3.4
+ */
+
+public class ProvisioningPrefPage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
+
+ public ProvisioningPrefPage() {
+ super(GRID);
+ setPreferenceStore(ProvAdminUIActivator.getDefault().getPreferenceStore());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
+ */
+ public void createFieldEditors() {
+ addField(new BooleanFieldEditor(PreferenceConstants.PREF_CONFIRM_SELECTION_INSTALL, ProvAdminUIMessages.ProvisioningPrefPage_ConfirmSelectionInstallOps, getFieldEditorParent()));
+ addField(new BooleanFieldEditor(PreferenceConstants.PREF_SHOW_GROUPS_ONLY, ProvAdminUIMessages.ProvisioningPrefPage_ShowGroupsOnly, getFieldEditorParent()));
+ addField(new BooleanFieldEditor(PreferenceConstants.PREF_HIDE_IMPLEMENTATION_REPOS, ProvAdminUIMessages.ProvisioningPrefPage_HideInternalRepos, getFieldEditorParent()));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ */
+ public void init(IWorkbench workbench) {
+ // nothing to do
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/.classpath b/bundles/org.eclipse.equinox.p2.ui.sdk/.classpath
new file mode 100644
index 000000000..ce7393340
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/.cvsignore b/bundles/org.eclipse.equinox.p2.ui.sdk/.cvsignore
new file mode 100644
index 000000000..c5e82d745
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk/.cvsignore
@@ -0,0 +1 @@
+bin \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/.project b/bundles/org.eclipse.equinox.p2.ui.sdk/.project
new file mode 100644
index 000000000..a369fefa9
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.equinox.prov.ui.sdk</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.ui.sdk/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..a4650cde7
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,330 @@
+#Tue Sep 18 21:25:49 EDT 2007
+eclipse.preferences.version=1
+org.eclipse.jdt.core.builder.cleanOutputFolder=clean
+org.eclipse.jdt.core.builder.duplicateResourceTask=warning
+org.eclipse.jdt.core.builder.invalidClasspath=abort
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
+org.eclipse.jdt.core.circularClasspath=error
+org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
+org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=error
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=false
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false
+org.eclipse.jdt.core.formatter.comment.format_line_comments=false
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=800
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.incompatibleJDKLevel=ignore
+org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.p2.ui.sdk/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 000000000..2ee161f08
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,57 @@
+#Sun Sep 23 11:59:31 EDT 2007
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_core
+formatter_settings_version=11
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=;
+org.eclipse.jdt.ui.ondemandthreshold=3
+org.eclipse.jdt.ui.staticondemandthreshold=3
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates/>
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.format_source_code=true
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_variable_declarations_final=true
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=false
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.ui.sdk/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..156411c32
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk/META-INF/MANIFEST.MF
@@ -0,0 +1,34 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %bundleName
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Bundle-SymbolicName: org.eclipse.equinox.prov.ui.sdk;singleton:=true
+Bundle-Version: 0.1.0.qualifier
+Bundle-Activator: org.eclipse.equinox.prov.ui.internal.sdk.ProvSDKUIActivator
+Import-Package: org.eclipse.equinox.prov.artifact.repository,
+ org.eclipse.equinox.prov.core,
+ org.eclipse.equinox.prov.core.eventbus,
+ org.eclipse.equinox.prov.core.helpers,
+ org.eclipse.equinox.prov.core.repository,
+ org.eclipse.equinox.prov.director,
+ org.eclipse.equinox.prov.engine,
+ org.eclipse.equinox.prov.metadata,
+ org.eclipse.equinox.prov.metadata.repository,
+ org.eclipse.equinox.prov.query,
+ org.eclipse.equinox.prov.ui,
+ org.eclipse.equinox.prov.ui.actions,
+ org.eclipse.equinox.prov.ui.dialogs,
+ org.eclipse.equinox.prov.ui.model,
+ org.eclipse.equinox.prov.ui.operations,
+ org.eclipse.equinox.prov.ui.viewers,
+ org.eclipse.osgi.service.resolver;version="1.1.0",
+ org.eclipse.osgi.util;version="1.1.0",
+ org.osgi.framework;version="1.3.0",
+ org.osgi.service.packageadmin;version="1.2.0"
+Export-Package: org.eclipse.equinox.prov.ui.internal.sdk;x-internal:=true
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime
+Eclipse-LazyStart: true
+Bundle-RequiredExecutionEnvironment: J2SE-1.4,
+ CDC-1.1/Foundation-1.1
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/about.html b/bundles/org.eclipse.equinox.p2.ui.sdk/about.html
new file mode 100644
index 000000000..460233046
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 2, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/build.properties b/bundles/org.eclipse.equinox.p2.ui.sdk/build.properties
new file mode 100644
index 000000000..137776701
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk/build.properties
@@ -0,0 +1,18 @@
+###############################################################################
+# Copyright (c) 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+bin.includes = plugin.properties,\
+ icons/,\
+ .,\
+ about.html,\
+ META-INF/,\
+ plugin.xml
+src.includes = about.html
+source.. = src/
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/plugin.properties b/bundles/org.eclipse.equinox.p2.ui.sdk/plugin.properties
new file mode 100644
index 000000000..ea9a7b6e5
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk/plugin.properties
@@ -0,0 +1,19 @@
+###############################################################################
+# Copyright (c) 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+#
+# Provisioning UI plugin resources
+#
+providerName=Eclipse.org
+bundleName=Provisioning SDK UI (Incubation)
+Profile.name=Install Location
+IU.name=Feature
+Repository.name=Site
+Update.command=Software Updates (Incubation)... \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/plugin.xml b/bundles/org.eclipse.equinox.p2.ui.sdk/plugin.xml
new file mode 100644
index 000000000..1eef16c6f
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk/plugin.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.propertyPages">
+ <page
+ name="%Profile.name"
+ class="org.eclipse.equinox.prov.ui.dialogs.ProfilePropertyPage"
+ id="org.eclipse.equinox.prov.ui.internal.sdk.ProfilePropertyPage">
+ <enabledWhen>
+ <instanceof
+ value="org.eclipse.equinox.prov.engine.Profile">
+ </instanceof>
+ </enabledWhen>
+ </page>
+ <page
+ name="%IU.name"
+ class="org.eclipse.equinox.prov.ui.dialogs.IUPropertyPage"
+ id="org.eclipse.equinox.prov.ui.internal.sdk.IUPropertyPage">
+ <enabledWhen>
+ <or>
+ <instanceof
+ value="org.eclipse.equinox.prov.metadata.InstallableUnit">
+ </instanceof>
+ <instanceof
+ value="org.eclipse.equinox.prov.ui.model.InstalledIUElement">
+ </instanceof>
+
+ </or>
+ </enabledWhen>
+ </page>
+
+ <page
+ name="%Repository.name"
+ class="org.eclipse.equinox.prov.ui.dialogs.ColocatedRepositoryPropertyPage"
+ id="org.eclipse.equinox.prov.ui.internal.sdk.ColocatedRepositoryPropertyPage">
+ <enabledWhen>
+ <instanceof
+ value="org.eclipse.equinox.prov.metadata.repository.IMetadataRepository">
+ </instanceof>
+ </enabledWhen>
+ </page>
+
+ </extension>
+
+
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ name="%Update.command"
+ id="org.eclipse.equinox.prov.ui.sdk.update">
+ </command>
+ </extension>
+ <extension
+ point="org.eclipse.ui.handlers">
+ <handler
+ commandId="org.eclipse.equinox.prov.ui.sdk.update"
+ class="org.eclipse.equinox.prov.ui.internal.sdk.UpdateHandler">
+ </handler>
+ </extension>
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ locationURI="menu:help?after=additions">
+ <command
+ commandId="org.eclipse.equinox.prov.ui.sdk.update"
+ id="org.eclipse.equinox.prov.ui.sdk.update">
+ </command>
+ </menuContribution>
+ </extension>
+
+</plugin>
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/prov/ui/internal/sdk/ProvSDKMessages.java b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/prov/ui/internal/sdk/ProvSDKMessages.java
new file mode 100644
index 000000000..c4c534a6b
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/prov/ui/internal/sdk/ProvSDKMessages.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.prov.ui.internal.sdk;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Message class for provisioning UI messages.
+ *
+ * @since 3.4
+ */
+public class ProvSDKMessages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.equinox.prov.ui.internal.sdk.messages"; //$NON-NLS-1$
+ static {
+ // load message values from bundle file
+ NLS.initializeMessages(BUNDLE_NAME, ProvSDKMessages.class);
+ }
+ public static String RepositoryManipulationDialog_UpdateSitesDialogTitle;
+ public static String UpdateAndInstallDialog_AvailableFeatures;
+ public static String UpdateAndInstallDialog_InstalledFeatures;
+ public static String UpdateAndInstallDialog_ManageSites;
+ public static String UpdateAndInstallDialog_Title;
+ public static String UpdateHandler_NoProfilesDefined;
+ public static String UpdateHandler_NoProfileInstanceDefined;
+ public static String UpdateHandler_SDKUpdateUIMessageTitle;
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/prov/ui/internal/sdk/ProvSDKUIActivator.java b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/prov/ui/internal/sdk/ProvSDKUIActivator.java
new file mode 100644
index 000000000..13bd46d9d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/prov/ui/internal/sdk/ProvSDKUIActivator.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.internal.sdk;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * Activator class for the admin UI.
+ */
+public class ProvSDKUIActivator extends AbstractUIPlugin {
+
+ private static ProvSDKUIActivator plugin;
+ private static BundleContext context;
+
+ public static final String PLUGIN_ID = "org.eclipse.equinox.prov.ui.sdk"; //$NON-NLS-1$
+
+ public static BundleContext getContext() {
+ return context;
+ }
+
+ /**
+ * Returns the singleton plugin instance
+ *
+ * @return the instance
+ */
+ public static ProvSDKUIActivator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given plug-in
+ * relative path
+ *
+ * @param path
+ * the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+
+ public ProvSDKUIActivator() {
+ // constructor
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext bundleContext) throws Exception {
+ super.start(bundleContext);
+ plugin = this;
+ ProvSDKUIActivator.context = bundleContext;
+ }
+
+ public void stop(BundleContext bundleContext) throws Exception {
+ plugin = null;
+ super.stop(bundleContext);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/prov/ui/internal/sdk/RepositoryManipulationDialog.java b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/prov/ui/internal/sdk/RepositoryManipulationDialog.java
new file mode 100644
index 000000000..43cbf9d23
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/prov/ui/internal/sdk/RepositoryManipulationDialog.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.internal.sdk;
+
+import org.eclipse.equinox.prov.ui.dialogs.ColocatedRepositoryManipulatorGroup;
+import org.eclipse.equinox.prov.ui.viewers.InternalRepositoryFilter;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.TrayDialog;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.swt.graphics.FontMetrics;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.widgets.*;
+
+/**
+ * Dialog that allows users to update, add, or remove repositories.
+ *
+ * @since 3.4
+ */
+public class RepositoryManipulationDialog extends TrayDialog {
+
+ private final static int WIDTH_IN_DLUS = 480;
+ private final static int HEIGHT_IN_DLUS = 240;
+
+ /**
+ * Create an instance of this Dialog.
+ *
+ */
+ public RepositoryManipulationDialog(Shell shell) {
+ super(shell);
+ }
+
+ protected void configureShell(Shell shell) {
+ shell.setText(ProvSDKMessages.RepositoryManipulationDialog_UpdateSitesDialogTitle);
+ super.configureShell(shell);
+ }
+
+ protected Control createDialogArea(Composite parent) {
+ GC gc = new GC(parent);
+ gc.setFont(JFaceResources.getDialogFont());
+ FontMetrics fontMetrics = gc.getFontMetrics();
+ gc.dispose();
+
+ ColocatedRepositoryManipulatorGroup group = new ColocatedRepositoryManipulatorGroup(parent, new ViewerFilter[] {new InternalRepositoryFilter()}, WIDTH_IN_DLUS, HEIGHT_IN_DLUS, fontMetrics);
+ Dialog.applyDialogFont(group.getControl());
+ return group.getControl();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.dialogs.Dialog#isResizable()
+ */
+ protected boolean isResizable() {
+ return true;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/prov/ui/internal/sdk/UpdateAndInstallDialog.java b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/prov/ui/internal/sdk/UpdateAndInstallDialog.java
new file mode 100644
index 000000000..c07a2fdcd
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/prov/ui/internal/sdk/UpdateAndInstallDialog.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.internal.sdk;
+
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.IInstallableUnitConstants;
+import org.eclipse.equinox.prov.ui.IRepositoryManipulator;
+import org.eclipse.equinox.prov.ui.dialogs.UpdateAndInstallGroup;
+import org.eclipse.equinox.prov.ui.viewers.IUPropertyFilter;
+import org.eclipse.equinox.prov.ui.viewers.IUGroupFilter;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.TrayDialog;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.swt.graphics.FontMetrics;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.widgets.*;
+
+/**
+ * Dialog that allows users to update their installed IU's or find new ones.
+ *
+ * @since 3.4
+ */
+public class UpdateAndInstallDialog extends TrayDialog {
+
+ private final static int TAB_WIDTH_IN_DLUS = 480;
+ private final static int TAB_HEIGHT_IN_DLUS = 240;
+ private Profile profile;
+
+ /**
+ * Create an instance of this Dialog.
+ *
+ */
+ public UpdateAndInstallDialog(Shell shell, Profile profile) {
+ super(shell);
+ this.profile = profile;
+ }
+
+ protected void configureShell(Shell shell) {
+ shell.setText(ProvSDKMessages.UpdateAndInstallDialog_Title);
+ super.configureShell(shell);
+ }
+
+ protected Control createDialogArea(Composite parent) {
+ GC gc = new GC(parent);
+ gc.setFont(JFaceResources.getDialogFont());
+ FontMetrics fontMetrics = gc.getFontMetrics();
+ gc.dispose();
+
+ ViewerFilter filter = new IUPropertyFilter(IInstallableUnitConstants.ENTRYPOINT_IU_KEY, Boolean.toString(true));
+ UpdateAndInstallGroup group = new UpdateAndInstallGroup(parent, profile, new ViewerFilter[] {filter}, new ViewerFilter[] {new IUGroupFilter()}, ProvSDKMessages.UpdateAndInstallDialog_InstalledFeatures, ProvSDKMessages.UpdateAndInstallDialog_AvailableFeatures, getRepositoryManipulator(), null, TAB_WIDTH_IN_DLUS, TAB_HEIGHT_IN_DLUS, fontMetrics);
+ Dialog.applyDialogFont(group.getControl());
+ return group.getControl();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.dialogs.Dialog#isResizable()
+ */
+ protected boolean isResizable() {
+ return true;
+ }
+
+ private IRepositoryManipulator getRepositoryManipulator() {
+ return new IRepositoryManipulator() {
+ public String getLabel() {
+ return ProvSDKMessages.UpdateAndInstallDialog_ManageSites;
+
+ }
+
+ public boolean manipulateRepositories(Shell shell) {
+ new RepositoryManipulationDialog(shell).open();
+ return true;
+ }
+
+ };
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/prov/ui/internal/sdk/UpdateHandler.java b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/prov/ui/internal/sdk/UpdateHandler.java
new file mode 100644
index 000000000..83452419b
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/prov/ui/internal/sdk/UpdateHandler.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.internal.sdk;
+
+import org.eclipse.core.commands.*;
+import org.eclipse.equinox.prov.core.ProvisionException;
+import org.eclipse.equinox.prov.engine.IProfileRegistry;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.ui.ProvisioningUtil;
+import org.eclipse.equinox.prov.ui.model.AllProfiles;
+import org.eclipse.equinox.prov.ui.model.ProfileFactory;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * UpdateHandler invokes the new provisioning update UI.
+ *
+ * @since 3.4
+ */
+public class UpdateHandler extends AbstractHandler {
+
+ private static final String DEFAULT_PROFILE_ID = "DefaultProfile"; //$NON-NLS-1$
+
+ /**
+ * The constructor.
+ */
+ public UpdateHandler() {
+ // constructor
+ }
+
+ /**
+ * Execute the update command.
+ */
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
+ Profile profile = null;
+ String message = null;
+ // Get the profile of the running system.
+ try {
+ profile = ProvisioningUtil.getProfile(IProfileRegistry.SELF);
+ } catch (ProvisionException e) {
+ profile = null;
+ message = ProvSDKMessages.UpdateHandler_NoProfilesDefined;
+ }
+ if (profile == null) {
+ profile = getAnyProfile();
+ }
+
+ if (profile != null) {
+ UpdateAndInstallDialog dialog = new UpdateAndInstallDialog(shell, profile);
+ dialog.open();
+ } else {
+ if (message == null)
+ message = ProvSDKMessages.UpdateHandler_NoProfileInstanceDefined;
+ MessageDialog.openInformation(shell, ProvSDKMessages.UpdateHandler_SDKUpdateUIMessageTitle, message);
+ }
+ return null;
+ }
+
+ // TODO this is temporary so the UI will come up on something
+ private Profile getAnyProfile() {
+ Profile[] profiles = (Profile[]) new AllProfiles().getChildren(null);
+ if (profiles.length > 0)
+ return profiles[0];
+ return ProfileFactory.makeProfile(DEFAULT_PROFILE_ID);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/prov/ui/internal/sdk/messages.properties b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/prov/ui/internal/sdk/messages.properties
new file mode 100644
index 000000000..ee6f052ed
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/prov/ui/internal/sdk/messages.properties
@@ -0,0 +1,18 @@
+###############################################################################
+# Copyright (c) 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+UpdateAndInstallDialog_InstalledFeatures=Installed Features
+UpdateAndInstallDialog_AvailableFeatures=Available Features
+UpdateAndInstallDialog_Title=Software Updates and Add-ons
+UpdateAndInstallDialog_ManageSites=Manage sites...
+UpdateHandler_SDKUpdateUIMessageTitle=Software Updates
+UpdateHandler_NoProfilesDefined=There are no profiles defined. Cannot invoke the update UI.
+UpdateHandler_NoProfileInstanceDefined=The software configuration could not be found. Cannot invoke the update UI.
+RepositoryManipulationDialog_UpdateSitesDialogTitle=Update Sites
diff --git a/bundles/org.eclipse.equinox.p2.ui/.classpath b/bundles/org.eclipse.equinox.p2.ui/.classpath
new file mode 100644
index 000000000..ce7393340
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.equinox.p2.ui/.cvsignore b/bundles/org.eclipse.equinox.p2.ui/.cvsignore
new file mode 100644
index 000000000..c5e82d745
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/.cvsignore
@@ -0,0 +1 @@
+bin \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.ui/.project b/bundles/org.eclipse.equinox.p2.ui/.project
new file mode 100644
index 000000000..3ded96843
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.equinox.prov.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.equinox.p2.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.ui/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..a6b401a0d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,330 @@
+#Tue Sep 18 21:22:20 EDT 2007
+eclipse.preferences.version=1
+org.eclipse.jdt.core.builder.cleanOutputFolder=clean
+org.eclipse.jdt.core.builder.duplicateResourceTask=warning
+org.eclipse.jdt.core.builder.invalidClasspath=abort
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
+org.eclipse.jdt.core.circularClasspath=error
+org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
+org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=error
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=false
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false
+org.eclipse.jdt.core.formatter.comment.format_line_comments=false
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=800
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.incompatibleJDKLevel=ignore
+org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/bundles/org.eclipse.equinox.p2.ui/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.p2.ui/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 000000000..dbe72f165
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,57 @@
+#Sun Sep 23 11:59:14 EDT 2007
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_core
+formatter_settings_version=11
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=;
+org.eclipse.jdt.ui.ondemandthreshold=3
+org.eclipse.jdt.ui.staticondemandthreshold=3
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates/>
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.format_source_code=true
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_variable_declarations_final=true
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=false
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/bundles/org.eclipse.equinox.p2.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.ui/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..eaab7942f
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,35 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %bundleName
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Bundle-SymbolicName: org.eclipse.equinox.prov.ui;singleton:=true
+Bundle-Version: 0.1.0.qualifier
+Bundle-Activator: org.eclipse.equinox.prov.ui.ProvUIActivator
+Import-Package: org.eclipse.equinox.prov.artifact.repository,
+ org.eclipse.equinox.prov.core,
+ org.eclipse.equinox.prov.core.eventbus,
+ org.eclipse.equinox.prov.core.helpers,
+ org.eclipse.equinox.prov.core.repository,
+ org.eclipse.equinox.prov.director,
+ org.eclipse.equinox.prov.engine,
+ org.eclipse.equinox.prov.metadata,
+ org.eclipse.equinox.prov.metadata.repository,
+ org.eclipse.equinox.prov.query,
+ org.eclipse.equinox.configurator,
+ org.eclipse.osgi.service.resolver;version="1.1.0",
+ org.eclipse.osgi.util;version="1.1.0",
+ org.osgi.framework;version="1.3.0",
+ org.osgi.service.packageadmin;version="1.2.0"
+Export-Package: org.eclipse.equinox.prov.ui,
+ org.eclipse.equinox.prov.ui.actions,
+ org.eclipse.equinox.prov.ui.dialogs,
+ org.eclipse.equinox.prov.ui.internal;x-internal:=true,
+ org.eclipse.equinox.prov.ui.model,
+ org.eclipse.equinox.prov.ui.operations,
+ org.eclipse.equinox.prov.ui.viewers
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.equinox.simpleconfigurator
+Eclipse-LazyStart: true
+Bundle-RequiredExecutionEnvironment: J2SE-1.4
diff --git a/bundles/org.eclipse.equinox.p2.ui/about.html b/bundles/org.eclipse.equinox.p2.ui/about.html
new file mode 100644
index 000000000..460233046
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 2, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.ui/build.properties b/bundles/org.eclipse.equinox.p2.ui/build.properties
new file mode 100644
index 000000000..b404b0288
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/build.properties
@@ -0,0 +1,17 @@
+###############################################################################
+# Copyright (c) 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+bin.includes = plugin.properties,\
+ icons/,\
+ .,\
+ about.html,\
+ META-INF/
+src.includes = about.html
+source.. = src/
diff --git a/bundles/org.eclipse.equinox.p2.ui/icons/obj/artifact_repo_obj.gif b/bundles/org.eclipse.equinox.p2.ui/icons/obj/artifact_repo_obj.gif
new file mode 100644
index 000000000..0470e1588
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/icons/obj/artifact_repo_obj.gif
Binary files differ
diff --git a/bundles/org.eclipse.equinox.p2.ui/icons/obj/iu_obj.gif b/bundles/org.eclipse.equinox.p2.ui/icons/obj/iu_obj.gif
new file mode 100644
index 000000000..8706680c7
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/icons/obj/iu_obj.gif
Binary files differ
diff --git a/bundles/org.eclipse.equinox.p2.ui/icons/obj/metadata_repo_obj.gif b/bundles/org.eclipse.equinox.p2.ui/icons/obj/metadata_repo_obj.gif
new file mode 100644
index 000000000..b8568f4f8
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/icons/obj/metadata_repo_obj.gif
Binary files differ
diff --git a/bundles/org.eclipse.equinox.p2.ui/icons/obj/profile_obj.gif b/bundles/org.eclipse.equinox.p2.ui/icons/obj/profile_obj.gif
new file mode 100644
index 000000000..c984fba70
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/icons/obj/profile_obj.gif
Binary files differ
diff --git a/bundles/org.eclipse.equinox.p2.ui/icons/obj/uninstalled_iu.gif b/bundles/org.eclipse.equinox.p2.ui/icons/obj/uninstalled_iu.gif
new file mode 100644
index 000000000..f192b8486
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/icons/obj/uninstalled_iu.gif
Binary files differ
diff --git a/bundles/org.eclipse.equinox.p2.ui/icons/wizban/config_wiz.gif b/bundles/org.eclipse.equinox.p2.ui/icons/wizban/config_wiz.gif
new file mode 100644
index 000000000..6a19fbfed
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/icons/wizban/config_wiz.gif
Binary files differ
diff --git a/bundles/org.eclipse.equinox.p2.ui/icons/wizban/def_wizban.jpg b/bundles/org.eclipse.equinox.p2.ui/icons/wizban/def_wizban.jpg
new file mode 100644
index 000000000..4d7eba683
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/icons/wizban/def_wizban.jpg
Binary files differ
diff --git a/bundles/org.eclipse.equinox.p2.ui/icons/wizban/install_wiz.gif b/bundles/org.eclipse.equinox.p2.ui/icons/wizban/install_wiz.gif
new file mode 100644
index 000000000..7eee7c3a7
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/icons/wizban/install_wiz.gif
Binary files differ
diff --git a/bundles/org.eclipse.equinox.p2.ui/icons/wizban/uninstall_wiz.gif b/bundles/org.eclipse.equinox.p2.ui/icons/wizban/uninstall_wiz.gif
new file mode 100644
index 000000000..1223378d1
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/icons/wizban/uninstall_wiz.gif
Binary files differ
diff --git a/bundles/org.eclipse.equinox.p2.ui/icons/wizban/update_wiz.gif b/bundles/org.eclipse.equinox.p2.ui/icons/wizban/update_wiz.gif
new file mode 100644
index 000000000..3b364875f
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/icons/wizban/update_wiz.gif
Binary files differ
diff --git a/bundles/org.eclipse.equinox.p2.ui/plugin.properties b/bundles/org.eclipse.equinox.p2.ui/plugin.properties
new file mode 100644
index 000000000..904db6cb6
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/plugin.properties
@@ -0,0 +1,15 @@
+###############################################################################
+# Copyright (c) 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+#
+# Provisioning UI plugin resources
+#
+providerName=Eclipse.org
+bundleName=Provisioning UI (Incubation)
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/ColocatedRepositoryInfo.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/ColocatedRepositoryInfo.java
new file mode 100644
index 000000000..0a59a8b78
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/ColocatedRepositoryInfo.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.prov.ui;
+
+import java.net.URL;
+import org.eclipse.equinox.prov.core.helpers.UnmodifiableProperties;
+import org.eclipse.equinox.prov.core.repository.IRepositoryInfo;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepository;
+
+/**
+ * Repository info for a colocated repository.
+ *
+ * @since 3.4
+ */
+public class ColocatedRepositoryInfo implements IRepositoryInfo {
+
+ private IMetadataRepository repo;
+
+ public ColocatedRepositoryInfo(IMetadataRepository repo) {
+ this.repo = repo;
+ }
+
+ public String getDescription() {
+ return repo.getDescription();
+ }
+
+ public String getName() {
+ return repo.getName();
+ }
+
+ public UnmodifiableProperties getProperties() {
+ return repo.getProperties();
+ }
+
+ public String getProvider() {
+ return repo.getProvider();
+ }
+
+ public String getType() {
+ return repo.getType();
+ }
+
+ public URL getLocation() {
+ return ColocatedRepositoryUtil.makeColocatedRepositoryURL(repo.getLocation());
+ }
+
+ public String getVersion() {
+ return repo.getVersion();
+ }
+
+ public Object getAdapter(Class adapter) {
+ return repo.getAdapter(adapter);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/ColocatedRepositoryUtil.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/ColocatedRepositoryUtil.java
new file mode 100644
index 000000000..d4ec3eb96
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/ColocatedRepositoryUtil.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.prov.ui;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import org.eclipse.core.runtime.Path;
+
+/**
+ * Utility methods for manipulating colocated repository URLS
+ *
+ * @since 3.4
+ */
+public class ColocatedRepositoryUtil {
+ private static final String DEFAULT_ARTIFACTREPO_NAME = "artifactRepository/"; //$NON-NLS-1$
+ private static final String DEFAULT_METADATAREPO_NAME = "metadataRepository/"; //$NON-NLS-1$
+
+ public static URL makeArtifactRepositoryURL(URL url) {
+ String urlSpec = url.toExternalForm();
+ URL newURL;
+ try {
+ if (!urlSpec.endsWith("/")) //$NON-NLS-1$
+ urlSpec += "/"; //$NON-NLS-1$
+ newURL = new URL(urlSpec + DEFAULT_ARTIFACTREPO_NAME);
+ } catch (MalformedURLException e) {
+ return null;
+ }
+ return newURL;
+ }
+
+ public static URL makeMetadataRepositoryURL(URL url) {
+ String urlSpec = url.toExternalForm();
+ URL newURL;
+ try {
+ if (!urlSpec.endsWith("/")) //$NON-NLS-1$
+ urlSpec += "/"; //$NON-NLS-1$
+ newURL = new URL(urlSpec + DEFAULT_METADATAREPO_NAME);
+ } catch (MalformedURLException e) {
+ return null;
+ }
+ return newURL;
+ }
+
+ // A colocated repository URL is one level above the metadata or artifact
+ // repository URL. For example, foo/servers/ instead of foo/servers/metadataRepository
+ public static URL makeColocatedRepositoryURL(URL metadataURL) {
+ String protocol = metadataURL.getProtocol();
+ String host = metadataURL.getHost();
+ int port = metadataURL.getPort();
+ Path path = new Path(metadataURL.getPath());
+ String pathString = path.removeLastSegments(1).toString();
+ try {
+ return new URL(protocol, host, port, pathString);
+ } catch (MalformedURLException e) {
+ return metadataURL;
+ }
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/IProfileChooser.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/IProfileChooser.java
new file mode 100644
index 000000000..5847a7e52
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/IProfileChooser.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui;
+
+import org.eclipse.equinox.prov.engine.Profile;
+
+/**
+ * Interface for a mechanism that chooses a profile from the profile registry.
+ * the mechanism may or may not involve the user.
+ *
+ * @since 3.4
+ *
+ */
+
+public interface IProfileChooser {
+ /**
+ * Return a chosen profile, or <code>null</code> if there is no profile
+ * chosen.
+ */
+ public Profile getProfile();
+
+ /**
+ * Return a String that could be used to label this chooser.
+ * For example, if the chooser uses a dialog, the label could be used
+ * in the button that launches the dialog.
+ */
+ public String getLabel();
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/IProvisioningProperties.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/IProvisioningProperties.java
new file mode 100644
index 000000000..d7481f5c0
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/IProvisioningProperties.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui;
+
+/**
+ * Temporary class
+ *
+ * @since 3.4
+ */
+// TODO this should all be defined in the core
+// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=197052
+// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=197701
+public interface IProvisioningProperties {
+
+ public final static String REPO_ADDED = "org.eclipse.equinox.prov.ui.property.repoadded"; //$NON-NLS-1$
+ public final static String REPO_NAME = "org.eclipse.equinox.prov.ui.property.reponame"; //$NON-NLS-1$
+ public final static String REPO_REMOVED = "org.eclipse.equinox.prov.ui.property.reporemoved"; //$NON-NLS-1$
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/IRepositoryManipulator.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/IRepositoryManipulator.java
new file mode 100644
index 000000000..3c8722e4e
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/IRepositoryManipulator.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui;
+
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * Interface for a mechanism that allows the user to manipulate which repositories
+ * are in the system.
+ *
+ * @since 3.4
+ *
+ */
+
+public interface IRepositoryManipulator {
+ /**
+ * Invoke whatever mechanism is used to manipulate repositories.
+ * Return a boolean indicating whether the repositories were
+ * actually manipulated in any way.
+ */
+ public boolean manipulateRepositories(Shell shell);
+
+ /**
+ * Return a String that could be used to label this manager. For example, if
+ * the manager is a dialog that lets you manipulate repositories, the label
+ * could be used in the button that launches the dialog.
+ */
+ public String getLabel();
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/ProvUI.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/ProvUI.java
new file mode 100644
index 000000000..258178e42
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/ProvUI.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.prov.ui;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.statushandlers.StatusManager;
+
+/**
+ * Generic provisioning UI utility methods
+ *
+ * @since 3.4
+ */
+public class ProvUI {
+
+ /**
+ * Make an <code>IAdaptable</code> that adapts to the specified shell,
+ * suitable for passing for passing to any
+ * {@link org.eclipse.core.commands.operations.IUndoableOperation} or
+ * {@link org.eclipse.core.commands.operations.IOperationHistory} method
+ * that requires an {@link org.eclipse.core.runtime.IAdaptable}
+ * <code>uiInfo</code> parameter.
+ *
+ * @param shell
+ * the shell that should be returned by the IAdaptable when asked
+ * to adapt a shell. If this parameter is <code>null</code>,
+ * the returned shell will also be <code>null</code>.
+ *
+ * @return an IAdaptable that will return the specified shell.
+ */
+ public static IAdaptable getUIInfoAdapter(final Shell shell) {
+ return new IAdaptable() {
+ public Object getAdapter(Class clazz) {
+ if (clazz == Shell.class) {
+ return shell;
+ }
+ return null;
+ }
+ };
+ }
+
+ public static Shell getShell(IAdaptable uiInfo) {
+ Shell shell;
+ if (uiInfo != null) {
+ shell = (Shell) uiInfo.getAdapter(Shell.class);
+ if (shell != null) {
+ return shell;
+ }
+ }
+ // Get the default shell
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ if (window != null) {
+ return window.getShell();
+ }
+ Display display = Display.getCurrent();
+ if (display == null) {
+ display = Display.getDefault();
+ }
+ return display.getActiveShell();
+ }
+
+ public static void handleException(Throwable t, String message) {
+ if (message == null && t != null) {
+ message = t.getMessage();
+ }
+ IStatus status = new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, 0, message, t);
+ StatusManager.getManager().handle(status, StatusManager.SHOW | StatusManager.LOG);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/ProvUIActivator.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/ProvUIActivator.java
new file mode 100644
index 000000000..b80228ab3
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/ProvUIActivator.java
@@ -0,0 +1,147 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui;
+
+import java.net.URL;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.equinox.prov.core.eventbus.ProvisioningEventBus;
+import org.eclipse.equinox.prov.ui.internal.ProvisioningPropertyManager;
+import org.eclipse.equinox.prov.ui.viewers.StructuredViewerProvisioningListener;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.*;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+/**
+ * Controls the lifecycle of the provisioning UI bundle
+ *
+ * @since 3.4
+ */
+public class ProvUIActivator extends AbstractUIPlugin {
+ private static BundleContext context;
+ private static PackageAdmin packageAdmin = null;
+ private static ServiceReference packageAdminRef = null;
+ private static ProvUIActivator plugin;
+ private ProvisioningPropertyManager propertyManager = new ProvisioningPropertyManager();
+
+ public static final String PLUGIN_ID = "org.eclipse.equinox.prov.ui"; //$NON-NLS-1$
+
+ public static BundleContext getContext() {
+ return context;
+ }
+
+ /**
+ * Returns the singleton plugin instance
+ *
+ * @return the instance
+ */
+ public static ProvUIActivator getDefault() {
+ return plugin;
+ }
+
+ public static Bundle getBundle(String symbolicName) {
+ if (packageAdmin == null)
+ return null;
+ Bundle[] bundles = packageAdmin.getBundles(symbolicName, null);
+ if (bundles == null)
+ return null;
+ // Return the first bundle that is not installed or uninstalled
+ for (int i = 0; i < bundles.length; i++) {
+ if ((bundles[i].getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) == 0) {
+ return bundles[i];
+ }
+ }
+ return null;
+ }
+
+ public ProvUIActivator() {
+ // do nothing
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext bundleContext) throws Exception {
+ super.start(bundleContext);
+
+ plugin = this;
+ ProvUIActivator.context = bundleContext;
+ packageAdminRef = bundleContext.getServiceReference(PackageAdmin.class.getName());
+ packageAdmin = (PackageAdmin) bundleContext.getService(packageAdminRef);
+
+ // TODO for now we need to manually start up the provisioning
+ // infrastructure
+ // because the Eclipse Application launch config won't let me specify
+ // bundles to start.
+ getBundle("org.eclipse.equinox.prov.examplarysetup").start(); //$NON-NLS-1$
+ getBundle("org.eclipse.equinox.frameworkadmin.equinox").start(); //$NON-NLS-1$
+ getBundle("org.eclipse.equinox.simpleconfigurator.manipulator").start(); //$NON-NLS-1$
+
+ initializeImages();
+ }
+
+ public void stop(BundleContext bundleContext) throws Exception {
+ try {
+ plugin = null;
+ ProvUIActivator.context = null;
+ } finally {
+ super.stop(bundleContext);
+ }
+ }
+
+ public void addProvisioningListener(StructuredViewerProvisioningListener listener) {
+ // TODO hack for unsupported repository events.
+ // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=197052
+ if ((listener.getEventTypes() & StructuredViewerProvisioningListener.PROV_EVENT_REPOSITORY) == StructuredViewerProvisioningListener.PROV_EVENT_REPOSITORY) {
+ propertyManager.addPropertyChangeListener(listener);
+ } else {
+ ServiceReference busReference = context.getServiceReference(ProvisioningEventBus.class.getName());
+ ProvisioningEventBus bus = (ProvisioningEventBus) context.getService(busReference);
+ bus.addListener(listener);
+ }
+ }
+
+ // TODO hack for triggering events from the UI.
+ public void notifyListeners(PropertyChangeEvent event) {
+ propertyManager.notifyListeners(event);
+ }
+
+ public void removeProvisioningListener(StructuredViewerProvisioningListener listener) {
+ if ((listener.getEventTypes() & StructuredViewerProvisioningListener.PROV_EVENT_REPOSITORY) == StructuredViewerProvisioningListener.PROV_EVENT_REPOSITORY) {
+ propertyManager.removePropertyChangeListener(listener);
+ } else {
+ ServiceReference busReference = context.getServiceReference(ProvisioningEventBus.class.getName());
+ ProvisioningEventBus bus = (ProvisioningEventBus) context.getService(busReference);
+ bus.removeListener(listener);
+ }
+ }
+
+ private void initializeImages() {
+ createImageDescriptor(ProvUIImages.IMG_METADATA_REPOSITORY);
+ createImageDescriptor(ProvUIImages.IMG_ARTIFACT_REPOSITORY);
+ createImageDescriptor(ProvUIImages.IMG_IU);
+ createImageDescriptor(ProvUIImages.IMG_UNINSTALLED_IU);
+ createImageDescriptor(ProvUIImages.IMG_PROFILE);
+ }
+
+ /**
+ * Creates an image and places it in the image registry.
+ */
+ private void createImageDescriptor(String id) {
+ URL url = FileLocator.find(getBundle(), new Path(ProvUIImages.ICON_PATH + id), null);
+ ImageDescriptor desc = ImageDescriptor.createFromURL(url);
+ getImageRegistry().put(id, desc);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/ProvUIImages.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/ProvUIImages.java
new file mode 100644
index 000000000..42fdb2054
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/ProvUIImages.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * ProvUIImages provides convenience methods for accessing shared images
+ * provided by the <i>org.eclipse.equinox.prov.ui</i> plug-in.
+ * <p>
+ * This class provides <code>ImageDescriptor</code>s for each named image in
+ * {@link ProvUIImages}. All <code>Image</code> objects created from the
+ * provided descriptors are managed the caller and must be disposed
+ * appropriately.
+ * </p>
+ * <p>
+ * This class is not intended to be subclassed or instantiated by clients
+ *
+ * @since 3.4
+ */
+public class ProvUIImages {
+
+ // bundle-relative icon path
+ public final static String ICON_PATH = "$nl$/icons/"; //$NON-NLS-1$
+ //objects
+ public final static String IMG_ARTIFACT_REPOSITORY = "obj/artifact_repo_obj.gif"; //$NON-NLS-1$
+ public final static String IMG_METADATA_REPOSITORY = "obj/metadata_repo_obj.gif"; //$NON-NLS-1$
+ public final static String IMG_IU = "obj/iu_obj.gif"; //$NON-NLS-1$
+ public final static String IMG_UNINSTALLED_IU = "obj/uninstalled_iu_obj.gif"; //$NON-NLS-1$
+ public final static String IMG_PROFILE = "obj/profile_obj.gif"; //$NON-NLS-1$
+
+ /**
+ * Returns the image descriptor for the given image ID. Returns
+ * <code>null</code> if there is no such image.
+ *
+ * @param id
+ * the identifier for the image to retrieve
+ * @return the image descriptor associated with the given ID
+ */
+ public static ImageDescriptor getImageDescriptor(String id) {
+ return ProvUIActivator.getDefault().getImageRegistry().getDescriptor(id);
+ }
+
+ /**
+ * Returns the image for the given image ID. Returns <code>null</code> if
+ * there is no such image.
+ *
+ * @param id
+ * the identifier for the image to retrieve
+ * @return the image associated with the given ID. This image is managed in
+ * an image registry and should not be freed by the client.
+ */
+ public static Image getImage(String id) {
+ return ProvUIActivator.getDefault().getImageRegistry().get(id);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/ProvisioningUndoSupport.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/ProvisioningUndoSupport.java
new file mode 100644
index 000000000..fc583ac48
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/ProvisioningUndoSupport.java
@@ -0,0 +1,119 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.prov.ui;
+
+import java.lang.reflect.InvocationTargetException;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.statushandlers.StatusManager;
+
+/**
+ * Utility methods for clients using undo
+ *
+ * @since 3.4
+ */
+public class ProvisioningUndoSupport {
+ static ObjectUndoContext provisioningUndoContext;
+
+ /**
+ * Return the undo context that should be used for operations involving
+ * provisioning.
+ *
+ * @return the provisioning undo context
+ */
+ public static IUndoContext getProvisioningUndoContext() {
+ if (provisioningUndoContext == null) {
+ provisioningUndoContext = new ObjectUndoContext(new Object(), "Provisioning Undo Context"); //$NON-NLS-1$
+ IOperationHistory opHistory = PlatformUI.getWorkbench().getOperationSupport().getOperationHistory();
+ opHistory.addOperationApprover(getOperationApprover());
+ }
+ return provisioningUndoContext;
+ }
+
+ static IOperationApprover getOperationApprover() {
+ return new IOperationApprover() {
+ public IStatus proceedUndoing(final IUndoableOperation operation, IOperationHistory history, IAdaptable info) {
+ final IStatus[] status = new IStatus[1];
+ status[0] = Status.OK_STATUS;
+ if (operation.hasContext(provisioningUndoContext) && operation instanceof IAdvancedUndoableOperation) {
+ final IRunnableWithProgress runnable = new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) {
+ try {
+ status[0] = ((IAdvancedUndoableOperation) operation).computeUndoableStatus(monitor);
+ if (!status[0].isOK()) {
+ StatusManager.getManager().handle(status[0], StatusManager.SHOW);
+ }
+ } catch (ExecutionException e) {
+ status[0] = new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, e.getMessage(), e);
+ ProvUI.handleException(e.getCause(), null);
+ }
+ }
+ };
+ PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
+ public void run() {
+ try {
+ new ProgressMonitorDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()).run(true, true, runnable);
+ } catch (InterruptedException e) {
+ // don't report thread interruption
+ } catch (InvocationTargetException e) {
+ status[0] = new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, e.getMessage(), e);
+ ProvUI.handleException(e.getCause(), null);
+ }
+ }
+ });
+
+ }
+ return status[0];
+ }
+
+ public IStatus proceedRedoing(final IUndoableOperation operation, IOperationHistory history, IAdaptable info) {
+ final IStatus[] status = new IStatus[1];
+ status[0] = Status.OK_STATUS;
+ if (operation.hasContext(provisioningUndoContext) && operation instanceof IAdvancedUndoableOperation) {
+ final IRunnableWithProgress runnable = new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) {
+ try {
+ status[0] = ((IAdvancedUndoableOperation) operation).computeRedoableStatus(monitor);
+ if (!status[0].isOK()) {
+ StatusManager.getManager().handle(status[0], StatusManager.SHOW);
+ }
+ } catch (ExecutionException e) {
+ status[0] = new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, e.getMessage(), e);
+ ProvUI.handleException(e.getCause(), null);
+ }
+ }
+ };
+ PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
+ public void run() {
+ try {
+ new ProgressMonitorDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()).run(true, true, runnable);
+ } catch (InterruptedException e) {
+ // don't report thread interruption
+ } catch (InvocationTargetException e) {
+ status[0] = new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, e.getMessage(), e);
+ ProvUI.handleException(e.getCause(), null);
+ }
+ }
+ });
+
+ }
+ return status[0];
+ }
+
+ };
+
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/ProvisioningUtil.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/ProvisioningUtil.java
new file mode 100644
index 000000000..c4a1af2bc
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/ProvisioningUtil.java
@@ -0,0 +1,362 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.prov.ui;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.configurator.Configurator;
+import org.eclipse.equinox.prov.artifact.repository.IArtifactRepository;
+import org.eclipse.equinox.prov.artifact.repository.IArtifactRepositoryManager;
+import org.eclipse.equinox.prov.core.ProvisionException;
+import org.eclipse.equinox.prov.core.helpers.ServiceHelper;
+import org.eclipse.equinox.prov.core.repository.IRepositoryInfo;
+import org.eclipse.equinox.prov.core.repository.IWritableRepositoryInfo;
+import org.eclipse.equinox.prov.director.IDirector;
+import org.eclipse.equinox.prov.director.Oracle;
+import org.eclipse.equinox.prov.engine.IProfileRegistry;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepository;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepositoryManager;
+import org.eclipse.equinox.prov.query.CompoundIterator;
+import org.eclipse.equinox.prov.query.Query;
+import org.eclipse.equinox.prov.ui.internal.ApplyProfileChangesDialog;
+import org.eclipse.equinox.prov.ui.internal.ProvUIMessages;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.osgi.service.resolver.VersionRange;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Utility methods for clients using the provisioning UI
+ *
+ * @since 3.4
+ */
+public class ProvisioningUtil {
+ public static IMetadataRepository addMetadataRepository(URL location, IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException {
+ IMetadataRepositoryManager manager = (IMetadataRepositoryManager) ServiceHelper.getService(ProvUIActivator.getContext(), IMetadataRepositoryManager.class.getName());
+ if (manager == null)
+ throw new ProvisionException(ProvUIMessages.ProvisioningUtil_NoRepositoryManager);
+ IMetadataRepository repo = null;
+ repo = manager.loadRepository(location, monitor);
+ if (repo == null) {
+ throw new ProvisionException(NLS.bind(ProvUIMessages.ProvisioningUtil_AddRepositoryFailure, location.toExternalForm()));
+ }
+ PropertyChangeEvent event = new PropertyChangeEvent(repo, IProvisioningProperties.REPO_ADDED, null, null);
+ ProvUIActivator.getDefault().notifyListeners(event);
+ return repo;
+ }
+
+ public static IMetadataRepository getMetadataRepository(URL location, IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException {
+ IMetadataRepositoryManager manager = (IMetadataRepositoryManager) ServiceHelper.getService(ProvUIActivator.getContext(), IMetadataRepositoryManager.class.getName());
+ if (manager == null) {
+ throw new ProvisionException(ProvUIMessages.ProvisioningUtil_NoRepositoryManager);
+ }
+ return manager.getRepository(location);
+ }
+
+ public static void removeMetadataRepository(URL location, IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException {
+ IMetadataRepositoryManager manager = (IMetadataRepositoryManager) ServiceHelper.getService(ProvUIActivator.getContext(), IMetadataRepositoryManager.class.getName());
+ if (manager == null) {
+ throw new ProvisionException(ProvUIMessages.ProvisioningUtil_NoRepositoryManager);
+ }
+ IMetadataRepository repo = manager.getRepository(location);
+ if (repo != null)
+ manager.removeRepository(repo);
+ PropertyChangeEvent event = new PropertyChangeEvent(repo, IProvisioningProperties.REPO_REMOVED, null, null);
+ ProvUIActivator.getDefault().notifyListeners(event);
+
+ }
+
+ public static IArtifactRepository addArtifactRepository(URL location, IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException {
+ IArtifactRepositoryManager manager = (IArtifactRepositoryManager) ServiceHelper.getService(ProvUIActivator.getContext(), IArtifactRepositoryManager.class.getName());
+ if (manager == null) {
+ throw new ProvisionException(ProvUIMessages.ProvisioningUtil_NoRepositoryManager);
+ }
+ // TODO need to get rid of this string constant. see bug #196862
+ String repositoryName = location + " - artifacts"; //$NON-NLS-1$
+ IArtifactRepository repository = manager.createRepository(location, repositoryName, "org.eclipse.equinox.prov.artifact.repository.simpleRepository"); //$NON-NLS-1$
+ if (repository == null) {
+ throw new ProvisionException(NLS.bind(ProvUIMessages.ProvisioningUtil_AddRepositoryFailure, location));
+ }
+ PropertyChangeEvent event = new PropertyChangeEvent(repository, IProvisioningProperties.REPO_ADDED, null, null);
+ ProvUIActivator.getDefault().notifyListeners(event);
+
+ return repository;
+ }
+
+ public static void removeArtifactRepository(URL location, IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException {
+ IArtifactRepositoryManager manager = (IArtifactRepositoryManager) ServiceHelper.getService(ProvUIActivator.getContext(), IArtifactRepositoryManager.class.getName());
+ if (manager == null) {
+ throw new ProvisionException(ProvUIMessages.ProvisioningUtil_NoRepositoryManager);
+ }
+ IArtifactRepository[] repos = manager.getKnownRepositories();
+ for (int i = 0; i < repos.length; i++) {
+ IArtifactRepository repo = repos[i];
+ if (repo.getLocation().equals(location)) {
+ manager.removeRepository(repo);
+ PropertyChangeEvent event = new PropertyChangeEvent(repo, IProvisioningProperties.REPO_REMOVED, null, null);
+ ProvUIActivator.getDefault().notifyListeners(event);
+
+ return;
+ }
+ }
+ }
+
+ public static IArtifactRepository[] getArtifactRepositories(IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException {
+ IArtifactRepositoryManager manager = (IArtifactRepositoryManager) ServiceHelper.getService(ProvUIActivator.getContext(), IArtifactRepositoryManager.class.getName());
+ if (manager == null)
+ throw new ProvisionException(ProvUIMessages.ProvisioningUtil_NoRepositoryManager);
+ IArtifactRepository[] repos = manager.getKnownRepositories();
+ if (repos != null) {
+ return repos;
+ }
+ return new IArtifactRepository[0];
+ }
+
+ public static IArtifactRepository getArtifactRepository(URL repoURL, IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException {
+ IArtifactRepository[] repositories = getArtifactRepositories(monitor, uiInfo);
+ if (repositories == null)
+ return null;
+ for (int i = 0; i < repositories.length; i++) {
+ if (repoURL.equals(repositories[i].getLocation()))
+ return repositories[i];
+ }
+ return null;
+ }
+
+ public static void addProfile(Profile profile, IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException {
+ IProfileRegistry profileRegistry = (IProfileRegistry) ServiceHelper.getService(ProvUIActivator.getContext(), IProfileRegistry.class.getName());
+ if (profileRegistry == null) {
+ throw new ProvisionException(ProvUIMessages.ProvisioningUtil_NoProfileRegistryFound);
+ }
+ profileRegistry.addProfile(profile);
+ }
+
+ public static void removeProfile(String profileId, IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException {
+ IProfileRegistry profileRegistry = (IProfileRegistry) ServiceHelper.getService(ProvUIActivator.getContext(), IProfileRegistry.class.getName());
+ if (profileRegistry == null) {
+ throw new ProvisionException(ProvUIMessages.ProvisioningUtil_NoProfileRegistryFound);
+ }
+ Profile profile = profileRegistry.getProfile(profileId);
+ if (profile != null)
+ profileRegistry.removeProfile(profile);
+ }
+
+ public static Profile[] getProfiles(IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException {
+ IProfileRegistry profileRegistry = (IProfileRegistry) ServiceHelper.getService(ProvUIActivator.getContext(), IProfileRegistry.class.getName());
+ if (profileRegistry == null) {
+ throw new ProvisionException(ProvUIMessages.ProvisioningUtil_NoProfileRegistryFound);
+ }
+ return profileRegistry.getProfiles();
+ }
+
+ public static Profile getProfile(String id) throws ProvisionException {
+ IProfileRegistry profileRegistry = (IProfileRegistry) ServiceHelper.getService(ProvUIActivator.getContext(), IProfileRegistry.class.getName());
+ if (profileRegistry == null) {
+ throw new ProvisionException(ProvUIMessages.ProvisioningUtil_NoProfileRegistryFound);
+ }
+ return profileRegistry.getProfile(id);
+ }
+
+ /*
+ * Returns the installable units with the given id and version
+ * specifications in the given metadata repository. <code>null</code> can
+ * be used to indicate wildcards for any of the arguments.
+ *
+ * @param location The location of the metdata repo to search. <code>null</code>
+ * indicates search all known repos. @param id The id of the IUs to find.
+ * <code>null</code> indicates wildcard. @param range The version range of
+ * the IUs to find. <code>null</code> indicates wildcard. @return The IUs
+ * that match the query
+ */
+ public static IInstallableUnit[] getInstallableUnits(URL location, String id, VersionRange range, IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException {
+ IMetadataRepository[] repositories = null;
+ if (location == null) {
+ repositories = getMetadataRepositories(monitor, uiInfo);
+ } else {
+ repositories = new IMetadataRepository[] {getMetadataRepository(location, monitor, uiInfo)};
+ }
+ Iterator i = Query.getIterator(repositories, id, range, null, false);
+ return CompoundIterator.asArray(i, monitor);
+ }
+
+ /*
+ * Returns the installable units with the given id and version
+ * specifications.
+ *
+ * @param profileId The profile to search @param id The id of the IUs to
+ * find. <code>null</code> indicates wildcard. @param version The version
+ * of the IUs to find. <code>null</code> indicates wildcard. @return The
+ * IUs that match the query
+ */
+ public static IInstallableUnit[] getInstallableUnits(String profileId, String id, VersionRange range, IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException {
+ Profile[] profiles = null;
+ if (profileId == null) {
+ profiles = getProfiles(monitor, uiInfo);
+ } else {
+ profiles = new Profile[] {getProfile(profileId)};
+ }
+ Iterator i = Query.getIterator(profiles, id, range, null, false);
+ return CompoundIterator.asArray(i, monitor);
+ }
+
+ public static IMetadataRepository[] getMetadataRepositories(IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException {
+ IMetadataRepositoryManager manager = (IMetadataRepositoryManager) ServiceHelper.getService(ProvUIActivator.getContext(), IMetadataRepositoryManager.class.getName());
+ if (manager == null) {
+ throw new ProvisionException(ProvUIMessages.ProvisioningUtil_NoRepositoryManager);
+ }
+ return manager.getKnownRepositories();
+ }
+
+ /*
+ * See if the specified IU's can be installed in the profile
+ */
+ public static boolean canInstall(IInstallableUnit[] toInstall, Profile profile, IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException {
+ Assert.isNotNull(profile);
+ Assert.isNotNull(toInstall);
+
+ // TODO should I be getting an Oracle from a service helper?
+ // Oracle oracle = (Oracle) ServiceHelper.getService(ProvUIActivator.getContext(), Oracle.class.getName());
+ Oracle oracle = new Oracle();
+ if (oracle == null) {
+ throw new ProvisionException(ProvUIMessages.ProvisioningUtil_NoOracleFound);
+ }
+ return oracle.canInstall(toInstall, profile, monitor).equals(Boolean.TRUE);
+ }
+
+ /*
+ * See what updates might be available for a single IU.
+ * Useful when checking for updates and letting the user decide
+ * which IU's to update.
+ */
+ public static Collection updatesFor(IInstallableUnit toUpdate, IProgressMonitor monitor) throws ProvisionException {
+ Assert.isNotNull(toUpdate);
+
+ // TODO should I be getting an Oracle from a service helper?
+ // Oracle oracle = (Oracle) ServiceHelper.getService(ProvUIActivator.getContext(), Oracle.class.getName());
+ Oracle oracle = new Oracle();
+ if (oracle == null) {
+ throw new ProvisionException(ProvUIMessages.ProvisioningUtil_NoOracleFound);
+ }
+ return oracle.hasUpdate(toUpdate);
+ }
+
+ /*
+ * See what updates might be available for the specified IU's.
+ * Useful for bulk update that can be directly passed to the update helper.
+ */
+ public static IInstallableUnit[] updatesFor(IInstallableUnit[] toUpdate, Profile profile, IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException {
+ Assert.isNotNull(profile);
+ Assert.isNotNull(toUpdate);
+
+ // TODO should I be getting an Oracle from a service helper?
+ // Oracle oracle = (Oracle) ServiceHelper.getService(ProvUIActivator.getContext(), Oracle.class.getName());
+ Oracle oracle = new Oracle();
+ if (oracle == null) {
+ throw new ProvisionException(ProvUIMessages.ProvisioningUtil_NoOracleFound);
+ }
+ ArrayList allUpdates = new ArrayList();
+ for (int i = 0; i < toUpdate.length; i++) {
+ allUpdates.addAll(oracle.hasUpdate(toUpdate[i]));
+ }
+ return (IInstallableUnit[]) allUpdates.toArray(new IInstallableUnit[allUpdates.size()]);
+ }
+
+ /*
+ * Install the specified IU's
+ */
+ public static IStatus install(IInstallableUnit[] toInstall, String entryPointName, Profile profile, IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException {
+ Assert.isNotNull(profile);
+ Assert.isNotNull(toInstall);
+
+ IDirector director = (IDirector) ServiceHelper.getService(ProvUIActivator.getContext(), IDirector.class.getName());
+ if (director == null) {
+ throw new ProvisionException(ProvUIMessages.ProvisioningUtil_NoDirectorFound);
+ }
+ return director.install(toInstall, profile, entryPointName, monitor);
+ }
+
+ public static IStatus become(IInstallableUnit toBecome, Profile profile, IProgressMonitor monitor) throws ProvisionException {
+ Assert.isNotNull(profile);
+ Assert.isNotNull(toBecome);
+
+ IDirector director = (IDirector) ServiceHelper.getService(ProvUIActivator.getContext(), IDirector.class.getName());
+ if (director == null) {
+ throw new ProvisionException(ProvUIMessages.ProvisioningUtil_NoDirectorFound);
+ }
+ return director.become(toBecome, profile, monitor);
+ }
+
+ /*
+ * Uninstall the specified IU's
+ */
+ public static IStatus uninstall(IInstallableUnit[] toUninstall, Profile profile, IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException {
+ Assert.isNotNull(profile);
+ Assert.isNotNull(toUninstall);
+
+ IDirector director = (IDirector) ServiceHelper.getService(ProvUIActivator.getContext(), IDirector.class.getName());
+ if (director == null) {
+ throw new ProvisionException(ProvUIMessages.ProvisioningUtil_NoDirectorFound);
+ }
+ return director.uninstall(toUninstall, profile, monitor);
+ }
+
+ /*
+ * Uninstall the specified IU's
+ */
+ public static IStatus update(IInstallableUnit[] toUninstall, IInstallableUnit[] replacements, Profile profile, IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException {
+ Assert.isNotNull(profile);
+ Assert.isNotNull(toUninstall);
+ Assert.isNotNull(replacements);
+
+ IDirector director = (IDirector) ServiceHelper.getService(ProvUIActivator.getContext(), IDirector.class.getName());
+ if (director == null) {
+ throw new ProvisionException(ProvUIMessages.ProvisioningUtil_NoDirectorFound);
+ }
+ return director.replace(toUninstall, replacements, profile, monitor);
+ }
+
+ // TODO This method is only in the util class so that I can generate an
+ // event. If the setName API generated this event, callers could just do
+ // it directly (and I could make this class/package truly internal....)
+ public static IStatus setRepositoryName(IRepositoryInfo repository, String name) {
+ IWritableRepositoryInfo writableInfo = (IWritableRepositoryInfo) repository.getAdapter(IWritableRepositoryInfo.class);
+ if (writableInfo != null) {
+ writableInfo.setName(name);
+ PropertyChangeEvent event = new PropertyChangeEvent(repository, IProvisioningProperties.REPO_NAME, null, name);
+ ProvUIActivator.getDefault().notifyListeners(event);
+ return Status.OK_STATUS;
+ }
+ return error(ProvUIMessages.ProvisioningUtil_RepoNotWritable);
+ }
+
+ public static void requestRestart(boolean restartRequired, IAdaptable uiInfo) {
+ int retCode = ApplyProfileChangesDialog.promptForRestart(ProvUI.getShell(uiInfo), restartRequired);
+ if (retCode == ApplyProfileChangesDialog.PROFILE_APPLYCHANGES) {
+ Configurator configurator = (Configurator) ServiceHelper.getService(ProvUIActivator.getContext(), Configurator.class.getName());
+ try {
+ configurator.applyConfiguration();
+ } catch (IOException e) {
+ ProvUI.handleException(e, null);
+ }
+ } else if (retCode == ApplyProfileChangesDialog.PROFILE_RESTART) {
+ PlatformUI.getWorkbench().restart();
+ }
+ }
+
+ private static IStatus error(String message) {
+ return new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, message);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/actions/BecomeAction.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/actions/BecomeAction.java
new file mode 100644
index 000000000..5b6ab1d70
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/actions/BecomeAction.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.equinox.prov.ui.actions;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.ui.IProfileChooser;
+import org.eclipse.equinox.prov.ui.internal.ProvUIMessages;
+import org.eclipse.equinox.prov.ui.operations.*;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.swt.widgets.Shell;
+
+public class BecomeAction extends ProfileModificationAction {
+ public static final int ENTRYPOINT_FORCE = 1;
+ public static final int ENTRYPOINT_OPTIONAL = 2;
+ public static final int ENTRYPOINT_NEVER = 3;
+ int entryPointStrategy = ENTRYPOINT_NEVER;
+
+ public BecomeAction(String text, ISelectionProvider selectionProvider, IOperationConfirmer confirmer, Profile profile, IProfileChooser chooser, Shell shell) {
+ super(text, selectionProvider, confirmer, profile, chooser, shell);
+ }
+
+ protected ProfileModificationOperation validateAndGetOperation(IInstallableUnit[] toBecome, Profile targetProfile, IProgressMonitor monitor) {
+ return new BecomeOperation(ProvUIMessages.Ops_BecomeIUOperationLabel, targetProfile.getProfileId(), toBecome[0]);
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/actions/InstallAction.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/actions/InstallAction.java
new file mode 100644
index 000000000..c3e59c4bc
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/actions/InstallAction.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.equinox.prov.ui.actions;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.equinox.prov.core.ProvisionException;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.ui.*;
+import org.eclipse.equinox.prov.ui.internal.ProvUIMessages;
+import org.eclipse.equinox.prov.ui.operations.*;
+import org.eclipse.jface.dialogs.*;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Shell;
+
+public class InstallAction extends ProfileModificationAction {
+ public static final int ENTRYPOINT_FORCE = 1;
+ public static final int ENTRYPOINT_OPTIONAL = 2;
+ public static final int ENTRYPOINT_NEVER = 3;
+ int entryPointStrategy = ENTRYPOINT_FORCE;
+
+ public InstallAction(String text, ISelectionProvider selectionProvider, IOperationConfirmer confirmer, Profile profile, IProfileChooser chooser, Shell shell) {
+ super(text, selectionProvider, confirmer, profile, chooser, shell);
+ }
+
+ protected ProfileModificationOperation validateAndGetOperation(IInstallableUnit[] ius, Profile targetProfile, IProgressMonitor monitor) {
+ // First validate whether the install can happen
+ try {
+ if (ProvisioningUtil.canInstall(ius, targetProfile, monitor, ProvUI.getUIInfoAdapter(getShell()))) {
+ // Get a name for the entry point
+ // TODO eventually this should be a specialized dialog for confirming an install, showing size, etc.
+ String entryPointName = null;
+ if (entryPointStrategy != ENTRYPOINT_NEVER) {
+ entryPointName = getDefaultEntryPointName(ius);
+ InputDialog dialog = new InputDialog(getShell(), ProvUIMessages.InstallAction_InstallConfirmTitle, ProvUIMessages.InstallAction_NameEntryPointMessage, entryPointName, new IInputValidator() {
+ public String isValid(String string) {
+ if (string.length() > 0 || entryPointStrategy == ENTRYPOINT_OPTIONAL)
+ return null;
+ return ProvUIMessages.InstallAction_EntryPointNameRequired;
+ }
+ });
+ if (dialog.open() == Window.CANCEL)
+ return null;
+ entryPointName = dialog.getValue();
+ if (entryPointName.length() == 0) {
+ entryPointName = null;
+ }
+ }
+ if (entryPointName == null) {
+ if (entryPointStrategy == ENTRYPOINT_FORCE) {
+ // shouldn't happen, but just in case
+ return null;
+ }
+ }
+ return new InstallOperation(ProvUIMessages.Ops_InstallIUOperationLabel, targetProfile.getProfileId(), ius, entryPointName);
+ }
+ MessageDialog.openInformation(getShell(), ProvUIMessages.InstallAction_InstallInfoTitle, ProvUIMessages.InstallAction_InstallNotPermitted);
+ } catch (ProvisionException e) {
+ // fall through and return null
+ }
+ return null;
+ }
+
+ private String getDefaultEntryPointName(IInstallableUnit[] ius) {
+ StringBuffer result = new StringBuffer();
+ for (int i = 0; i < ius.length; i++) {
+ result.append(ius[i].getId());
+ if (i < ius.length - 1)
+ result.append(", "); //$NON-NLS-1$
+ }
+ return result.toString();
+
+ }
+
+ public void setEntryPointStrategy(int strategy) {
+ entryPointStrategy = strategy;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/actions/ProfileModificationAction.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/actions/ProfileModificationAction.java
new file mode 100644
index 000000000..6b22afaa7
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/actions/ProfileModificationAction.java
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.equinox.prov.ui.actions;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.prov.core.ProvisionException;
+import org.eclipse.equinox.prov.engine.IProfileRegistry;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.ui.*;
+import org.eclipse.equinox.prov.ui.operations.IOperationConfirmer;
+import org.eclipse.equinox.prov.ui.operations.ProfileModificationOperation;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.statushandlers.StatusManager;
+
+abstract class ProfileModificationAction extends ProvisioningAction {
+
+ Profile profile;
+ IProfileChooser profileChooser;
+
+ public ProfileModificationAction(String text, ISelectionProvider selectionProvider, IOperationConfirmer confirmer, Profile profile, IProfileChooser profileChooser, Shell shell) {
+ super(text, selectionProvider, confirmer, shell);
+ this.profile = profile;
+ this.profileChooser = profileChooser;
+ }
+
+ public void run() {
+ // If the profile was not provided, see if we have a
+ // viewer element that can tell us.
+ Profile targetProfile = profile;
+ if (targetProfile == null && profileChooser != null) {
+ targetProfile = profileChooser.getProfile();
+ }
+ // We could not figure out a profile to operate on, so return
+ if (targetProfile == null) {
+ return;
+ }
+
+ List elements = getStructuredSelection().toList();
+ List iusList = new ArrayList(elements.size());
+
+ for (int i = 0; i < elements.size(); i++) {
+ Object element = elements.get(i);
+ if (element instanceof IInstallableUnit) {
+ iusList.add(element);
+ } else if (element instanceof IAdaptable) {
+ iusList.add(((IAdaptable) element).getAdapter(IInstallableUnit.class));
+ }
+ }
+
+ final IInstallableUnit[] ius = (IInstallableUnit[]) iusList.toArray(new IInstallableUnit[iusList.size()]);
+ final ProfileModificationOperation[] ops = new ProfileModificationOperation[1];
+ final Profile prof = targetProfile;
+ IRunnableWithProgress runnable = new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) {
+ ops[0] = validateAndGetOperation(ius, prof, monitor);
+ }
+ };
+ try {
+ new ProgressMonitorDialog(getShell()).run(false, false, runnable);
+ } catch (InterruptedException e) {
+ // don't report thread interruption
+ } catch (InvocationTargetException e) {
+ ProvUI.handleException(e.getCause(), null);
+ }
+
+ if (ops[0] == null)
+ return;
+
+ if (operationConfirmer != null && !operationConfirmer.continuePerformingOperation(ops[0], getShell())) {
+ return;
+ }
+
+ final IStatus[] status = new IStatus[1];
+ final IAdaptable adapter = ProvUI.getUIInfoAdapter(getShell());
+ runnable = new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) {
+ try {
+ status[0] = PlatformUI.getWorkbench().getOperationSupport().getOperationHistory().execute(ops[0], monitor, adapter);
+ if (!status[0].isOK()) {
+ StatusManager.getManager().handle(status[0], StatusManager.SHOW | StatusManager.LOG);
+ }
+ } catch (ExecutionException e) {
+ ProvUI.handleException(e.getCause(), null);
+ }
+ }
+ };
+ try {
+ new ProgressMonitorDialog(getShell()).run(true, true, runnable);
+ // If we updated the running profile, we need to determine whether to restart.
+ // TODO for now we pretend restart is optional, we really don't know yet
+ if (status[0] != null && status[0].isOK()) {
+ try {
+ Profile selfProfile = ProvisioningUtil.getProfile(IProfileRegistry.SELF);
+ if (selfProfile != null && (selfProfile.getProfileId().equals(targetProfile.getProfileId()))) {
+ ProvisioningUtil.requestRestart(false, ProvUI.getUIInfoAdapter(getShell()));
+ }
+ } catch (ProvisionException e) {
+ ProvUI.handleException(e, null);
+ }
+ }
+ } catch (InterruptedException e) {
+ // don't report thread interruption
+ } catch (InvocationTargetException e) {
+ ProvUI.handleException(e.getCause(), null);
+ }
+ }
+
+ /*
+ * Validate whether the proposed profile modification operation can run.
+ * If so, return an operation representing it. If not, return null.
+ * We assume the user has been notified if something couldn't happen.
+ */
+ protected abstract ProfileModificationOperation validateAndGetOperation(IInstallableUnit[] ius, Profile targetProfile, IProgressMonitor monitor);
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/actions/ProvisioningAction.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/actions/ProvisioningAction.java
new file mode 100644
index 000000000..d84a5b41b
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/actions/ProvisioningAction.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.equinox.prov.ui.actions;
+
+import org.eclipse.equinox.prov.ui.operations.IOperationConfirmer;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.SelectionProviderAction;
+
+public abstract class ProvisioningAction extends SelectionProviderAction {
+
+ protected IOperationConfirmer operationConfirmer;
+ private Shell shell;
+
+ protected ProvisioningAction(String text, ISelectionProvider selectionProvider, IOperationConfirmer confirmer, Shell shell) {
+ super(selectionProvider, text);
+ this.operationConfirmer = confirmer;
+ this.shell = shell;
+ if (this.shell == null) {
+ shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ }
+ }
+
+ protected Shell getShell() {
+ return shell;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/actions/UninstallAction.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/actions/UninstallAction.java
new file mode 100644
index 000000000..1015c443c
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/actions/UninstallAction.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.equinox.prov.ui.actions;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.ui.IProfileChooser;
+import org.eclipse.equinox.prov.ui.internal.ProvUIMessages;
+import org.eclipse.equinox.prov.ui.operations.*;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.swt.widgets.Shell;
+
+public class UninstallAction extends ProfileModificationAction {
+
+ public UninstallAction(String text, ISelectionProvider selectionProvider, IOperationConfirmer confirmer, Profile profile, IProfileChooser chooser, Shell shell) {
+ super(text, selectionProvider, confirmer, profile, chooser, shell);
+ }
+
+ protected ProfileModificationOperation validateAndGetOperation(IInstallableUnit[] ius, Profile targetProfile, IProgressMonitor monitor) {
+ return new UninstallOperation(ProvUIMessages.Ops_UninstallIUOperationLabel, targetProfile.getProfileId(), ius);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/actions/UpdateAction.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/actions/UpdateAction.java
new file mode 100644
index 000000000..7b6d64d47
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/actions/UpdateAction.java
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.equinox.prov.ui.actions;
+
+import java.util.*;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.equinox.prov.core.ProvisionException;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.ui.*;
+import org.eclipse.equinox.prov.ui.internal.ProvUIMessages;
+import org.eclipse.equinox.prov.ui.operations.*;
+import org.eclipse.equinox.prov.ui.viewers.IUDetailsLabelProvider;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.ui.dialogs.ListSelectionDialog;
+
+public class UpdateAction extends ProfileModificationAction {
+
+ private final class UpdateListSelectionDialog extends ListSelectionDialog {
+ UpdateListSelectionDialog(Shell parentShell, Object input, IStructuredContentProvider contentProvider, ILabelProvider labelProvider, String message) {
+ super(parentShell, input, contentProvider, labelProvider, message);
+ }
+
+ protected Control createDialogArea(Composite parent) {
+ Control control = super.createDialogArea(parent);
+ Table table = getViewer().getTable();
+ table.setHeaderVisible(true);
+ TableColumn tc = new TableColumn(table, SWT.LEFT, 0);
+ tc.setResizable(true);
+ tc.setWidth(200);
+ tc = new TableColumn(table, SWT.LEFT, 1);
+ tc.setWidth(200);
+ tc.setResizable(true);
+ getViewer().setInput(new Object());
+ return control;
+ }
+ }
+
+ private final class UpdateContentProvider implements IStructuredContentProvider {
+ private final Object[] elements;
+
+ UpdateContentProvider(Object[] elements) {
+ this.elements = elements;
+ }
+
+ public Object[] getElements(Object inputElement) {
+ return elements;
+ }
+
+ public void dispose() {
+ // nothing to dispose
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ // input is static
+ }
+ }
+
+ public UpdateAction(String text, ISelectionProvider selectionProvider, IOperationConfirmer confirmer, Profile profile, IProfileChooser chooser, Shell shell) {
+ super(text, selectionProvider, confirmer, profile, chooser, shell);
+ }
+
+ protected ProfileModificationOperation validateAndGetOperation(IInstallableUnit[] ius, Profile targetProfile, IProgressMonitor monitor) {
+ // Collect the replacements for each IU individually so that
+ // the user can decide what to update
+ try {
+ Collection[] replacements = new Collection[ius.length];
+ ArrayList iusWithUpdates = new ArrayList();
+ for (int i = 0; i < ius.length; i++) {
+ replacements[i] = ProvisioningUtil.updatesFor(ius[i], monitor);
+ if (replacements[i].size() > 0)
+ iusWithUpdates.add(ius[i]);
+ }
+ if (iusWithUpdates.size() > 0) {
+ final Object[] elements = iusWithUpdates.toArray();
+ ListSelectionDialog dialog = new UpdateListSelectionDialog(getShell(), new Object(), new UpdateContentProvider(elements), new IUDetailsLabelProvider(), ProvUIMessages.UpdateAction_UpdatesAvailableMessage);
+ dialog.setInitialSelections(elements);
+ dialog.setTitle(ProvUIMessages.UpdateAction_UpdatesAvailableTitle);
+ int ret = dialog.open();
+ IInstallableUnit[] iusToUpdate = new IInstallableUnit[0];
+ if (ret != Window.CANCEL) {
+ Object[] result = dialog.getResult();
+ if (result != null && result.length > 0) {
+ iusToUpdate = (IInstallableUnit[]) Arrays.asList(dialog.getResult()).toArray(new IInstallableUnit[result.length]);
+ IInstallableUnit[] replacementIUs = ProvisioningUtil.updatesFor(iusToUpdate, targetProfile, monitor, ProvUI.getUIInfoAdapter(getShell()));
+ if (replacementIUs.length > 0) {
+ return new UpdateOperation(ProvUIMessages.Ops_UpdateIUOperationLabel, targetProfile.getProfileId(), iusToUpdate, replacementIUs);
+ }
+ }
+ }
+ } else {
+ MessageDialog.openInformation(getShell(), ProvUIMessages.UpdateAction_UpdateInformationTitle, ProvUIMessages.UpdateOperation_NothingToUpdate);
+ }
+ } catch (ProvisionException e) {
+ // fall through and return null
+ }
+ return null;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/AddColocatedRepositoryDialog.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/AddColocatedRepositoryDialog.java
new file mode 100644
index 000000000..4de8323b6
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/AddColocatedRepositoryDialog.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.dialogs;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import org.eclipse.core.commands.operations.IUndoableOperation;
+import org.eclipse.equinox.prov.core.repository.IRepositoryInfo;
+import org.eclipse.equinox.prov.ui.ProvUI;
+import org.eclipse.equinox.prov.ui.internal.ProvUIMessages;
+import org.eclipse.equinox.prov.ui.operations.AddColocatedRepositoryOperation;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * Dialog that allows colocated metadata and artifact repositories
+ * to be defined and added.
+ *
+ * @since 3.4
+ *
+ */
+public class AddColocatedRepositoryDialog extends AddRepositoryDialog {
+
+ public AddColocatedRepositoryDialog(Shell parentShell, IRepositoryInfo[] knownRepositories) {
+ super(parentShell, knownRepositories);
+
+ }
+
+ protected IUndoableOperation getOperation(URL url, String name) {
+ return new AddColocatedRepositoryOperation(getShell().getText(), url, name);
+ }
+
+ protected URL makeRepositoryURL(String urlString) {
+ URL newURL;
+ try {
+ newURL = new URL(urlString);
+ } catch (MalformedURLException e) {
+ // TODO need friendlier user message rather than just reporting exception
+ ProvUI.handleException(e, ProvUIMessages.AddColocatedRepositoryDialog_InvalidURL);
+ return null;
+ }
+ String urlSpec = newURL.toExternalForm();
+ try {
+ if (!urlSpec.endsWith("/")) //$NON-NLS-1$
+ urlSpec += "/"; //$NON-NLS-1$
+ newURL = new URL(urlSpec);
+ } catch (MalformedURLException e) {
+ return null;
+ }
+ return newURL;
+ }
+
+ protected String repositoryFileName() {
+ return null;
+ }
+
+ protected boolean repositoryIsFile() {
+ return false;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/AddRepositoryDialog.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/AddRepositoryDialog.java
new file mode 100644
index 000000000..a6502abcc
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/AddRepositoryDialog.java
@@ -0,0 +1,160 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.dialogs;
+
+import java.lang.reflect.InvocationTargetException;
+import java.net.URL;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.IUndoableOperation;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.prov.core.repository.IRepositoryInfo;
+import org.eclipse.equinox.prov.ui.ProvUI;
+import org.eclipse.equinox.prov.ui.ProvUIActivator;
+import org.eclipse.equinox.prov.ui.internal.ProvUIMessages;
+import org.eclipse.jface.dialogs.*;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.statushandlers.StatusManager;
+
+/**
+ * Abstract dialog class for adding repositories of different types. This class
+ * assumes the user view of a repository is a name and URL (and possibly other
+ * info as this class develops). Individual subclasses will dictate what kind of
+ * repository and how it's created.
+ *
+ * @since 3.4
+ *
+ */
+public abstract class AddRepositoryDialog extends StatusDialog {
+
+ private Button okButton;
+ private IRepositoryInfo[] knownRepositories;
+ private RepositoryGroup repoGroup;
+
+ public AddRepositoryDialog(Shell parentShell, IRepositoryInfo[] knownRepositories) {
+
+ super(parentShell);
+ this.knownRepositories = knownRepositories;
+ setTitle(ProvUIMessages.AddRepositoryDialog_Title);
+ }
+
+ protected void createButtonsForButtonBar(Composite parent) {
+ okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
+ createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
+ }
+
+ protected Control createDialogArea(Composite parent) {
+ repoGroup = new RepositoryGroup(parent, null, new ModifyListener() {
+ public void modifyText(ModifyEvent event) {
+ verifyComplete();
+ }
+ }, repositoryIsFile(), null, repositoryFileName());
+
+ Dialog.applyDialogFont(repoGroup.getComposite());
+ return repoGroup.getComposite();
+ }
+
+ protected void okPressed() {
+ if (addRepository()) {
+ setReturnCode(Window.OK);
+ super.okPressed();
+ } else {
+ setReturnCode(Window.CANCEL);
+ }
+ }
+
+ protected boolean addRepository() {
+ URL newURL = makeRepositoryURL(repoGroup.getURLString());
+ if (newURL == null) {
+ return false;
+ }
+
+ final IUndoableOperation op = getOperation(newURL, repoGroup.getRepositoryName());
+ final IStatus[] status = new IStatus[1];
+ IRunnableWithProgress runnable = new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) {
+ try {
+ status[0] = PlatformUI.getWorkbench().getOperationSupport().getOperationHistory().execute(op, monitor, ProvUI.getUIInfoAdapter(getShell()));
+ if (!status[0].isOK()) {
+ StatusManager.getManager().handle(status[0], StatusManager.SHOW | StatusManager.LOG);
+ }
+ } catch (ExecutionException e) {
+ ProvUI.handleException(e.getCause(), null);
+ status[0] = new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, 0, null, null);
+ }
+ }
+ };
+ try {
+ new ProgressMonitorDialog(getShell()).run(true, true, runnable);
+ } catch (InterruptedException e) {
+ // don't report thread interruption
+ } catch (InvocationTargetException e) {
+ ProvUI.handleException(e.getCause(), null);
+ status[0] = new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, 0, null, null);
+ }
+ return status[0].isOK();
+
+ }
+
+ protected abstract IUndoableOperation getOperation(URL url, String name);
+
+ protected abstract URL makeRepositoryURL(String urlString);
+
+ protected abstract boolean repositoryIsFile();
+
+ protected abstract String repositoryFileName();
+
+ void verifyComplete() {
+ if (okButton == null) {
+ return;
+ }
+ IStatus status = repoGroup.verify();
+ if (!status.isOK()) {
+ okButton.setEnabled(false);
+ updateStatus(status);
+ return;
+ }
+ if (isDuplicate()) {
+ return;
+ }
+ okButton.setEnabled(true);
+ updateStatus(new Status(IStatus.OK, ProvUIActivator.PLUGIN_ID, IStatus.OK, "", null)); //$NON-NLS-1$
+
+ }
+
+ protected boolean isDuplicate() {
+ String urlText = repoGroup.getURLString();
+ for (int i = 0; i < knownRepositories.length; i++) {
+ URL repURL = knownRepositories[i].getLocation();
+ if (repURL != null && repURL.equals(urlText)) {
+ setOkEnablement(false);
+ this.updateStatus(new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, IStatus.OK, ProvUIMessages.AddRepositoryDialog_DuplicateURL, null));
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected void updateButtonsEnableState(IStatus status) {
+ setOkEnablement(!status.matches(IStatus.ERROR));
+ }
+
+ protected void setOkEnablement(boolean enable) {
+ if (okButton != null && !okButton.isDisposed())
+ okButton.setEnabled(enable);
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/ColocatedRepositoryManipulatorGroup.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/ColocatedRepositoryManipulatorGroup.java
new file mode 100644
index 000000000..978d6706a
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/ColocatedRepositoryManipulatorGroup.java
@@ -0,0 +1,218 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.dialogs;
+
+import java.util.List;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepository;
+import org.eclipse.equinox.prov.ui.ProvUI;
+import org.eclipse.equinox.prov.ui.ProvUIActivator;
+import org.eclipse.equinox.prov.ui.internal.ProvUIMessages;
+import org.eclipse.equinox.prov.ui.model.AllMetadataRepositories;
+import org.eclipse.equinox.prov.ui.model.MetadataRepositoryContentProvider;
+import org.eclipse.equinox.prov.ui.operations.RemoveColocatedRepositoryOperation;
+import org.eclipse.equinox.prov.ui.viewers.ColocatedRepositoryLabelProvider;
+import org.eclipse.equinox.prov.ui.viewers.StructuredViewerProvisioningListener;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.jface.window.SameShellProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.graphics.FontMetrics;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.PropertyDialogAction;
+
+/**
+ * Dialog group that shows installed IU's and allows user to update or search
+ * for new ones.
+ *
+ * @since 3.4
+ */
+public class ColocatedRepositoryManipulatorGroup {
+
+ private static final String BUTTONACTION = "buttonAction"; //$NON-NLS-1$
+ TableViewer repositoryViewer;
+ private FontMetrics fm;
+ Display display;
+ StructuredViewerProvisioningListener listener;
+
+ /**
+ * Create an instance of this group.
+ *
+ */
+ public ColocatedRepositoryManipulatorGroup(Composite parent, ViewerFilter[] filters, int widthInDUs, int heightInDUs, FontMetrics fm) {
+
+ Assert.isNotNull(fm);
+ this.fm = fm;
+ this.display = parent.getDisplay();
+
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginWidth = convertHorizontalDLUsToPixels(2);
+ layout.marginHeight = convertVerticalDLUsToPixels(2);
+
+ composite.setLayout(layout);
+
+ // Table of available repositories
+ repositoryViewer = new TableViewer(composite, SWT.MULTI | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+ setTableColumns(repositoryViewer.getTable());
+ repositoryViewer.setContentProvider(new MetadataRepositoryContentProvider());
+ repositoryViewer.setInput(new AllMetadataRepositories());
+ repositoryViewer.setLabelProvider(new ColocatedRepositoryLabelProvider());
+ if (filters != null) {
+ repositoryViewer.setFilters(filters);
+ }
+ GridData data = new GridData(GridData.FILL_BOTH);
+ data.grabExcessHorizontalSpace = true;
+ data.grabExcessVerticalSpace = true;
+ data.widthHint = convertHorizontalDLUsToPixels(widthInDUs);
+ data.heightHint = convertVerticalDLUsToPixels(heightInDUs);
+ repositoryViewer.getControl().setLayoutData(data);
+
+ // Vertical buttons
+ Composite buttonBar = (Composite) createVerticalButtonBar(composite);
+ data = new GridData(GridData.FILL_VERTICAL);
+ buttonBar.setLayoutData(data);
+ listener = new StructuredViewerProvisioningListener(repositoryViewer, StructuredViewerProvisioningListener.PROV_EVENT_REPOSITORY);
+ ProvUIActivator.getDefault().addProvisioningListener(listener);
+ composite.addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent event) {
+ ProvUIActivator.getDefault().removeProvisioningListener(listener);
+ }
+ });
+ }
+
+ public Control getControl() {
+ return repositoryViewer.getControl().getParent();
+ }
+
+ private Control createVerticalButtonBar(Composite parent) {
+ // Create composite.
+ Composite composite = new Composite(parent, SWT.NULL);
+
+ // create a layout with spacing and margins appropriate for the font
+ // size.
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ layout.marginWidth = 5;
+ layout.marginHeight = 0;
+ layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
+ layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
+ composite.setLayout(layout);
+
+ // Add the buttons to the button bar.
+ Button button = createVerticalButton(composite, ProvUIMessages.UpdateAndInstallGroup_Properties, false);
+ button.setData(BUTTONACTION, new PropertyDialogAction(new SameShellProvider(parent.getShell()), repositoryViewer));
+ button = createVerticalButton(composite, ProvUIMessages.ColocatedRepositoryManipulatorGroup_Add, false);
+ button.setData(BUTTONACTION, new Action() {
+ public void runWithEvent(Event event) {
+ new AddColocatedRepositoryDialog(getControl().getShell(), (IMetadataRepository[]) ((IStructuredContentProvider) repositoryViewer.getContentProvider()).getElements(null)).open();
+ }
+ });
+ button = createVerticalButton(composite, ProvUIMessages.ColocatedRepositoryManipulatorGroup_Remove, false);
+ button.setData(BUTTONACTION, new Action() {
+ public void runWithEvent(Event event) {
+ List selection = ((IStructuredSelection) repositoryViewer.getSelection()).toList();
+ IMetadataRepository[] repos = new IMetadataRepository[selection.size()];
+ for (int i = 0; i < repos.length; i++) {
+ repos[i] = (IMetadataRepository) selection.get(i);
+ }
+ RemoveColocatedRepositoryOperation op = new RemoveColocatedRepositoryOperation(ProvUIMessages.ColocatedRepositoryManipulatorGroup_Remove, repos);
+ try {
+ PlatformUI.getWorkbench().getOperationSupport().getOperationHistory().execute(op, null, ProvUI.getUIInfoAdapter(getControl().getShell()));
+ } catch (ExecutionException e) {
+ ProvUI.handleException(e.getCause(), null);
+ }
+ }
+ });
+ return composite;
+ }
+
+ private Button createVerticalButton(Composite parent, String label, boolean defaultButton) {
+ Button button = new Button(parent, SWT.PUSH);
+ button.setText(label);
+
+ GridData data = setButtonLayoutData(button);
+ data.horizontalAlignment = GridData.FILL;
+
+ button.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event event) {
+ verticalButtonPressed(event);
+ }
+ });
+ button.setToolTipText(label);
+ if (defaultButton) {
+ Shell shell = parent.getShell();
+ if (shell != null) {
+ shell.setDefaultButton(button);
+ }
+ }
+ return button;
+ }
+
+ void verticalButtonPressed(Event event) {
+ Object data = event.widget.getData(BUTTONACTION);
+ if (data == null || !(data instanceof IAction)) {
+ return;
+ }
+ IAction action = (IAction) data;
+ action.runWithEvent(event);
+ }
+
+ private GridData setButtonLayoutData(Button button) {
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
+ Point minSize = button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
+ data.widthHint = Math.max(widthHint, minSize.x);
+ button.setLayoutData(data);
+ return data;
+ }
+
+ private int convertHorizontalDLUsToPixels(int dlus) {
+ // shouldn't happen
+ if (fm == null) {
+ return 0;
+ }
+ return Dialog.convertHorizontalDLUsToPixels(fm, dlus);
+ }
+
+ private int convertVerticalDLUsToPixels(int dlus) {
+ // shouldn't happen
+ if (fm == null) {
+ return 0;
+ }
+ return Dialog.convertVerticalDLUsToPixels(fm, dlus);
+ }
+
+ private void setTableColumns(Table table) {
+ table.setHeaderVisible(true);
+ String[] columnHeaders = {ProvUIMessages.ColocatedRepositoryManipulatorGroup_NameColumnHeader, ProvUIMessages.ColocatedRepositoryManipulatorGroup_LocationColumnHeader};
+ for (int i = 0; i < columnHeaders.length; i++) {
+ TableColumn tc = new TableColumn(table, SWT.NONE, i);
+ tc.setResizable(true);
+ tc.setText(columnHeaders[i]);
+ tc.setWidth(convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH));
+ }
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/ColocatedRepositoryPropertyPage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/ColocatedRepositoryPropertyPage.java
new file mode 100644
index 000000000..c8d062158
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/ColocatedRepositoryPropertyPage.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.dialogs;
+
+import org.eclipse.equinox.prov.core.repository.IRepositoryInfo;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepository;
+import org.eclipse.equinox.prov.ui.ColocatedRepositoryInfo;
+
+/**
+ * PropertyPage that shows a repository's properties
+ *
+ * @since 3.4
+ */
+public class ColocatedRepositoryPropertyPage extends RepositoryPropertyPage {
+ protected IRepositoryInfo getRepository() {
+ IRepositoryInfo repo = super.getRepository();
+ if (repo instanceof IMetadataRepository)
+ return new ColocatedRepositoryInfo((IMetadataRepository) repo);
+ return repo;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/IUGroup.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/IUGroup.java
new file mode 100644
index 000000000..616400755
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/IUGroup.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.dialogs;
+
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * An IUGroup is a reusable UI component that displays properties of an IU. It can be used in
+ * different dialogs that manipulate or define IU's.
+ *
+ * @since 3.4
+ */
+public abstract class IUGroup {
+
+ protected IInstallableUnit iu;
+ private Composite composite;
+
+ IUGroup(final Composite parent, IInstallableUnit iu, ModifyListener listener) {
+ this.iu = iu;
+ composite = createGroupComposite(parent, listener);
+ }
+
+ protected abstract Composite createGroupComposite(Composite parent, ModifyListener modifyListener);
+
+ public Composite getComposite() {
+ return composite;
+ }
+
+ public IInstallableUnit getIU() {
+ return iu;
+ }
+
+ public void updateIU() {
+ // default is to do nothing
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/IUImplementationGroup.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/IUImplementationGroup.java
new file mode 100644
index 000000000..797ad6a31
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/IUImplementationGroup.java
@@ -0,0 +1,202 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.dialogs;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.prov.metadata.*;
+import org.eclipse.equinox.prov.ui.ProvUIActivator;
+import org.eclipse.equinox.prov.ui.internal.ProvUIMessages;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.graphics.FontMetrics;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+import org.osgi.framework.Version;
+
+/**
+ * An IUImplementationGroup is a reusable UI component that displays and edits the
+ * implementation-oriented properties of an IU. It can be used in
+ * different dialogs that manipulate or define IU's.
+ *
+ * @since 3.4
+ */
+public class IUImplementationGroup extends IUGroup {
+
+ private Text id;
+ private Text version;
+ private Text namespace;
+ private Text touchpointType;
+ private List touchpointData;
+ private List requiredCapabilities;
+ private List providedCapabilities;
+
+ public IUImplementationGroup(final Composite parent, IInstallableUnit iu, ModifyListener listener) {
+ super(parent, iu, listener);
+ }
+
+ protected Composite createGroupComposite(Composite parent, ModifyListener listener) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ composite.setLayout(layout);
+ GridData data = new GridData();
+ data.widthHint = 350;
+ composite.setLayoutData(data);
+
+ // Grid data for text controls
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+
+ // Grid data for controls spanning both columns
+ GridData gd2 = new GridData(GridData.FILL_HORIZONTAL);
+ gd2.horizontalSpan = 2;
+
+ // Grid data for lists grabbing vertical space
+ GridData gdList = new GridData(GridData.FILL_HORIZONTAL);
+ GC gc = new GC(parent);
+ gc.setFont(JFaceResources.getDialogFont());
+ FontMetrics fontMetrics = gc.getFontMetrics();
+ gc.dispose();
+ gdList.horizontalSpan = 2;
+ gdList.heightHint = Dialog.convertHeightInCharsToPixels(fontMetrics, 5);
+
+ // TODO will existing IUs be editable?
+ boolean editable = iu == null && listener != null;
+
+ Label label = new Label(composite, SWT.NONE);
+ label.setText(ProvUIMessages.IUGroup_ID);
+ id = new Text(composite, SWT.BORDER);
+ id.setLayoutData(gd);
+ if (editable) {
+ id.addModifyListener(listener);
+ } else {
+ id.setEditable(false);
+ }
+
+ label = new Label(composite, SWT.NONE);
+ label.setText(ProvUIMessages.IUGroup_Version);
+ version = new Text(composite, SWT.BORDER);
+ version.setLayoutData(gd);
+
+ label = new Label(composite, SWT.NONE);
+ label.setText(ProvUIMessages.IUGroup_Namespace);
+ namespace = new Text(composite, SWT.BORDER);
+ namespace.setLayoutData(gd);
+
+ label = new Label(composite, SWT.NONE);
+ label.setText(ProvUIMessages.IUGroup_TouchpointType);
+ touchpointType = new Text(composite, SWT.BORDER | SWT.READ_ONLY);
+ touchpointType.setLayoutData(gd);
+
+ label = new Label(composite, SWT.NONE);
+ label.setText(ProvUIMessages.IUGroup_TouchpointData);
+ label.setLayoutData(gd2);
+ touchpointData = new List(composite, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
+ touchpointData.setLayoutData(gdList);
+
+ label = new Label(composite, SWT.NONE);
+ label.setText(ProvUIMessages.IUGroup_RequiredCapabilities);
+ label.setLayoutData(gd2);
+ requiredCapabilities = new List(composite, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
+ requiredCapabilities.setLayoutData(gdList);
+
+ label = new Label(composite, SWT.NONE);
+ label.setText(ProvUIMessages.IUGroup_ProvidedCapabilities);
+ label.setLayoutData(gd2);
+ providedCapabilities = new List(composite, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
+ providedCapabilities.setLayoutData(gdList);
+
+ if (editable) {
+ id.addModifyListener(listener);
+ version.addModifyListener(listener);
+ namespace.addModifyListener(listener);
+ touchpointType.addModifyListener(listener);
+ } else {
+ id.setEditable(false);
+ version.setEditable(false);
+ namespace.setEditable(false);
+ touchpointType.setEditable(false);
+ }
+ initializeFields();
+ return composite;
+ }
+
+ private void initializeFields() {
+ if (iu == null) {
+ return;
+ }
+ id.setText(iu.getId());
+ version.setText(iu.getVersion().toString());
+
+ String value = iu.getProperty(IInstallableUnit.IU_NAMESPACE);
+ if (value != null) {
+ namespace.setText(value);
+ }
+ TouchpointType type = iu.getTouchpointType();
+ if (type != null) {
+ touchpointType.setText(type.getId());
+ }
+ TouchpointData[] data = iu.getTouchpointData();
+ String[] items = new String[data.length];
+ for (int i = 0; i < data.length; i++) {
+ items[i] = data[i].toString();
+ }
+ touchpointData.setItems(items);
+
+ RequiredCapability[] req = iu.getRequiredCapabilities();
+ items = new String[req.length];
+ for (int i = 0; i < req.length; i++) {
+ items[i] = req[i].toString();
+ }
+ requiredCapabilities.setItems(items);
+ ProvidedCapability[] prov = iu.getProvidedCapabilities();
+ items = new String[prov.length];
+ for (int i = 0; i < prov.length; i++) {
+ items[i] = prov[i].toString();
+ }
+ providedCapabilities.setItems(items);
+ }
+
+ public void updateIU() {
+ if (iu == null) {
+ iu = new InstallableUnit();
+ }
+ // If it's not an InstallableUnit it is not editable
+ if (iu instanceof InstallableUnit) {
+ InstallableUnit unit = (InstallableUnit) iu;
+ unit.setId(id.getText().trim());
+ unit.setVersion(new Version(version.getText().trim()));
+ unit.setProperty(IInstallableUnit.IU_NAMESPACE, namespace.getText().trim());
+ // TODO this is bogus because we don't let user provide a touchpoint
+ // type version
+ unit.setTouchpointType(new TouchpointType(touchpointType.getText().trim(), new Version("1.0.0"))); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Return a status indicating the validity of the profile info
+ *
+ * @return a status indicating the validity of the profile info
+ */
+ public IStatus verify() {
+ if (id.getText().trim().length() == 0) {
+ return new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, 0, ProvUIMessages.IUGroup_IU_ID_Required, null);
+ }
+
+ // TODO what kind of validation do we perform for other properties?
+ return new Status(IStatus.OK, ProvUIActivator.PLUGIN_ID, IStatus.OK, "", null); //$NON-NLS-1$
+
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/IUImplementationPropertyPage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/IUImplementationPropertyPage.java
new file mode 100644
index 000000000..16416033d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/IUImplementationPropertyPage.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.dialogs;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.equinox.prov.metadata.InstallableUnit;
+import org.eclipse.equinox.prov.ui.internal.ProvUIMessages;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.ui.dialogs.PropertyPage;
+
+/**
+ * PropertyPage that shows an IU's properties
+ *
+ * @since 3.4
+ */
+public class IUImplementationPropertyPage extends PropertyPage {
+
+ private IUImplementationGroup iuGroup;
+
+ protected Control createContents(Composite parent) {
+ InstallableUnit iu = (InstallableUnit) getElement().getAdapter(InstallableUnit.class);
+ if (iu == null) {
+ Label label = new Label(parent, SWT.DEFAULT);
+ label.setText(ProvUIMessages.IUPropertyPage_NoIUSelected);
+ }
+ iuGroup = new IUImplementationGroup(parent, iu, new ModifyListener() {
+ public void modifyText(ModifyEvent event) {
+ verifyComplete();
+ }
+ });
+ Dialog.applyDialogFont(iuGroup.getComposite());
+ verifyComplete();
+ return iuGroup.getComposite();
+ }
+
+ public boolean performOk() {
+ return true;
+ }
+
+ void verifyComplete() {
+ if (iuGroup == null) {
+ return;
+ }
+ IStatus status = iuGroup.verify();
+ setValid(status.isOK());
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/IUPropertiesGroup.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/IUPropertiesGroup.java
new file mode 100644
index 000000000..57185b267
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/IUPropertiesGroup.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.dialogs;
+
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.metadata.IInstallableUnitConstants;
+import org.eclipse.equinox.prov.ui.internal.ProvUIMessages;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+
+/**
+ * An IUPropertiesGroup is a reusable UI component that displays and edits the
+ * user-oriented properties of an IU. It can be used in
+ * different dialogs that manipulate or define IU's.
+ *
+ * @since 3.4
+ */
+public class IUPropertiesGroup extends IUGroup {
+
+ private Table propertiesTable;
+
+ public IUPropertiesGroup(final Composite parent, IInstallableUnit iu, ModifyListener listener) {
+ super(parent, iu, listener);
+ }
+
+ protected Composite createGroupComposite(Composite parent, ModifyListener listener) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ composite.setLayout(layout);
+ GridData data = new GridData();
+ data.widthHint = 400;
+ composite.setLayoutData(data);
+
+ propertiesTable = new Table(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+ data = new GridData(GridData.FILL_BOTH);
+ data.grabExcessVerticalSpace = true;
+ propertiesTable.setLayoutData(data);
+ propertiesTable.setHeaderVisible(true);
+ TableColumn nameColumn = new TableColumn(propertiesTable, SWT.NONE);
+ nameColumn.setResizable(true);
+ nameColumn.setWidth(200);
+ TableColumn valueColumn = new TableColumn(propertiesTable, SWT.NONE);
+ valueColumn.setResizable(true);
+ valueColumn.setWidth(250);
+ initializeFields();
+ return composite;
+ }
+
+ private void initializeFields() {
+ if (iu == null) {
+ return;
+ }
+ String[] propNames = new String[] {IInstallableUnitConstants.NAME, IInstallableUnitConstants.DESCRIPTION, IInstallableUnitConstants.PROVIDER, IInstallableUnitConstants.COPYRIGHT, IInstallableUnitConstants.LICENSE};
+ String[] userPropNames = new String[] {ProvUIMessages.IUPropertiesGroup_NameProperty, ProvUIMessages.IUPropertiesGroup_DescriptionProperty, ProvUIMessages.IUPropertiesGroup_ProviderProperty, ProvUIMessages.IUPropertiesGroup_CopyrightProperty, ProvUIMessages.IUPropertiesGroup_LicenseProperty};
+ for (int i = 0; i < propNames.length; i++) {
+ TableItem item = new TableItem(propertiesTable, SWT.NULL);
+ String value = iu.getProperty(propNames[i]);
+ if (value != null)
+ item.setText(new String[] {userPropNames[i], value});
+ }
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/IUPropertyPage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/IUPropertyPage.java
new file mode 100644
index 000000000..2876ba03f
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/IUPropertyPage.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.dialogs;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.ui.internal.ProvUIMessages;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.ui.dialogs.PropertyPage;
+
+/**
+ * PropertyPage that shows an IU's properties
+ *
+ * @since 3.4
+ */
+public class IUPropertyPage extends PropertyPage {
+
+ private IUPropertiesGroup iuGroup;
+
+ protected Control createContents(Composite parent) {
+ Object element = getElement();
+ IInstallableUnit iu = null;
+ if (element instanceof IInstallableUnit) {
+ iu = (IInstallableUnit) element;
+ } else if (element instanceof IAdaptable) {
+ iu = (IInstallableUnit) ((IAdaptable) element).getAdapter(IInstallableUnit.class);
+ }
+ if (iu == null) {
+ Label label = new Label(parent, SWT.DEFAULT);
+ label.setText(ProvUIMessages.IUPropertyPage_NoIUSelected);
+ }
+ iuGroup = new IUPropertiesGroup(parent, iu, new ModifyListener() {
+ public void modifyText(ModifyEvent event) {
+ // not editable
+ }
+ });
+ Dialog.applyDialogFont(iuGroup.getComposite());
+ return iuGroup.getComposite();
+ }
+
+ public boolean performOk() {
+ return true;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/ProfileGroup.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/ProfileGroup.java
new file mode 100644
index 000000000..e975f763e
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/ProfileGroup.java
@@ -0,0 +1,265 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Andrew Overholt <overholt@redhat.com> - Fix for Bug 197970
+ * [prov] unset Profile name causes exception bringing up profile properties
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.dialogs;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.ui.ProvUIActivator;
+import org.eclipse.equinox.prov.ui.internal.ProvUIMessages;
+import org.eclipse.equinox.prov.ui.model.ProfileFactory;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.*;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+
+/**
+ * A ProfileGroup is a reusable UI component that displays and edits the
+ * properties of a profile. It can be used in different dialogs that manipulate
+ * or define profiles.
+ *
+ * @since 3.4
+ *
+ */
+public class ProfileGroup {
+
+ // FIXME: temporary for M1; should make flavor a dropdown, populated
+ // via a query for all flavors in known repositories
+ static private String FLAVOR_DEFAULT = "tooling"; //$NON-NLS-1$
+
+ Text id;
+ Text location;
+ Text cache;
+ Text name;
+ Text description;
+ Text flavor;
+ Text environments;
+ Text nl;
+ Profile profile;
+
+ public ProfileGroup(final Composite parent, Profile profile, ModifyListener listener) {
+ this.profile = profile;
+
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 3;
+ composite.setLayout(layout);
+ GridData data = new GridData();
+ data.widthHint = 350;
+ composite.setLayoutData(data);
+
+ // Grid data for most text controls
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 2;
+
+ Label label = new Label(composite, SWT.NONE);
+ label.setText(ProvUIMessages.ProfileGroup_ID);
+ id = new Text(composite, SWT.BORDER);
+ id.setLayoutData(gd);
+ if (profile == null && listener != null) {
+ id.addModifyListener(listener);
+ } else {
+ id.setEditable(false);
+ }
+
+ label = new Label(composite, SWT.NONE);
+ label.setText(ProvUIMessages.ProfileGroup_InstallFolder);
+ location = new Text(composite, SWT.BORDER);
+ location.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ location.addModifyListener(listener);
+ Button locationButton = new Button(composite, SWT.PUSH);
+ locationButton.setText(ProvUIMessages.ProfileGroup_Browse);
+ locationButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ DirectoryDialog dialog = new DirectoryDialog(parent.getShell(), SWT.APPLICATION_MODAL);
+ dialog.setMessage(ProvUIMessages.ProfileGroup_SelectProfileMessage);
+ String dir = dialog.open();
+ if (dir != null) {
+ location.setText(dir);
+ }
+ }
+ });
+
+ label = new Label(composite, SWT.NONE);
+ label.setText(ProvUIMessages.ProfileGroup_Cache);
+ cache = new Text(composite, SWT.BORDER);
+ cache.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ cache.addModifyListener(listener);
+ locationButton = new Button(composite, SWT.PUSH);
+ locationButton.setText(ProvUIMessages.ProfileGroup_Browse);
+ locationButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ DirectoryDialog dialog = new DirectoryDialog(parent.getShell(), SWT.APPLICATION_MODAL);
+ dialog.setMessage(ProvUIMessages.ProfileGroup_SelectBundlePoolCache);
+ String dir = dialog.open();
+ if (dir != null) {
+ cache.setText(dir);
+ }
+ }
+ });
+
+ label = new Label(composite, SWT.NONE);
+ label.setText(ProvUIMessages.ProfileGroup_Name);
+ name = new Text(composite, SWT.BORDER);
+ name.setLayoutData(gd);
+ name.addModifyListener(listener);
+ label = new Label(composite, SWT.NONE);
+ label.setText(ProvUIMessages.ProfileGroup_Description);
+ description = new Text(composite, SWT.BORDER);
+ description.setLayoutData(gd);
+ description.addModifyListener(listener);
+
+ label = new Label(composite, SWT.NONE);
+ label.setText(ProvUIMessages.ProfileGroup_Flavor);
+ flavor = new Text(composite, SWT.BORDER);
+ flavor.setLayoutData(gd);
+ flavor.addModifyListener(listener);
+
+ label = new Label(composite, SWT.NONE);
+ label.setText(ProvUIMessages.ProfileGroup_Environments);
+ environments = new Text(composite, SWT.BORDER);
+ environments.setLayoutData(gd);
+ environments.addModifyListener(listener);
+
+ label = new Label(composite, SWT.NONE);
+ label.setText(ProvUIMessages.ProfileGroup_NL);
+ nl = new Text(composite, SWT.BORDER);
+ nl.setLayoutData(gd);
+ nl.addModifyListener(listener);
+
+ initializeFields();
+ }
+
+ private void initializeFields() {
+ if (profile == null) {
+ location.setText(ProfileFactory.getDefaultLocation());
+ environments.setText(ProfileFactory.getDefaultEnvironments());
+ nl.setText(ProfileFactory.getDefaultNL());
+ flavor.setText(ProfileFactory.getDefaultFlavor());
+ } else {
+ String value = profile.getProfileId();
+ // Should not happen, profiles must have an id, but just in case.
+ if (value == null)
+ value = ""; //$NON-NLS-1$
+ id.setText(value);
+
+ // The remaining values may be null
+ value = profile.getValue(Profile.PROP_INSTALL_FOLDER);
+ if (value != null) {
+ location.setText(value);
+ }
+ value = profile.getValue(Profile.PROP_CACHE);
+ if (value != null) {
+ cache.setText(value);
+ }
+
+ value = profile.getValue(Profile.PROP_NAME);
+ if (value != null) {
+ name.setText(value);
+ }
+ value = profile.getValue(Profile.PROP_DESCRIPTION);
+ if (value != null) {
+ description.setText(value);
+ }
+ value = profile.getValue(Profile.PROP_FLAVOR);
+ // TODO: temporary for M1; should make flavor a dropdown
+ flavor.setText(value != null ? value : FLAVOR_DEFAULT);
+ // if (value != null) {
+ // flavor.setText(value);
+ // }
+ value = profile.getValue(Profile.PROP_ENVIRONMENTS);
+ if (value != null) {
+ environments.setText(value);
+ }
+ value = profile.getValue(Profile.PROP_NL);
+ if (value != null) {
+ nl.setText(value);
+ }
+ }
+ }
+
+ public void updateProfile() {
+ // We forced the id field to have content so don't
+ // check its length
+ if (profile == null) {
+ profile = new Profile(id.getText().trim());
+ }
+ String value = location.getText().trim();
+ if (value.length() > 0) {
+ profile.setValue(Profile.PROP_INSTALL_FOLDER, value);
+ }
+
+ value = cache.getText().trim();
+ if (value.length() > 0) {
+ profile.setValue(Profile.PROP_CACHE, value);
+ }
+
+ value = name.getText().trim();
+ if (value.length() > 0) {
+ profile.setValue(Profile.PROP_NAME, value);
+ }
+ value = description.getText().trim();
+ if (value.length() > 0) {
+ profile.setValue(Profile.PROP_DESCRIPTION, value);
+ }
+ value = flavor.getText().trim();
+ if (value.length() > 0) {
+ profile.setValue(Profile.PROP_FLAVOR, value);
+ }
+ value = environments.getText().trim();
+ if (value.length() > 0) {
+ profile.setValue(Profile.PROP_ENVIRONMENTS, value);
+ }
+ value = nl.getText().trim();
+ if (value.length() > 0) {
+ profile.setValue(Profile.PROP_NL, value);
+ }
+ }
+
+ public Composite getComposite() {
+ if (id == null) {
+ return null;
+ }
+ return id.getParent();
+ }
+
+ public Profile getProfile() {
+ return profile;
+ }
+
+ public String getProfileId() {
+ if (profile != null) {
+ return profile.getProfileId();
+ }
+ return id.getText().trim();
+ }
+
+ /**
+ * Return a status indicating the validity of the profile info
+ *
+ * @return a status indicating the validity of the profile info
+ */
+ public IStatus verify() {
+ if (id.getText().trim().length() == 0) {
+ return new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, 0, ProvUIMessages.ProfileGroup_ProfileIDRequired, null);
+ }
+ if (location.getText().trim().length() == 0) {
+ return new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, 0, ProvUIMessages.ProfileGroup_ProfileInstallFolderRequired, null);
+ }
+
+ // TODO what kind of validation do we perform for other properties?
+ return new Status(IStatus.OK, ProvUIActivator.PLUGIN_ID, IStatus.OK, "", null); //$NON-NLS-1$
+
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/ProfilePropertyPage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/ProfilePropertyPage.java
new file mode 100644
index 000000000..5d3ecad84
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/ProfilePropertyPage.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.dialogs;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.ui.internal.ProvUIMessages;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.ui.dialogs.PropertyPage;
+
+/**
+ * PropertyPage that shows an IU's properties
+ *
+ * @since 3.4
+ */
+public class ProfilePropertyPage extends PropertyPage {
+
+ private ProfileGroup profileGroup;
+
+ protected Control createContents(Composite parent) {
+ Profile profile = (Profile) getElement().getAdapter(Profile.class);
+ if (profile == null) {
+ Label label = new Label(parent, SWT.DEFAULT);
+ label.setText(ProvUIMessages.ProfilePropertyPage_NoProfileSelected);
+ }
+ profileGroup = new ProfileGroup(parent, profile, new ModifyListener() {
+ public void modifyText(ModifyEvent event) {
+ verifyComplete();
+ }
+ });
+ Dialog.applyDialogFont(profileGroup.getComposite());
+ verifyComplete();
+ return profileGroup.getComposite();
+ }
+
+ void verifyComplete() {
+ if (profileGroup == null) {
+ return;
+ }
+ IStatus status = profileGroup.verify();
+ setValid(status.isOK());
+ }
+
+ public boolean performOk() {
+ profileGroup.updateProfile();
+ return true;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/RepositoryGroup.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/RepositoryGroup.java
new file mode 100644
index 000000000..d6d1b1216
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/RepositoryGroup.java
@@ -0,0 +1,156 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.dialogs;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.prov.core.repository.IRepositoryInfo;
+import org.eclipse.equinox.prov.core.repository.IWritableRepositoryInfo;
+import org.eclipse.equinox.prov.ui.ProvUIActivator;
+import org.eclipse.equinox.prov.ui.internal.ProvUIMessages;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.*;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+
+/**
+ * A RepositoryGroup is a reusable UI component that allows repository
+ * attributes to be displayed and edited in different UI dialogs.
+ *
+ * @since 3.4
+ *
+ */
+public class RepositoryGroup {
+
+ private static final String EXTENSION = "*.xml"; //$NON-NLS-1$
+ private Composite composite;
+ Text name;
+ Text url;
+ IRepositoryInfo repository;
+
+ public RepositoryGroup(Composite parent, IRepositoryInfo repository, ModifyListener listener, boolean chooseFile, String dirPath, String fileName) {
+ this.repository = repository;
+ createGroupComposite(parent, listener, chooseFile, dirPath, fileName);
+ }
+
+ protected Composite createGroupComposite(final Composite parent, ModifyListener listener, final boolean chooseFile, final String dirPath, final String fileName) {
+ Composite comp = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 3;
+ comp.setLayout(layout);
+ GridData data = new GridData();
+ data.widthHint = 350;
+ comp.setLayoutData(data);
+
+ Label nameLabel = new Label(comp, SWT.NONE);
+ nameLabel.setText(ProvUIMessages.RepositoryGroup_RepositoryNameFieldLabel);
+
+ name = new Text(comp, SWT.BORDER);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalSpan = 2;
+ name.setLayoutData(data);
+ name.addModifyListener(listener);
+ // TODO: this may not be the right computation for determining
+ // writability
+ // of the name and other properties of a repository.
+ boolean readOnlyInfo = (repository != null && repository.getAdapter(IWritableRepositoryInfo.class) == null);
+ if (readOnlyInfo) {
+ name.setEditable(false);
+ }
+
+ Label urlLabel = new Label(comp, SWT.NONE);
+ urlLabel.setText(ProvUIMessages.RepositoryGroup_RepositoryURLFieldLabel);
+
+ url = new Text(comp, SWT.BORDER);
+ url.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ if (repository == null) {
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ url.setLayoutData(data);
+ url.addModifyListener(listener);
+
+ // add a button for setting a local repository
+ Button locationButton = new Button(comp, SWT.PUSH);
+ locationButton.setText(ProvUIMessages.RepositoryGroup_Browse);
+ locationButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ String path;
+ if (chooseFile) {
+ FileDialog dialog = new FileDialog(parent.getShell(), SWT.APPLICATION_MODAL);
+ dialog.setText(ProvUIMessages.RepositoryGroup_RepositoryFile);
+ dialog.setFileName(fileName);
+ dialog.setFilterPath(dirPath);
+ dialog.setFilterExtensions(new String[] {EXTENSION});
+ path = dialog.open();
+ } else {
+ DirectoryDialog dialog = new DirectoryDialog(parent.getShell(), SWT.APPLICATION_MODAL);
+ dialog.setMessage(ProvUIMessages.RepositoryGroup_SelectRepositoryDirectory);
+ dialog.setFilterPath(dirPath);
+ path = dialog.open();
+ }
+ if (path != null) {
+ url.setText("file:" + path.toLowerCase()); //$NON-NLS-1$
+ }
+ }
+ });
+
+ } else {
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalSpan = 2;
+ url.setLayoutData(data);
+ url.setEditable(false);
+ }
+
+ initializeFields();
+ return comp;
+ }
+
+ private void initializeFields() {
+ if (repository == null) {
+ url.setText("http://"); //$NON-NLS-1$
+ name.setText(""); //$NON-NLS-1$
+ } else {
+ url.setText(repository.getLocation().toExternalForm());
+ name.setText(repository.getName());
+ }
+ }
+
+ public IStatus verify() {
+ if (url.getText().trim().length() == 0) {
+ return new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, 0, ProvUIMessages.RepositoryGroup_URLRequired, null);
+ }
+ // blank name is ok
+ return new Status(IStatus.OK, ProvUIActivator.PLUGIN_ID, IStatus.OK, "", null); //$NON-NLS-1$
+
+ }
+
+ /**
+ * Get the url string as shown in the dialog.
+ *
+ * @return the String representation of the URL.
+ */
+ public String getURLString() {
+ return url.getText().trim();
+ }
+
+ /**
+ * Get the repository name string as shown in the dialog.
+ *
+ * @return the repository name.
+ */
+ public String getRepositoryName() {
+ return name.getText().trim();
+ }
+
+ public Composite getComposite() {
+ return composite;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/RepositoryImplementationGroup.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/RepositoryImplementationGroup.java
new file mode 100644
index 000000000..a8053d6c2
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/RepositoryImplementationGroup.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.dialogs;
+
+import java.util.Map;
+import org.eclipse.equinox.prov.core.repository.IRepositoryInfo;
+import org.eclipse.equinox.prov.ui.internal.ProvUIMessages;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.*;
+
+/**
+ * A RepositoryGroup is a reusable UI component that allows repository
+ * attributes to be displayed and edited in different UI dialogs.
+ *
+ * @since 3.4
+ *
+ */
+public class RepositoryImplementationGroup extends RepositoryGroup {
+
+ Table propertiesTable;
+
+ public RepositoryImplementationGroup(final Composite parent, IRepositoryInfo repository, ModifyListener listener, final boolean chooseFile, final String dirPath, final String fileName) {
+ super(parent, repository, listener, chooseFile, dirPath, fileName);
+ }
+
+ protected Composite createGroupComposite(final Composite parent, ModifyListener listener, final boolean chooseFile, final String dirPath, final String fileName) {
+ Composite comp = super.createGroupComposite(parent, listener, chooseFile, dirPath, fileName);
+ Label propertiesLabel = new Label(comp, SWT.NONE);
+ propertiesLabel.setText(ProvUIMessages.RepositoryGroup_PropertiesLabel);
+ GridData data = new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalSpan = 3;
+ propertiesLabel.setLayoutData(data);
+
+ propertiesTable = new Table(comp, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+ data = new GridData(GridData.FILL_BOTH);
+ data.horizontalSpan = 3;
+ data.grabExcessVerticalSpace = true;
+ propertiesTable.setLayoutData(data);
+ propertiesTable.setHeaderVisible(true);
+ TableColumn nameColumn = new TableColumn(propertiesTable, SWT.NONE);
+ nameColumn.setText(ProvUIMessages.RepositoryGroup_NameColumnLabel);
+ TableColumn valueColumn = new TableColumn(propertiesTable, SWT.NONE);
+ valueColumn.setText(ProvUIMessages.RepositoryGroup_ValueColumnLabel);
+
+ initializeTable();
+
+ nameColumn.pack();
+ valueColumn.pack();
+ return comp;
+ }
+
+ private void initializeTable() {
+ if (repository != null) {
+ Map repoProperties = repository.getProperties();
+ if (repoProperties != null) {
+ String[] propNames = (String[]) repoProperties.keySet().toArray(new String[repoProperties.size()]);
+ for (int i = 0; i < propNames.length; i++) {
+ TableItem item = new TableItem(propertiesTable, SWT.NULL);
+ item.setText(new String[] {propNames[i], repoProperties.get(propNames[i]).toString()});
+ }
+ }
+ }
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/RepositoryImplementationPropertyPage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/RepositoryImplementationPropertyPage.java
new file mode 100644
index 000000000..7498ac034
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/RepositoryImplementationPropertyPage.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.dialogs;
+
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * PropertyPage that shows a repository's properties
+ *
+ * @since 3.4
+ */
+public class RepositoryImplementationPropertyPage extends RepositoryPropertyPage {
+
+ protected RepositoryGroup createRepositoryGroup(Composite parent) {
+ return new RepositoryImplementationGroup(parent, repository, new ModifyListener() {
+ public void modifyText(ModifyEvent event) {
+ verifyComplete();
+ }
+ }, false, null, null); // these don't matter since repo already
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/RepositoryPropertyPage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/RepositoryPropertyPage.java
new file mode 100644
index 000000000..79f91cdb8
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/RepositoryPropertyPage.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.dialogs;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.equinox.prov.core.repository.IRepositoryInfo;
+import org.eclipse.equinox.prov.ui.ProvisioningUtil;
+import org.eclipse.equinox.prov.ui.internal.ProvUIMessages;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.ui.dialogs.PropertyPage;
+
+/**
+ * PropertyPage that shows a repository's properties
+ *
+ * @since 3.4
+ */
+public class RepositoryPropertyPage extends PropertyPage {
+
+ IRepositoryInfo repository;
+ private RepositoryGroup repoGroup;
+
+ protected Control createContents(Composite parent) {
+ noDefaultAndApplyButton();
+ this.repository = getRepository();
+
+ if (repository == null) {
+ Label label = new Label(parent, SWT.DEFAULT);
+ label.setText(ProvUIMessages.RepositoryPropertyPage_NoRepoSelected);
+ }
+ repoGroup = createRepositoryGroup(parent);
+ // exists
+ Dialog.applyDialogFont(repoGroup.getComposite());
+ verifyComplete();
+ return repoGroup.getComposite();
+ }
+
+ protected RepositoryGroup createRepositoryGroup(Composite parent) {
+ return new RepositoryGroup(parent, repository, new ModifyListener() {
+ public void modifyText(ModifyEvent event) {
+ verifyComplete();
+ }
+ }, false, null, null); // these don't matter since repo already
+ }
+
+ public boolean performOk() {
+ String nameValue = repoGroup.getRepositoryName();
+ if (repository != null && nameValue != null && !nameValue.equals(repository.getName())) {
+ // TODO HACK - if I could get event notification from core, I
+ // wouldn't have to call the
+ // util class
+ ProvisioningUtil.setRepositoryName(repository, nameValue);
+ }
+ return true;
+ }
+
+ void verifyComplete() {
+ if (repoGroup == null) {
+ return;
+ }
+ IStatus status = repoGroup.verify();
+ setValid(status.isOK());
+ }
+
+ protected IRepositoryInfo getRepository() {
+ return (IRepositoryInfo) getElement().getAdapter(IRepositoryInfo.class);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/UpdateAndInstallGroup.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/UpdateAndInstallGroup.java
new file mode 100644
index 000000000..f9345754f
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/dialogs/UpdateAndInstallGroup.java
@@ -0,0 +1,354 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.dialogs;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.ui.*;
+import org.eclipse.equinox.prov.ui.actions.*;
+import org.eclipse.equinox.prov.ui.internal.ProvUIMessages;
+import org.eclipse.equinox.prov.ui.model.*;
+import org.eclipse.equinox.prov.ui.viewers.IUDetailsLabelProvider;
+import org.eclipse.equinox.prov.ui.viewers.StructuredViewerProvisioningListener;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.jface.window.SameShellProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.graphics.FontMetrics;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.ui.dialogs.PropertyDialogAction;
+
+/**
+ * Dialog group that shows installed IU's and allows user to update or search
+ * for new ones.
+ *
+ * @since 3.4
+ */
+public class UpdateAndInstallGroup {
+
+ private static final String BUTTONACTION = "buttonAction"; //$NON-NLS-1$
+ TabFolder tabFolder;
+ TableViewer installedIUViewer;
+ TableViewer availableIUViewer;
+ Profile profile;
+ IRepositoryManipulator repositoryManipulator;
+ IProfileChooser profileChooser;
+ private FontMetrics fm;
+ Button installedPropButton, availablePropButton, installButton, uninstallButton, updateButton;
+
+ /**
+ * Create an instance of this group.
+ *
+ */
+ // TODO we currently specify the filtering for what IU's we want to see with
+ // a viewer filter. More likely we would pass in the required
+ // capability/version info
+ // and use the iterator API rather than get all IU's and then filter them
+ public UpdateAndInstallGroup(Composite parent, Profile profile, ViewerFilter[] installedIUFilters, ViewerFilter[] availableIUFilters, String installedString, String availableString, IRepositoryManipulator repositoryManipulator, IProfileChooser profileChooser, int widthInDUs, int heightInDUs, FontMetrics fm) {
+
+ this.profile = profile;
+ this.repositoryManipulator = repositoryManipulator;
+ this.profileChooser = profileChooser;
+
+ // tab folder
+ tabFolder = new TabFolder(parent, SWT.NONE);
+
+ Assert.isNotNull(fm);
+ this.fm = fm;
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ gd.widthHint = convertHorizontalDLUsToPixels(widthInDUs);
+ gd.heightHint = convertVerticalDLUsToPixels(heightInDUs);
+ tabFolder.setLayoutData(gd);
+
+ // Installed IU's
+ TabItem installedTab = new TabItem(tabFolder, SWT.NONE);
+ installedTab.setText(installedString);
+ installedTab.setControl(createInstalledIUsPage(tabFolder, installedIUFilters));
+
+ // Find IU's
+ TabItem availableTab = new TabItem(tabFolder, SWT.NONE);
+ availableTab.setText(availableString);
+ availableTab.setControl(createAvailableIUsPage(tabFolder, availableIUFilters));
+ }
+
+ public Control getControl() {
+ return tabFolder;
+ }
+
+ private Control createAvailableIUsPage(Composite parent, ViewerFilter[] iuFilters) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ composite.setLayout(layout);
+
+ // Table of available IU's
+ availableIUViewer = new TableViewer(composite, SWT.MULTI | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+ setTableColumns(availableIUViewer.getTable());
+ availableIUViewer.setContentProvider(new AvailableIUContentProvider());
+ availableIUViewer.setInput(new AllMetadataRepositories());
+ availableIUViewer.setLabelProvider(new IUDetailsLabelProvider());
+ if (iuFilters != null) {
+ availableIUViewer.setFilters(iuFilters);
+ }
+ availableIUViewer.setComparator(new ViewerComparator());
+ GridData data = new GridData(GridData.FILL_BOTH);
+ data.grabExcessHorizontalSpace = true;
+ data.grabExcessVerticalSpace = true;
+ availableIUViewer.getControl().setLayoutData(data);
+
+ // Vertical buttons
+ Composite buttonBar = (Composite) createAvailableIUsVerticalButtonBar(composite);
+ data = new GridData(GridData.FILL_VERTICAL);
+ buttonBar.setLayoutData(data);
+
+ availableIUViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ validateAvailableIUButtons(event.getSelection());
+ }
+ });
+
+ final StructuredViewerProvisioningListener listener = new StructuredViewerProvisioningListener(availableIUViewer, StructuredViewerProvisioningListener.PROV_EVENT_REPOSITORY);
+ ProvUIActivator.getDefault().addProvisioningListener(listener);
+ availableIUViewer.getControl().addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent e) {
+ ProvUIActivator.getDefault().removeProvisioningListener(listener);
+ }
+ });
+
+ validateAvailableIUButtons(installedIUViewer.getSelection());
+ return composite;
+ }
+
+ private Control createAvailableIUsVerticalButtonBar(Composite parent) {
+ // Create composite.
+ Composite composite = new Composite(parent, SWT.NULL);
+
+ // create a layout with spacing and margins appropriate for the font
+ // size.
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ layout.marginWidth = 5;
+ layout.marginHeight = 0;
+ layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
+ layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
+ composite.setLayout(layout);
+
+ // Add the buttons to the button bar.
+ availablePropButton = createVerticalButton(composite, ProvUIMessages.UpdateAndInstallGroup_Properties, false);
+ availablePropButton.setData(BUTTONACTION, new PropertyDialogAction(new SameShellProvider(parent.getShell()), availableIUViewer));
+ installButton = createVerticalButton(composite, ProvUIMessages.UpdateAndInstallGroup_Install, false);
+ installButton.setData(BUTTONACTION, new InstallAction(ProvUIMessages.UpdateAndInstallGroup_Install, availableIUViewer, null, profile, null, parent.getShell()));
+ Button refreshButton = createVerticalButton(composite, ProvUIMessages.UpdateAndInstallGroup_Refresh, false);
+ refreshButton.setData(BUTTONACTION, new Action() {
+ public void runWithEvent(Event event) {
+ availableIUViewer.setInput(new AllMetadataRepositories());
+ }
+ });
+
+ if (repositoryManipulator != null) {
+ Button repoButton = createVerticalButton(composite, repositoryManipulator.getLabel(), false);
+ repoButton.setData(BUTTONACTION, new Action() {
+ public void runWithEvent(Event event) {
+ if (repositoryManipulator.manipulateRepositories(getControl().getShell())) {
+ availableIUViewer.setInput(new AllMetadataRepositories());
+ }
+ }
+ });
+
+ }
+ return composite;
+ }
+
+ void validateAvailableIUButtons(ISelection selection) {
+ availablePropButton.setEnabled(((IStructuredSelection) selection).size() == 1);
+ installButton.setEnabled(!selection.isEmpty());
+ }
+
+ private Control createInstalledIUsPage(Composite parent, ViewerFilter[] iuFilters) {
+
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ composite.setLayout(layout);
+
+ // Table of installed IU's
+ installedIUViewer = new TableViewer(composite, SWT.MULTI | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+ setTableColumns(installedIUViewer.getTable());
+ installedIUViewer.setContentProvider(new ProfileContentProvider());
+ installedIUViewer.setInput(profile);
+ installedIUViewer.setLabelProvider(new IUDetailsLabelProvider());
+ if (iuFilters != null) {
+ installedIUViewer.setFilters(iuFilters);
+ }
+ installedIUViewer.setComparator(new ViewerComparator());
+
+ GridData data = new GridData(GridData.FILL_BOTH);
+ data.grabExcessHorizontalSpace = true;
+ data.grabExcessVerticalSpace = true;
+ installedIUViewer.getControl().setLayoutData(data);
+
+ // Vertical buttons
+ Composite buttonBar = (Composite) createInstalledIUsVerticalButtonBar(composite);
+ data = new GridData(GridData.FILL_VERTICAL);
+ buttonBar.setLayoutData(data);
+
+ installedIUViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ validateInstalledIUButtons(event.getSelection());
+ }
+ });
+
+ final StructuredViewerProvisioningListener listener = new StructuredViewerProvisioningListener(installedIUViewer, StructuredViewerProvisioningListener.PROV_EVENT_IU | StructuredViewerProvisioningListener.PROV_EVENT_PROFILE);
+ ProvUIActivator.getDefault().addProvisioningListener(listener);
+ installedIUViewer.getControl().addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent e) {
+ ProvUIActivator.getDefault().removeProvisioningListener(listener);
+ }
+ });
+ validateInstalledIUButtons(installedIUViewer.getSelection());
+ return composite;
+ }
+
+ private Control createInstalledIUsVerticalButtonBar(Composite parent) {
+ // Create composite.
+ Composite composite = new Composite(parent, SWT.NULL);
+
+ // create a layout with spacing and margins appropriate for the font
+ // size.
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ layout.marginWidth = 5;
+ layout.marginHeight = 0;
+ layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
+ layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
+ composite.setLayout(layout);
+
+ // Add the buttons to the button bar.
+ installedPropButton = createVerticalButton(composite, ProvUIMessages.UpdateAndInstallGroup_Properties, false);
+ installedPropButton.setData(BUTTONACTION, new PropertyDialogAction(new SameShellProvider(parent.getShell()), installedIUViewer));
+ uninstallButton = createVerticalButton(composite, ProvUIMessages.UpdateAndInstallGroup_Uninstall, false);
+ uninstallButton.setData(BUTTONACTION, new UninstallAction(ProvUIMessages.UpdateAndInstallGroup_Uninstall, installedIUViewer, null, profile, null, parent.getShell()));
+ updateButton = createVerticalButton(composite, ProvUIMessages.UpdateAndInstallGroup_Update, false);
+ updateButton.setData(BUTTONACTION, new UpdateAction(ProvUIMessages.UpdateAndInstallGroup_Update, installedIUViewer, null, profile, null, parent.getShell()));
+ if (repositoryManipulator != null) {
+ Button repoButton = createVerticalButton(composite, repositoryManipulator.getLabel(), false);
+ repoButton.setData(BUTTONACTION, new Action() {
+ public void runWithEvent(Event event) {
+ repositoryManipulator.manipulateRepositories(getControl().getShell());
+ }
+ });
+ }
+ if (profileChooser != null) {
+ Button profileButton = createVerticalButton(composite, profileChooser.getLabel(), false);
+ profileButton.setData(BUTTONACTION, new Action() {
+ public void runWithEvent(Event event) {
+ Profile chosenProfile = profileChooser.getProfile();
+ if (chosenProfile != null) {
+ profile = chosenProfile;
+ installedIUViewer.setInput(profile);
+ }
+ }
+ });
+ }
+
+ return composite;
+ }
+
+ void validateInstalledIUButtons(ISelection selection) {
+ installedPropButton.setEnabled(((IStructuredSelection) selection).size() == 1);
+ uninstallButton.setEnabled(!selection.isEmpty());
+ updateButton.setEnabled(!selection.isEmpty());
+ }
+
+ private Button createVerticalButton(Composite parent, String label, boolean defaultButton) {
+ Button button = new Button(parent, SWT.PUSH);
+ button.setText(label);
+
+ GridData data = setButtonLayoutData(button);
+ data.horizontalAlignment = GridData.FILL;
+
+ button.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event event) {
+ verticalButtonPressed(event);
+ }
+ });
+ button.setToolTipText(label);
+ if (defaultButton) {
+ Shell shell = parent.getShell();
+ if (shell != null) {
+ shell.setDefaultButton(button);
+ }
+ }
+ return button;
+ }
+
+ void verticalButtonPressed(Event event) {
+ Object data = event.widget.getData(BUTTONACTION);
+ if (data == null || !(data instanceof IAction)) {
+ return;
+ }
+ IAction action = (IAction) data;
+ action.runWithEvent(event);
+ }
+
+ private GridData setButtonLayoutData(Button button) {
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
+ Point minSize = button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
+ data.widthHint = Math.max(widthHint, minSize.x);
+ button.setLayoutData(data);
+ return data;
+ }
+
+ private int convertHorizontalDLUsToPixels(int dlus) {
+ // shouldn't happen
+ if (fm == null) {
+ return 0;
+ }
+ return Dialog.convertHorizontalDLUsToPixels(fm, dlus);
+ }
+
+ private int convertVerticalDLUsToPixels(int dlus) {
+ // shouldn't happen
+ if (fm == null) {
+ return 0;
+ }
+ return Dialog.convertVerticalDLUsToPixels(fm, dlus);
+ }
+
+ //TODO: callers should be able to configure the table columns as well as the label provider
+ private void setTableColumns(Table table) {
+ table.setHeaderVisible(true);
+ // don't externalize, these strings will go away soon enough
+ String[] columnHeaders = {"Name", "Version"};
+ for (int i = 0; i < columnHeaders.length; i++) {
+ TableColumn tc = new TableColumn(table, SWT.NONE, i);
+ tc.setResizable(true);
+ tc.setText(columnHeaders[i]);
+ tc.setWidth(convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH));
+ }
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/internal/ApplyProfileChangesDialog.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/internal/ApplyProfileChangesDialog.java
new file mode 100644
index 000000000..14f24df31
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/internal/ApplyProfileChangesDialog.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.internal;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * A dialog which prompts the user to restart.
+ *
+ * @since 3.4
+ */
+public class ApplyProfileChangesDialog extends MessageDialog {
+ public static final int PROFILE_IGNORE = 0;
+ public static final int PROFILE_APPLYCHANGES = 1;
+ public static final int PROFILE_RESTART = 2;
+ private final static String[] yesNo = new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL};
+ private final static String[] yesNoApply = new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, ProvUIMessages.ApplyProfileChangesDialog_ApplyChanges};
+
+ private int returnCode = PROFILE_IGNORE;
+
+ private ApplyProfileChangesDialog(Shell parent, String title, String message, boolean mustRestart) {
+ super(parent, title, null, // accept the default window icon
+ message, QUESTION, mustRestart ? yesNo : yesNoApply, 0); // yes is the default
+ }
+
+ /**
+ * Prompt the user for restart or apply profile changes.
+ *
+ * @param parent the parent shell of the dialog, or <code>null</code> if none
+ * @param mustRestart indicates whether the user must restart to get the
+ * changes. If <code>false</code>, then the user may choose to apply
+ * the changes to the running profile rather than restarting.
+ * @return one of PROFILE_IGNORE (do nothing), PROFILE_APPLYCHANGES
+ * (attempt to apply the changes), or PROFILE_RESTART (restart the system).
+ */
+ public static int promptForRestart(Shell parent, boolean mustRestart) {
+ String title = ProvUIMessages.PlatformUpdateTitle;
+ String message = ProvUIMessages.OptionalPlatformRestartMessage;
+ if (mustRestart) {
+ message = ProvUIMessages.PlatformRestartMessage;
+ }
+ ApplyProfileChangesDialog dialog = new ApplyProfileChangesDialog(parent, title, message, mustRestart);
+ if (dialog.open() == Window.CANCEL)
+ return PROFILE_IGNORE;
+ return dialog.returnCode;
+ }
+
+ /**
+ * When a button is pressed, store the return code.
+ *
+ * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
+ */
+ protected void buttonPressed(int id) {
+ if (id == 0) { // YES
+ returnCode = PROFILE_RESTART;
+ } else if (id == 1) { // NO
+ returnCode = PROFILE_IGNORE;
+ } else {
+ returnCode = PROFILE_APPLYCHANGES;
+ }
+
+ super.buttonPressed(id);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/internal/ProvUIMessages.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/internal/ProvUIMessages.java
new file mode 100644
index 000000000..d6de480cd
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/internal/ProvUIMessages.java
@@ -0,0 +1,128 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.prov.ui.internal;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Message class for provisioning UI messages.
+ *
+ * @since 3.4
+ */
+public class ProvUIMessages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.equinox.prov.ui.internal.messages"; //$NON-NLS-1$
+ static {
+ // load message values from bundle file
+ NLS.initializeMessages(BUNDLE_NAME, ProvUIMessages.class);
+ }
+
+ public static String AddColocatedRepositoryDialog_InvalidURL;
+ public static String ApplyProfileChangesDialog_ApplyChanges;
+ public static String ChooseProfileDialog_DefaultDialogTitle;
+ public static String ColocatedRepositoryManipulatorGroup_Add;
+ public static String ColocatedRepositoryManipulatorGroup_LocationColumnHeader;
+ public static String ColocatedRepositoryManipulatorGroup_NameColumnHeader;
+ public static String ColocatedRepositoryManipulatorGroup_Remove;
+ public static String InstallAction_EntryPointNameRequired;
+ public static String InstallAction_InstallConfirmTitle;
+ public static String InstallAction_InstallInfoTitle;
+ public static String InstallAction_InstallNotPermitted;
+ public static String InstallAction_NameEntryPointMessage;
+ public static String InstallOperation_CannotInstall;
+ public static String IUPropertiesGroup_CopyrightProperty;
+ public static String IUPropertiesGroup_DescriptionProperty;
+ public static String IUPropertiesGroup_LicenseProperty;
+ public static String IUPropertiesGroup_NameProperty;
+ public static String IUPropertiesGroup_ProviderProperty;
+ public static String ProfileGroup_Cache;
+ public static String ProfileGroup_SelectBundlePoolCache;
+ // utility error messages
+ public static String ProvisioningUtil_NoRepositoryManager;
+ public static String ProvisioningUtil_AddRepositoryFailure;
+ public static String ProvisioningUtil_RepoNotWritable;
+ public static String ProvisioningUtil_RepositoryNotFound;
+ public static String ProvisioningUtil_NoProfileRegistryFound;
+ public static String ProvisioningUtil_NoDirectorFound;
+ public static String ProvisioningUtil_NoOracleFound;
+ public static String ProvisioningUtil_NoIUFound;
+ public static String ProvisioningUtil_NoInstallRegistryFound;
+ public static String ProvisioningUtil_NoProfileInstallRegistryFound;
+ public static String ProvisioningUtil_RepositoriesSearched;
+
+ // viewer support
+ public static String ProvDropAdapter_InvalidDropTarget;
+ public static String ProvDropAdapter_NoIUsToDrop;
+ public static String ProvDropAdapter_UnsupportedDropOperation;
+
+ // Provisioning operations
+ public static String ProvisioningOperation_ExecuteErrorTitle;
+ public static String ProvisioningOperation_RedoErrorTitle;
+ public static String ProvisioningOperation_UndoErrorTitle;
+ public static String Ops_InstallIUOperationLabel;
+ public static String Ops_UninstallIUOperationLabel;
+ public static String Ops_UpdateIUOperationLabel;
+ public static String Ops_BecomeIUOperationLabel;
+
+ // Property pages
+ public static String ProfilePropertyPage_NoProfileSelected;
+ public static String IUPropertyPage_NoIUSelected;
+ public static String RepositoryGroup_NameColumnLabel;
+ public static String RepositoryGroup_PropertiesLabel;
+ public static String RepositoryGroup_ValueColumnLabel;
+ public static String RepositoryPropertyPage_NoRepoSelected;
+
+ // Dialog groups
+ public static String IUGroup_ID;
+ public static String IUGroup_IU_ID_Required;
+ public static String IUGroup_Namespace;
+ public static String IUGroup_ProvidedCapabilities;
+ public static String IUGroup_RequiredCapabilities;
+ public static String IUGroup_TouchpointData;
+ public static String IUGroup_TouchpointType;
+ public static String IUGroup_Version;
+ public static String RepositoryGroup_Browse;
+ public static String RepositoryGroup_RepositoryFile;
+ public static String RepositoryGroup_SelectRepositoryDirectory;
+ public static String RepositoryGroup_RepositoryNameFieldLabel;
+ public static String RepositoryGroup_URLRequired;
+ public static String RepositoryGroup_RepositoryURLFieldLabel;
+ public static String ProfileGroup_Browse;
+ public static String ProfileGroup_Environments;
+ public static String ProfileGroup_Flavor;
+ public static String ProfileGroup_ID;
+ public static String ProfileGroup_InstallFolder;
+ public static String ProfileGroup_Name;
+ public static String ProfileGroup_NL;
+ public static String ProfileGroup_SelectProfileMessage;
+ public static String ProfileGroup_Description;
+ public static String ProfileGroup_ProfileIDRequired;
+ public static String ProfileGroup_ProfileInstallFolderRequired;
+
+ // Dialogs
+ public static String AddRepositoryDialog_DuplicateURL;
+ public static String AddRepositoryDialog_Title;
+ public static String UpdateAction_UpdateInformationTitle;
+ public static String UpdateAction_UpdatesAvailableMessage;
+ public static String UpdateAction_UpdatesAvailableTitle;
+ public static String PlatformUpdateTitle;
+ public static String PlatformRestartMessage;
+ public static String OptionalPlatformRestartMessage;
+
+ // Operations
+ public static String UpdateAndInstallGroup_Install;
+ public static String UpdateAndInstallGroup_Properties;
+ public static String UpdateAndInstallGroup_Refresh;
+ public static String UpdateAndInstallGroup_Uninstall;
+ public static String UpdateAndInstallGroup_Update;
+ public static String UpdateOperation_NothingToUpdate;
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/internal/ProvisioningPropertyManager.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/internal/ProvisioningPropertyManager.java
new file mode 100644
index 000000000..e03700cd0
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/internal/ProvisioningPropertyManager.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.prov.ui.internal;
+
+import org.eclipse.core.runtime.ListenerList;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+
+/**
+ * ProvisioningPropertyManager can notify clients of changes to the properties
+ * of provisioning objects.
+ *
+ * @since 3.4
+ */
+
+// TODO This is a HACK class.
+// This class should go away and instead these kinds of events should be handled
+// by the provisioning event bus. See bug #197052 and #197701
+//
+// TODO Some of these aren't even truly property changes but rather just notification
+// that something happened. Since this class is (hoped to be) temporary, I did not
+// want to define new event types and just used what was already available.
+public class ProvisioningPropertyManager {
+
+ private ListenerList listeners = new ListenerList();
+
+ public void addPropertyChangeListener(IPropertyChangeListener listener) {
+ listeners.add(listener);
+ }
+
+ public void removePropertyChangeListener(IPropertyChangeListener listener) {
+ listeners.remove(listener);
+ }
+
+ public void notifyListeners(PropertyChangeEvent event) {
+ final Object[] listenerArray = listeners.getListeners();
+ for (int i = 0; i < listenerArray.length; i++) {
+ final IPropertyChangeListener listener = (IPropertyChangeListener) listenerArray[i];
+ listener.propertyChange(event);
+ }
+
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/internal/messages.properties b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/internal/messages.properties
new file mode 100644
index 000000000..80932b4a2
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/internal/messages.properties
@@ -0,0 +1,109 @@
+###############################################################################
+# Copyright (c) 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+
+ProvisioningUtil_NoRepositoryManager=No repository manager was found
+ProvisioningUtil_AddRepositoryFailure=Unable to add repository {0}
+ProvisioningUtil_RepositoryNotFound=Could not find repository {0}
+ProvisioningUtil_RepoNotWritable=Repository is not writable
+ProvisioningUtil_NoProfileRegistryFound=No profile registry was found
+ProvisioningUtil_NoDirectorFound=No director was found
+ProvisioningUtil_NoOracleFound=No oracle was found
+ProvisioningUtil_NoIUFound=Could not find installable unit {0}:{1}
+ProvisioningUtil_NoInstallRegistryFound=No install registry was found
+ProvisioningUtil_NoProfileInstallRegistryFound=No profile install registry was found
+ProvisioningUtil_RepositoriesSearched=The following repositories were searched:
+
+ProvisioningOperation_ExecuteErrorTitle=Error while executing the "{0}" operation
+ProvisioningOperation_RedoErrorTitle=Error while redoing the "{0}" operation
+ProvisioningOperation_UndoErrorTitle=Error while undoing the "{0}" operation
+Ops_InstallIUOperationLabel=Install
+Ops_UninstallIUOperationLabel=Uninstall
+Ops_UpdateIUOperationLabel=Update
+Ops_BecomeIUOperationLabel=Become
+
+ProvDropAdapter_NoIUsToDrop=No IUs were available to be dropped
+ProvDropAdapter_InvalidDropTarget=Invalid drop target
+ProvDropAdapter_UnsupportedDropOperation=Unsupported drop operation
+
+ProfilePropertyPage_NoProfileSelected=There was no profile selected
+IUPropertyPage_NoIUSelected=There was no IU selected
+IUPropertiesGroup_NameProperty=Name
+IUPropertiesGroup_ProviderProperty=Provider
+IUPropertiesGroup_LicenseProperty=License
+RepositoryPropertyPage_NoRepoSelected=There was no repository selected
+
+RepositoryGroup_RepositoryNameFieldLabel=Repository &name:
+RepositoryGroup_RepositoryURLFieldLabel=Repository &URL:
+RepositoryGroup_SelectRepositoryDirectory=Select a repository root directory:
+RepositoryGroup_Browse=Browse...
+RepositoryGroup_RepositoryFile=Repository file
+RepositoryGroup_PropertiesLabel=Repository properties:
+RepositoryGroup_NameColumnLabel=Name
+RepositoryGroup_ValueColumnLabel=Value
+RepositoryGroup_URLRequired=Must specify a URL
+ProfileGroup_ID=Profile &id:
+ProfileGroup_Browse=&Browse...
+ProfileGroup_SelectProfileMessage=Select a profile installation directory:
+ProfileGroup_SelectBundlePoolCache=Select a bundle pool directory:
+ProfileGroup_Name=&Name:
+ProfileGroup_Description=&Description:
+ProfileGroup_Flavor=&Flavor:
+ProfileGroup_Cache=Bundle &pool location:
+ProfileGroup_NL=N&L
+ProfileGroup_InstallFolder=Install &folder:
+ProfileGroup_Environments=&Environments:
+ProfileGroup_ProfileIDRequired=Must specify a Profile ID
+ProfileGroup_ProfileInstallFolderRequired=Must specify an install folder
+IUGroup_ID=IU &id:
+IUGroup_Version=&Version:
+IUGroup_Namespace=&Namespace:
+IUGroup_TouchpointType=&Touchpoint type:
+IUGroup_TouchpointData=Touchpoint &data:
+IUGroup_RequiredCapabilities=&Required capabilities:
+IUGroup_ProvidedCapabilities=&Provided capabilities:
+IUGroup_IU_ID_Required=Must set an IU ID
+
+AddRepositoryDialog_Title=Add Repository
+AddRepositoryDialog_DuplicateURL=Duplicate URL
+
+
+UpdateAndInstallGroup_Properties=Properties...
+UpdateAction_UpdateInformationTitle=Update Information
+UpdateAction_UpdatesAvailableMessage=Updates are available for the following items. Select the items you wish to update.
+UpdateAction_UpdatesAvailableTitle=Available Updates
+UpdateAndInstallGroup_Uninstall=Uninstall...
+UpdateOperation_NothingToUpdate=There is nothing to update.
+UpdateAndInstallGroup_Install=Install...
+UpdateAndInstallGroup_Refresh=Refresh
+UpdateAndInstallGroup_Update=Check for updates...
+ChooseProfileDialog_DefaultDialogTitle=Select a profile
+InstallOperation_CannotInstall=The specified IU's cannot be installed.
+InstallAction_InstallInfoTitle=Install Information
+InstallAction_InstallNotPermitted=The install is not valid for the current configuration. (And I can't explain further given the current API).
+InstallAction_InstallConfirmTitle=Confirm Install
+InstallAction_NameEntryPointMessage=Enter a name for the installed software.
+InstallAction_EntryPointNameRequired=A name must be supplied.
+AddColocatedRepositoryDialog_InvalidURL=The URL is not valid.
+ColocatedRepositoryManipulatorGroup_Add=Add...
+ColocatedRepositoryManipulatorGroup_Remove=Remove
+ColocatedRepositoryManipulatorGroup_NameColumnHeader=Name
+ColocatedRepositoryManipulatorGroup_LocationColumnHeader=Location
+IUPropertiesGroup_DescriptionProperty=Description
+IUPropertiesGroup_CopyrightProperty=Copyright
+
+PlatformUpdateTitle = Software Updates
+PlatformRestartMessage = You will need to restart the system for the changes to take effect. \
+Would you like to restart now?
+
+OptionalPlatformRestartMessage = It is recommended you restart the system for the changes to take effect, \
+but it may be possible to apply the changes you have made without restarting. \
+Would you like to restart now?
+ApplyProfileChangesDialog_ApplyChanges=Apply Changes
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/model/AllArtifactRepositories.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/model/AllArtifactRepositories.java
new file mode 100644
index 000000000..2d45e86e7
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/model/AllArtifactRepositories.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.model;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.equinox.prov.artifact.repository.IArtifactRepository;
+import org.eclipse.equinox.prov.core.ProvisionException;
+import org.eclipse.equinox.prov.ui.ProvisioningUtil;
+
+/**
+ * Element class that represents the root of an artifact
+ * repository viewer. Its children are all of the known
+ * artifact repositories.
+ *
+ * @since 3.4
+ *
+ */
+public class AllArtifactRepositories extends ProvElement {
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.equinox.prov.ui.model.ProvElement#fetchChildren(java.lang.Object, org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+ */
+ protected Object[] fetchChildren(Object o, IProgressMonitor monitor, IAdaptable uiInfo) {
+ try {
+ return ProvisioningUtil.getArtifactRepositories(monitor, uiInfo);
+ } catch (ProvisionException e) {
+ handleException(e, null);
+ }
+ return new IArtifactRepository[0];
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.model.IWorkbenchAdapter#getLabel(java.lang.Object)
+ */
+ public String getLabel(Object o) {
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.equinox.prov.ui.model.RepositoryElement#getParent(java.lang.Object)
+ */
+ public Object getParent(Object o) {
+ return null;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/model/AllMetadataRepositories.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/model/AllMetadataRepositories.java
new file mode 100644
index 000000000..7b0b9ff0a
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/model/AllMetadataRepositories.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.model;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.equinox.prov.core.ProvisionException;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepository;
+import org.eclipse.equinox.prov.ui.ProvisioningUtil;
+
+/**
+ * Element class that represents the root of a metadata
+ * repository viewer. Its children are all of the known
+ * metadata repositories.
+ *
+ * @since 3.4
+ *
+ */
+public class AllMetadataRepositories extends ProvElement {
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.equinox.prov.ui.model.ProvElement#fetchChildren(java.lang.Object, org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+ */
+ protected Object[] fetchChildren(Object o, IProgressMonitor monitor, IAdaptable uiInfo) {
+ try {
+ return ProvisioningUtil.getMetadataRepositories(monitor, uiInfo);
+ } catch (ProvisionException e) {
+ handleException(e, null);
+ }
+ return new IMetadataRepository[0];
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.model.IWorkbenchAdapter#getLabel(java.lang.Object)
+ */
+ public String getLabel(Object o) {
+ return ""; //$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.equinox.prov.ui.model.RepositoryElement#getParent(java.lang.Object)
+ */
+ public Object getParent(Object o) {
+ return null;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/model/AllProfiles.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/model/AllProfiles.java
new file mode 100644
index 000000000..2c56152de
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/model/AllProfiles.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.model;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.equinox.prov.core.ProvisionException;
+import org.eclipse.equinox.prov.ui.ProvisioningUtil;
+
+/**
+ * Element class that represents the root of a profile
+ * viewer. Its children are all installed profiles.
+ *
+ * @since 3.4
+ *
+ */
+public class AllProfiles extends ProvElement {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.equinox.prov.ui.model.ProvElement#fetchChildren(java.lang.Object,
+ * org.eclipse.core.runtime.IProgressMonitor,
+ * org.eclipse.core.runtime.IAdaptable)
+ */
+ protected Object[] fetchChildren(Object o, IProgressMonitor monitor, IAdaptable uiInfo) {
+ try {
+ return ProvisioningUtil.getProfiles(monitor, uiInfo);
+ } catch (ProvisionException e) {
+ handleException(e, null);
+ }
+ return new Object[0];
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.model.IWorkbenchAdapter#getLabel(java.lang.Object)
+ */
+ public String getLabel(Object o) {
+ return ""; //$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.equinox.prov.ui.model.RepositoryElement#getParent(java.lang.Object)
+ */
+ public Object getParent(Object o) {
+ return null;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/model/ArtifactRepositoryContentProvider.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/model/ArtifactRepositoryContentProvider.java
new file mode 100644
index 000000000..dba38814c
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/model/ArtifactRepositoryContentProvider.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.prov.ui.model;
+
+import org.eclipse.equinox.prov.artifact.repository.IArtifactRepository;
+import org.eclipse.jface.viewers.*;
+
+/**
+ * Content provider for artifact repository viewers.
+ * The repositories themselves are the elements. The
+ * artifact keys are the children of the artifact
+ * repositories.
+ *
+ * @since 3.4
+ */
+public class ArtifactRepositoryContentProvider implements IStructuredContentProvider, ITreeContentProvider {
+
+ public void inputChanged(Viewer v, Object oldInput, Object newInput) {
+ // input does not affect the content
+ }
+
+ public void dispose() {
+ // nothing to do
+ }
+
+ public Object[] getElements(Object input) {
+ if (input == null) {
+ return getChildren(new AllArtifactRepositories());
+ }
+ return getChildren(input);
+ }
+
+ public Object getParent(Object child) {
+ return null;
+ }
+
+ public Object[] getChildren(Object parent) {
+ if (parent instanceof AllArtifactRepositories) {
+ return ((AllArtifactRepositories) parent).getChildren(parent);
+ }
+ if (parent instanceof IArtifactRepository) {
+ return ((IArtifactRepository) parent).getArtifactKeys();
+ }
+ return new Object[0];
+ }
+
+ public boolean hasChildren(Object parent) {
+ if (parent instanceof AllArtifactRepositories)
+ return ((AllArtifactRepositories) parent).hasChildren(parent);
+ if (parent instanceof IArtifactRepository) {
+ return ((IArtifactRepository) parent).getArtifactKeys().length > 0;
+ }
+ return false;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/model/AvailableIUContentProvider.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/model/AvailableIUContentProvider.java
new file mode 100644
index 000000000..8ae7b8c94
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/model/AvailableIUContentProvider.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.prov.ui.model;
+
+import java.util.ArrayList;
+
+import org.eclipse.equinox.prov.core.repository.IRepositoryInfo;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepository;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+/**
+ * Content provider for profile views. The children are the known profiles, and
+ * the children of profiles are wrapped IU's (wrapped in InstalledIUElement).
+ * They are wrapped so that the association with the parent profile is retained.
+ *
+ * @since 3.4
+ */
+public class AvailableIUContentProvider implements IStructuredContentProvider {
+
+ public void inputChanged(Viewer v, Object oldInput, Object newInput) {
+ // we don't hook listeners or anything on the input, so there is
+ // nothing to do.
+ }
+
+ public void dispose() {
+ // nothing to do
+ }
+
+ public Object[] getElements(Object input) {
+ // If there is no input specified, assume we are looking at all
+ // metadata repositories.
+ if (input == null) {
+ return getElements(new AllMetadataRepositories());
+ }
+ IMetadataRepository[] reposToCheck = new IMetadataRepository[0];
+ if (input instanceof IMetadataRepository[]) {
+ reposToCheck = (IMetadataRepository[]) input;
+ } else if (input instanceof AllMetadataRepositories) {
+ reposToCheck = (IMetadataRepository[]) ((AllMetadataRepositories) input).getChildren(null);
+ }
+ ArrayList list = new ArrayList();
+ for (int i = 0; i < reposToCheck.length; i++) {
+ // TODO maybe this should be configurable, but for now assume we never
+ // want to see content from implementation repositories.
+ if (!(Boolean.valueOf(reposToCheck[i].getProperties().getProperty(IRepositoryInfo.IMPLEMENTATION_ONLY_KEY, "false"))).booleanValue()) { //$NON-NLS-1$
+ IInstallableUnit[] ius = reposToCheck[i].getInstallableUnits(null);
+ for (int j = 0; j < ius.length; j++) {
+ list.add(ius[j]);
+ }
+ }
+ }
+ return list.toArray();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/model/InstalledIUElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/model/InstalledIUElement.java
new file mode 100644
index 000000000..25224df6f
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/model/InstalledIUElement.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.model;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.metadata.InstallableUnit;
+import org.eclipse.equinox.prov.ui.ProvUIImages;
+
+/**
+ * Element wrapper class for installed IU's. Used instead of the plain IU when
+ * there should be a parent profile available for operations.
+ *
+ * @since 3.4
+ */
+public class InstalledIUElement extends ProvElement {
+
+ Profile parent;
+ IInstallableUnit iu;
+
+ public InstalledIUElement(Profile parent, IInstallableUnit iu) {
+ this.parent = parent;
+ this.iu = iu;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.equinox.prov.ui.model.ProvElement#getImageID(java.lang.Object)
+ */
+ protected String getImageID(Object obj) {
+ return ProvUIImages.IMG_IU;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.model.IWorkbenchAdapter#getParent(java.lang.Object)
+ */
+ public Object getParent(Object o) {
+ return parent;
+ }
+
+ public String getLabel(Object o) {
+ return iu.getId();
+ }
+
+ protected Object[] fetchChildren(Object o, IProgressMonitor monitor, IAdaptable uiInfo) {
+ return null;
+ }
+
+ public Object getAdapter(Class adapter) {
+ if (adapter == IInstallableUnit.class)
+ return iu;
+ if (adapter == InstallableUnit.class && iu instanceof InstallableUnit)
+ return iu;
+ return super.getAdapter(adapter);
+ }
+
+ public Profile getProfile() {
+ return parent;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/model/MetadataRepositoryContentProvider.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/model/MetadataRepositoryContentProvider.java
new file mode 100644
index 000000000..33412aeed
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/model/MetadataRepositoryContentProvider.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.prov.ui.model;
+
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepository;
+import org.eclipse.jface.viewers.*;
+
+/**
+ * Content provider for metadata repositories. The raw repositories are the
+ * elements, and the raw IU's are the children of the repositories.
+ *
+ * @since 3.4
+ *
+ */
+public class MetadataRepositoryContentProvider implements IStructuredContentProvider, ITreeContentProvider {
+
+ public void inputChanged(Viewer v, Object oldInput, Object newInput) {
+ // input does not affect the content
+ }
+
+ public void dispose() {
+ // nothing to do
+ }
+
+ public Object[] getElements(Object input) {
+ if (input == null)
+ return getChildren(new AllMetadataRepositories());
+ return getChildren(input);
+ }
+
+ public Object getParent(Object child) {
+ if (child instanceof ProvElement) {
+ return ((ProvElement) child).getParent(child);
+ }
+ return null;
+ }
+
+ public Object[] getChildren(Object parent) {
+ if (parent instanceof AllMetadataRepositories) {
+ return ((AllMetadataRepositories) parent).getChildren(parent);
+ }
+ if (parent instanceof IMetadataRepository) {
+ return ((IMetadataRepository) parent).getInstallableUnits(null);
+ }
+ return new Object[0];
+ }
+
+ public boolean hasChildren(Object parent) {
+ if (parent instanceof AllMetadataRepositories) {
+ return ((AllMetadataRepositories) parent).hasChildren(parent);
+ }
+ if (parent instanceof IMetadataRepository) {
+ return ((IMetadataRepository) parent).getInstallableUnits(null).length > 0;
+ }
+ return false;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/model/ProfileContentProvider.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/model/ProfileContentProvider.java
new file mode 100644
index 000000000..10aaf8aaf
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/model/ProfileContentProvider.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.prov.ui.model;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.jface.viewers.*;
+
+/**
+ * Content provider for profile views. The children are the known profiles, and
+ * the children of profiles are wrapped IU's (wrapped in InstalledIUElement).
+ * They are wrapped so that the association with the parent profile is retained.
+ *
+ * @since 3.4
+ */
+public class ProfileContentProvider implements IStructuredContentProvider, ITreeContentProvider {
+
+ public void inputChanged(Viewer v, Object oldInput, Object newInput) {
+ // we don't hook listeners or anything on the input, so there is
+ // nothing to do.
+ }
+
+ public void dispose() {
+ // nothing to do
+ }
+
+ public Object[] getElements(Object input) {
+ // If there is no input specified, assume we are looking at all profiles.
+ if (input == null) {
+ return getChildren(new AllProfiles());
+ }
+ return getChildren(input);
+ }
+
+ public Object getParent(Object child) {
+ return null;
+ }
+
+ public Object[] getChildren(Object parent) {
+ if (parent instanceof AllProfiles) {
+ return ((AllProfiles) parent).getChildren(parent);
+ }
+ if (parent instanceof Profile) {
+ // We wrap installed IU's in elements so that they know their
+ // "parent profile" in a particular UI view.
+ Iterator allIUs = ((Profile) parent).getInstallableUnits();
+ ArrayList list = new ArrayList();
+ while (allIUs.hasNext()) {
+ list.add(new InstalledIUElement((Profile) parent, (IInstallableUnit) allIUs.next()));
+ }
+ return list.toArray(new Object[list.size()]);
+ }
+ return new Object[0];
+ }
+
+ public boolean hasChildren(Object parent) {
+ if (parent instanceof AllProfiles) {
+ return ((ProvElement) parent).hasChildren(parent);
+ }
+ if (parent instanceof Profile) {
+ Iterator allIUs = ((Profile) parent).getInstallableUnits();
+ return allIUs.hasNext();
+
+ }
+ return false;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/model/ProfileFactory.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/model/ProfileFactory.java
new file mode 100644
index 000000000..b1edb454e
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/model/ProfileFactory.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.model;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.equinox.prov.core.ProvisionException;
+import org.eclipse.equinox.prov.core.helpers.ServiceHelper;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.ui.ProvUIActivator;
+import org.eclipse.equinox.prov.ui.ProvisioningUtil;
+import org.eclipse.osgi.service.environment.EnvironmentInfo;
+
+/**
+ * Factory class that can create a new profile with the correct
+ * default values.
+ *
+ * @since 3.4
+ *
+ */
+public class ProfileFactory {
+
+ static private String FLAVOR_DEFAULT = "tooling"; //$NON-NLS-1$
+ static private String EMPTY = ""; //$NON-NLS-1$
+ static private EnvironmentInfo info;
+
+ public static Profile makeProfile(String profileID) {
+ Profile profile = new Profile(profileID);
+ profile.setValue(Profile.PROP_INSTALL_FOLDER, getDefaultLocation());
+ profile.setValue(Profile.PROP_FLAVOR, getDefaultFlavor());
+ profile.setValue(Profile.PROP_ENVIRONMENTS, getDefaultEnvironments());
+ profile.setValue(Profile.PROP_NL, getDefaultNL());
+ try {
+ ProvisioningUtil.addProfile(profile, null, null);
+ } catch (ProvisionException e) {
+ return null;
+ }
+ return profile;
+ }
+
+ public static String getDefaultLocation() {
+ return Platform.getUserLocation().getURL().getPath();
+ }
+
+ public static String getDefaultFlavor() {
+ return FLAVOR_DEFAULT;
+ }
+
+ private static EnvironmentInfo getEnvironmentInfo() {
+ if (info == null) {
+ info = (EnvironmentInfo) ServiceHelper.getService(ProvUIActivator.getContext(), EnvironmentInfo.class.getName());
+ }
+ return info;
+ }
+
+ public static String getDefaultNL() {
+ if (getEnvironmentInfo() != null) {
+ return info.getNL();
+ }
+ return EMPTY;
+ }
+
+ public static String getDefaultEnvironments() {
+ if (getEnvironmentInfo() != null) {
+ return "osgi.os=" //$NON-NLS-1$
+ + info.getOS() + ",osgi.ws=" + info.getWS() //$NON-NLS-1$
+ + ",osgi.arch=" + info.getOSArch(); //$NON-NLS-1$
+ }
+ return EMPTY;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/model/ProvElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/model/ProvElement.java
new file mode 100644
index 000000000..5d9c450dc
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/model/ProvElement.java
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.model;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.prov.ui.ProvUIActivator;
+import org.eclipse.equinox.prov.ui.ProvUIImages;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.model.IWorkbenchAdapter;
+import org.eclipse.ui.progress.IDeferredWorkbenchAdapter;
+import org.eclipse.ui.statushandlers.StatusManager;
+
+/**
+ * Generic element that represents a provisioning element in
+ * a viewer.
+ *
+ * @since 3.4
+ *
+ */
+public abstract class ProvElement implements IWorkbenchAdapter, IAdaptable {
+
+ public Object getAdapter(Class adapter) {
+ if (adapter == IWorkbenchAdapter.class)
+ return this;
+ if ((adapter == IDeferredWorkbenchAdapter.class) && this instanceof IDeferredWorkbenchAdapter)
+ return this;
+ return null;
+ }
+
+ public Object[] getChildren(Object o) {
+ return fetchChildren(o, null, null);
+ }
+
+ // TODO if there is no optimization for subclasses, get rid of this
+ public boolean hasChildren(Object o) {
+ Object[] children = getChildren(o);
+ if (children == null) {
+ return false;
+ }
+ return children.length > 0;
+ }
+
+ abstract protected Object[] fetchChildren(Object o, IProgressMonitor monitor, IAdaptable uiInfo);
+
+ /**
+ * Return a string id of the image that should be used to show the specified
+ * object. Returning null indicates that no image should be used.
+ *
+ * @param obj
+ * the object whose image id is requested
+ * @return the string id of the image in the provisioning image registry, or
+ * <code>null</code> if no image should be shown.
+ */
+ protected String getImageID(Object obj) {
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.model.IWorkbenchAdapter#getImageDescriptor(java.lang.Object)
+ */
+ public ImageDescriptor getImageDescriptor(Object object) {
+ String id = getImageID(object);
+ if (id == null) {
+ return null;
+ }
+ return ProvUIImages.getImageDescriptor(id);
+ }
+
+ /**
+ * Return the image that should be used to show the specfied object. The
+ * image is managed by an image registry and should not be freed.
+ *
+ * @param object
+ * the object whose image id is requested
+ * @return the string id of the image in the provisioning image registry
+ *
+ */
+ public Image getImage(Object object) {
+ String id = getImageID(object);
+ if (id == null) {
+ return null;
+ }
+ return ProvUIImages.getImage(id);
+ }
+
+ protected void handleException(Exception e, String message) {
+ if (message == null) {
+ message = e.getMessage();
+ }
+ IStatus status = new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, 0, message, e);
+ StatusManager.getManager().handle(status, StatusManager.LOG);
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/AddArtifactRepositoryOperation.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/AddArtifactRepositoryOperation.java
new file mode 100644
index 000000000..b2124b1a1
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/AddArtifactRepositoryOperation.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.operations;
+
+import java.net.URL;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.prov.artifact.repository.IArtifactRepository;
+import org.eclipse.equinox.prov.core.ProvisionException;
+import org.eclipse.equinox.prov.ui.ProvisioningUtil;
+
+/**
+ * Operation which adds an artifact repository given its URL.
+ *
+ * @since 3.4
+ */
+public class AddArtifactRepositoryOperation extends RepositoryOperation {
+
+ boolean added = false;
+
+ public AddArtifactRepositoryOperation(String label, URL url, String name) {
+ super(label, new URL[] {url}, new String[] {name});
+ }
+
+ protected IStatus doExecute(IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException {
+ for (int i = 0; i < urls.length; i++) {
+ IArtifactRepository repo = ProvisioningUtil.addArtifactRepository(urls[i], monitor, uiInfo);
+ if (repo == null) {
+ return failureStatus();
+ }
+ if (names[i] != null) {
+ ProvisioningUtil.setRepositoryName(repo, names[i]);
+ }
+ }
+ added = true;
+ return okStatus();
+ }
+
+ protected IStatus doUndo(IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException {
+ for (int i = 0; i < urls.length; i++) {
+ ProvisioningUtil.removeArtifactRepository(urls[i], monitor, uiInfo);
+ }
+ // assume the best if no exception is thrown;
+ added = false;
+ return okStatus();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.commands.operations.AbstractOperation#canExecute()
+ */
+ public boolean canExecute() {
+ return super.canExecute() && !added;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.commands.operations.AbstractOperation#canUndo()
+ */
+ public boolean canUndo() {
+ return super.canUndo() && added;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/AddColocatedRepositoryOperation.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/AddColocatedRepositoryOperation.java
new file mode 100644
index 000000000..796aed5db
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/AddColocatedRepositoryOperation.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.operations;
+
+import java.net.URL;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.prov.core.ProvisionException;
+import org.eclipse.equinox.prov.core.repository.IRepositoryInfo;
+import org.eclipse.equinox.prov.ui.ColocatedRepositoryUtil;
+import org.eclipse.equinox.prov.ui.ProvisioningUtil;
+
+/**
+ * Operation that adds colocated artifact and metadata repositories
+ * given a URL.
+ *
+ * @since 3.4
+ */
+public class AddColocatedRepositoryOperation extends RepositoryOperation {
+
+ boolean added = false;
+
+ public AddColocatedRepositoryOperation(String label, URL url, String name) {
+ super(label, new URL[] {url}, new String[] {name});
+ }
+
+ protected IStatus doExecute(IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException {
+ for (int i = 0; i < urls.length; i++) {
+ URL metadataRepoURL = ColocatedRepositoryUtil.makeMetadataRepositoryURL(urls[i]);
+ IRepositoryInfo repo = ProvisioningUtil.addMetadataRepository(metadataRepoURL, monitor, uiInfo);
+ if (repo == null) {
+ return failureStatus();
+ }
+ if (names[i] != null) {
+ ProvisioningUtil.setRepositoryName(repo, names[i]);
+ }
+ repo = ProvisioningUtil.addArtifactRepository(ColocatedRepositoryUtil.makeArtifactRepositoryURL(urls[i]), monitor, uiInfo);
+ if (repo == null) {
+ // remove the metadata repo we just added
+ ProvisioningUtil.removeMetadataRepository(metadataRepoURL, monitor, uiInfo);
+ return failureStatus();
+ }
+ }
+ added = true;
+ return okStatus();
+ }
+
+ protected IStatus doUndo(IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException {
+ for (int i = 0; i < urls.length; i++) {
+ ProvisioningUtil.removeMetadataRepository(ColocatedRepositoryUtil.makeMetadataRepositoryURL(urls[i]), monitor, uiInfo);
+ ProvisioningUtil.removeArtifactRepository(ColocatedRepositoryUtil.makeArtifactRepositoryURL(urls[i]), monitor, uiInfo);
+ }
+ added = false;
+ return okStatus();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.commands.operations.AbstractOperation#canExecute()
+ */
+ public boolean canExecute() {
+ return super.canExecute() && !added;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.commands.operations.AbstractOperation#canUndo()
+ */
+ public boolean canUndo() {
+ return super.canUndo() && added;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/AddMetadataRepositoryOperation.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/AddMetadataRepositoryOperation.java
new file mode 100644
index 000000000..51ee6cc6a
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/AddMetadataRepositoryOperation.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.operations;
+
+import java.net.URL;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.prov.core.ProvisionException;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepository;
+import org.eclipse.equinox.prov.ui.ProvisioningUtil;
+
+/**
+ * Operation that adds a metadata repository given its URL.
+ *
+ * @since 3.4
+ */
+public class AddMetadataRepositoryOperation extends RepositoryOperation {
+
+ boolean added = false;
+
+ public AddMetadataRepositoryOperation(String label, URL url, String name) {
+ super(label, new URL[] {url}, new String[] {name});
+ }
+
+ protected IStatus doExecute(IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException {
+ for (int i = 0; i < urls.length; i++) {
+ IMetadataRepository repo = ProvisioningUtil.addMetadataRepository(urls[i], monitor, uiInfo);
+ if (repo == null) {
+ return failureStatus();
+ }
+ if (names[i] != null) {
+ ProvisioningUtil.setRepositoryName(repo, names[i]);
+ }
+ }
+ added = true;
+ return okStatus();
+ }
+
+ protected IStatus doUndo(IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException {
+ for (int i = 0; i < urls.length; i++) {
+ ProvisioningUtil.removeMetadataRepository(urls[i], monitor, uiInfo);
+ }
+ added = false;
+ return okStatus();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.commands.operations.AbstractOperation#canExecute()
+ */
+ public boolean canExecute() {
+ return super.canExecute() && !added;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.commands.operations.AbstractOperation#canUndo()
+ */
+ public boolean canUndo() {
+ return super.canUndo() && added;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/AddProfileOperation.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/AddProfileOperation.java
new file mode 100644
index 000000000..09e7a2319
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/AddProfileOperation.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.operations;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.prov.core.ProvisionException;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.ui.ProvisioningUtil;
+
+/**
+ * Operation that adds the given profile to the profile registry.
+ *
+ * @since 3.4
+ */
+public class AddProfileOperation extends ProfileOperation {
+ private boolean added = false;
+
+ public AddProfileOperation(String label, Profile profile) {
+ super(label, new Profile[] {profile});
+ }
+
+ protected IStatus doExecute(IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException {
+ ProvisioningUtil.addProfile(getProfiles()[0], monitor, uiInfo);
+ added = true;
+ return okStatus();
+ }
+
+ protected IStatus doUndo(IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException {
+ ProvisioningUtil.removeProfile(profileIds[0], monitor, uiInfo);
+ added = false;
+ return okStatus();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.commands.operations.AbstractOperation#canExecute()
+ */
+ public boolean canExecute() {
+ return super.canExecute() && !added;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.commands.operations.AbstractOperation#canUndo()
+ */
+ public boolean canUndo() {
+ return super.canUndo() && added;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/BecomeOperation.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/BecomeOperation.java
new file mode 100644
index 000000000..8616cffca
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/BecomeOperation.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.operations;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.prov.core.ProvisionException;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.ui.ProvisioningUtil;
+
+/**
+ * An operation that installs the specified IU's into the specified profile
+ *
+ * @since 3.4
+ */
+public class BecomeOperation extends ProfileModificationOperation {
+
+ private boolean installed = false;
+
+ public BecomeOperation(String label, String profileID, IInstallableUnit toBecome) {
+ super(label, profileID, new IInstallableUnit[] {toBecome}, null);
+ }
+
+ protected IStatus doExecute(IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException {
+ IStatus status = ProvisioningUtil.become(ius[0], getProfiles()[0], monitor);
+ if (status.isOK()) {
+ installed = true;
+ }
+ return status;
+ }
+
+ // TODO We need to see what this means in the light of engine rollback
+ protected IStatus doUndo(IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException {
+ return Status.OK_STATUS;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.commands.operations.AbstractOperation#canExecute()
+ */
+ public boolean canExecute() {
+ return isValid() && !installed;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.commands.operations.AbstractOperation#canUndo()
+ */
+ public boolean canUndo() {
+ return isValid() && installed;
+ }
+
+ /*
+ * (non-Javadoc)
+ * Overridden to use the Oracle to compute the validity of an install.
+ * @see org.eclipse.equinox.prov.ui.operations.ProvisioningOperation#computeExecutionStatus(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public IStatus computeExecutionStatus(IProgressMonitor monitor) {
+ //TODO Need to do the proper thing here
+ return Status.OK_STATUS;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/IOperationConfirmer.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/IOperationConfirmer.java
new file mode 100644
index 000000000..489e2e545
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/IOperationConfirmer.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.operations;
+
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * Interface for confirming provisioning operations
+ *
+ * @since 3.4
+ */
+
+public interface IOperationConfirmer {
+ /**
+ * Return a boolean indicating whether the operation should continue.
+ *
+ * @param op
+ * the operation to be performed.
+ * @param shell
+ * the shell that should be used for prompting
+ * @return a boolean indicating whether the operation should be performed.
+ */
+ public boolean continuePerformingOperation(ProvisioningOperation op, Shell shell);
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/InstallOperation.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/InstallOperation.java
new file mode 100644
index 000000000..2381687e3
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/InstallOperation.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.operations;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.prov.core.ProvisionException;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.ui.ProvUIActivator;
+import org.eclipse.equinox.prov.ui.ProvisioningUtil;
+import org.eclipse.equinox.prov.ui.internal.ProvUIMessages;
+
+/**
+ * An operation that installs the specified IU's into the specified profile
+ *
+ * @since 3.4
+ */
+public class InstallOperation extends ProfileModificationOperation {
+
+ private boolean installed = false;
+
+ public InstallOperation(String label, String profileID, IInstallableUnit[] ius, String entryPointName) {
+ super(label, profileID, ius, entryPointName);
+ }
+
+ protected IStatus doExecute(IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException {
+ IStatus status = ProvisioningUtil.install(ius, entryPointName, getProfiles()[0], monitor, uiInfo);
+ if (status.isOK()) {
+ installed = true;
+ }
+ return status;
+ }
+
+ // TODO undo is more likely a rollback than an uninstall? Need to clarify
+ protected IStatus doUndo(IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException {
+ IStatus status = ProvisioningUtil.uninstall(ius, getProfiles()[0], monitor, uiInfo);
+ if (status.isOK()) {
+ installed = false;
+ }
+ return status;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.commands.operations.AbstractOperation#canExecute()
+ */
+ public boolean canExecute() {
+ return isValid() && !installed;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.commands.operations.AbstractOperation#canUndo()
+ */
+ public boolean canUndo() {
+ return isValid() && installed;
+ }
+
+ /*
+ * (non-Javadoc)
+ * Overridden to use the Oracle to compute the validity of an install.
+ * @see org.eclipse.equinox.prov.ui.operations.ProvisioningOperation#computeExecutionStatus(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public IStatus computeExecutionStatus(IProgressMonitor monitor) {
+ try {
+ if (ProvisioningUtil.canInstall(ius, getProfile(), monitor, null))
+ return okStatus();
+ return new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, ProvUIMessages.InstallOperation_CannotInstall, null);
+ } catch (ProvisionException e) {
+ return new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, e.getLocalizedMessage(), e);
+ }
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/ProfileModificationOperation.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/ProfileModificationOperation.java
new file mode 100644
index 000000000..0a1f6f123
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/ProfileModificationOperation.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.operations;
+
+import org.eclipse.equinox.prov.core.ProvisionException;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+
+/**
+ * Abstract class representing provisioning profile operations
+ *
+ * @since 3.4
+ */
+public abstract class ProfileModificationOperation extends ProfileOperation {
+
+ IInstallableUnit[] ius;
+ String entryPointName;
+
+ ProfileModificationOperation(String label, String id, IInstallableUnit[] ius, String entryPointName) {
+ super(label, new String[] {id});
+ this.entryPointName = entryPointName;
+ this.ius = ius;
+ }
+
+ ProfileModificationOperation(String label, String id, IInstallableUnit[] ius) {
+ this(label, id, ius, null);
+ }
+
+ boolean isValid() {
+ return super.isValid() && ius != null && ius.length > 0;
+ }
+
+ public String getProfileId() {
+ try {
+ return super.getProfiles()[0].getProfileId();
+ } catch (ProvisionException e) {
+ return null;
+ }
+ }
+
+ public Profile getProfile() {
+ try {
+ return super.getProfiles()[0];
+ } catch (ProvisionException e) {
+ return null;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.equinox.prov.ui.operations.ProvisioningOperation#getAffectedObjects()
+ */
+ public Object[] getAffectedObjects() {
+ if (ius != null)
+ return ius;
+ return super.getAffectedObjects();
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/ProfileOperation.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/ProfileOperation.java
new file mode 100644
index 000000000..7dc897889
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/ProfileOperation.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.operations;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.equinox.prov.core.ProvisionException;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.ui.ProvisioningUtil;
+
+/**
+ * Abstract class representing provisioning profile operations
+ *
+ * @since 3.4
+ */
+public abstract class ProfileOperation extends ProvisioningOperation {
+
+ String[] profileIds;
+ Profile[] cachedProfiles;
+
+ ProfileOperation(String label, String[] ids) {
+ super(label);
+ profileIds = ids;
+ }
+
+ ProfileOperation(String label, Profile[] profiles) {
+ super(label);
+ Assert.isNotNull(profiles);
+ cachedProfiles = profiles;
+ profileIds = new String[profiles.length];
+ for (int i = 0; i < profiles.length; i++) {
+ profileIds[i] = profiles[i].getProfileId();
+ }
+ }
+
+ boolean isValid() {
+ return profileIds != null && profileIds.length > 0;
+ }
+
+ Profile[] getProfiles() throws ProvisionException {
+ if (profileIds == null) {
+ return null;
+ }
+ if (cachedProfiles == null) {
+ cachedProfiles = new Profile[profileIds.length];
+ for (int i = 0; i < profileIds.length; i++) {
+ cachedProfiles[i] = ProvisioningUtil.getProfile(profileIds[i]);
+ }
+ }
+ return cachedProfiles;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/ProvisioningOperation.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/ProvisioningOperation.java
new file mode 100644
index 000000000..05749a617
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/ProvisioningOperation.java
@@ -0,0 +1,194 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.operations;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.prov.core.ProvisionException;
+import org.eclipse.equinox.prov.ui.ProvUIActivator;
+import org.eclipse.equinox.prov.ui.ProvisioningUndoSupport;
+import org.eclipse.equinox.prov.ui.internal.ProvUIMessages;
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Abstract class representing provisioning operations
+ *
+ * @since 3.4
+ */
+
+public abstract class ProvisioningOperation extends AbstractOperation implements IAdvancedUndoableOperation, IAdvancedUndoableOperation2 {
+
+ /*
+ * Specifies whether any user prompting is appropriate while computing
+ * status.
+ */
+ protected boolean quietCompute = false;
+
+ public ProvisioningOperation(String label) {
+ super(label);
+ addContext(ProvisioningUndoSupport.getProvisioningUndoContext());
+ }
+
+ /**
+ *
+ */
+ public IStatus execute(IProgressMonitor monitor, final IAdaptable uiInfo) throws ExecutionException {
+ IStatus status;
+ try {
+ status = doExecute(monitor, uiInfo);
+ } catch (final ProvisionException e) {
+ throw new ExecutionException(NLS.bind(ProvUIMessages.ProvisioningOperation_ExecuteErrorTitle, getLabel()), e);
+ } catch (OperationCanceledException e) {
+ return Status.CANCEL_STATUS;
+ }
+ return status;
+ }
+
+ /**
+ *
+ */
+ public IStatus redo(IProgressMonitor monitor, final IAdaptable uiInfo) throws ExecutionException {
+ IStatus status;
+ try {
+ status = doExecute(monitor, uiInfo);
+ } catch (final ProvisionException e) {
+ throw new ExecutionException(NLS.bind(ProvUIMessages.ProvisioningOperation_RedoErrorTitle, getLabel()), e);
+ } catch (OperationCanceledException e) {
+ return Status.CANCEL_STATUS;
+ }
+ return status;
+ }
+
+ /**
+ *
+ */
+ public IStatus undo(IProgressMonitor monitor, final IAdaptable uiInfo) throws ExecutionException {
+ IStatus status;
+ try {
+ status = doUndo(monitor, uiInfo);
+ } catch (final ProvisionException e) {
+ throw new ExecutionException(NLS.bind(ProvUIMessages.ProvisioningOperation_UndoErrorTitle, getLabel()), e);
+ } catch (OperationCanceledException e) {
+ return Status.CANCEL_STATUS;
+ }
+ return status;
+ }
+
+ /**
+ * Perform the specific work involved in undoing this operation.
+ *
+ * @param monitor
+ * the progress monitor to use for the operation
+ * @param uiInfo
+ * the IAdaptable (or <code>null</code>) provided by the
+ * caller in order to supply UI information for prompting the
+ * user if necessary. When this parameter is not
+ * <code>null</code>, it contains an adapter for the
+ * org.eclipse.swt.widgets.Shell.class
+ * @throws ProvisionException
+ * propagates any ProvisionException thrown
+ */
+ protected abstract IStatus doUndo(IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException;
+
+ /**
+ * Perform the specific work involved in executing this operation.
+ *
+ * @param monitor
+ * the progress monitor to use for the operation
+ * @param uiInfo
+ * the IAdaptable (or <code>null</code>) provided by the
+ * caller in order to supply UI information for prompting the
+ * user if necessary. When this parameter is not
+ * <code>null</code>, it contains an adapter for the
+ * org.eclipse.swt.widgets.Shell.class
+ * @throws ProvisionException
+ * propagates any ProvisionException thrown
+ *
+ */
+ protected abstract IStatus doExecute(IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.commands.operations.AbstractOperation#canRedo()
+ */
+ public boolean canRedo() {
+ return canExecute();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.commands.operations.IAdvancedUndoableOperation#aboutToNotify(org.eclipse.core.commands.operations.OperationHistoryEvent)
+ */
+ public void aboutToNotify(OperationHistoryEvent event) {
+ // do nothing
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.commands.operations.IAdvancedUndoableOperation#getAffectedObjects()
+ */
+ public Object[] getAffectedObjects() {
+ return new Object[0];
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.commands.operations.IAdvancedUndoableOperation#computeRedoableStatus(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public IStatus computeRedoableStatus(IProgressMonitor monitor) throws ExecutionException {
+ return computeExecutionStatus(monitor);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.commands.operations.IAdvancedUndoableOperation#computeUndoableStatus(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public IStatus computeUndoableStatus(IProgressMonitor monitor) throws ExecutionException {
+ return okStatus();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.commands.operations.IAdvancedUndoableOperation2#computeExecutionStatus(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public IStatus computeExecutionStatus(IProgressMonitor monitor) throws ExecutionException {
+ return okStatus();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.commands.operations.IAdvancedUndoableOperation2#runInBackground()
+ */
+ public boolean runInBackground() {
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.commands.operations.IAdvancedUndoableOperation2#setQuietCompute(boolean)
+ */
+ public void setQuietCompute(boolean quiet) {
+ quietCompute = quiet;
+ }
+
+ protected IStatus okStatus() {
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus failureStatus() {
+ return new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, getLabel());
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/RemoveArtifactRepositoryOperation.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/RemoveArtifactRepositoryOperation.java
new file mode 100644
index 000000000..636589c32
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/RemoveArtifactRepositoryOperation.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.operations;
+
+import java.net.URL;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.prov.artifact.repository.IArtifactRepository;
+import org.eclipse.equinox.prov.core.ProvisionException;
+import org.eclipse.equinox.prov.ui.ProvisioningUtil;
+
+/**
+ * Operation which removes the artifact repository with the given URL.
+ *
+ * @since 3.4
+ */
+public class RemoveArtifactRepositoryOperation extends RepositoryOperation {
+
+ private boolean removed = false;
+
+ public RemoveArtifactRepositoryOperation(String label, IArtifactRepository[] repos) {
+ super(label, new URL[repos.length], new String[repos.length]);
+ for (int i = 0; i < repos.length; i++) {
+ urls[i] = repos[i].getLocation();
+ names[i] = repos[i].getName();
+ }
+ }
+
+ protected IStatus doExecute(IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException {
+ for (int i = 0; i < urls.length; i++) {
+ ProvisioningUtil.removeArtifactRepository(urls[i], monitor, uiInfo);
+ }
+ removed = true;
+ return okStatus();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.commands.operations.AbstractOperation#canExecute()
+ */
+ public boolean canExecute() {
+ return super.canExecute() && !removed;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.commands.operations.AbstractOperation#canUndo()
+ */
+ public boolean canUndo() {
+ return super.canUndo() && removed;
+ }
+
+ protected IStatus doUndo(IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException {
+ for (int i = 0; i < urls.length; i++) {
+ IArtifactRepository repo = ProvisioningUtil.addArtifactRepository(urls[i], monitor, uiInfo);
+ if (repo == null) {
+ return failureStatus();
+ }
+ if (names[i] != null) {
+ ProvisioningUtil.setRepositoryName(repo, names[i]);
+ }
+ }
+ removed = false;
+ return okStatus();
+
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/RemoveColocatedRepositoryOperation.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/RemoveColocatedRepositoryOperation.java
new file mode 100644
index 000000000..bad797f75
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/RemoveColocatedRepositoryOperation.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.operations;
+
+import java.net.URL;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.prov.core.ProvisionException;
+import org.eclipse.equinox.prov.core.repository.IRepositoryInfo;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepository;
+import org.eclipse.equinox.prov.ui.ColocatedRepositoryUtil;
+import org.eclipse.equinox.prov.ui.ProvisioningUtil;
+
+/**
+ * Operation that removes the colocated repositories with the given URLs. *
+ *
+ * @since 3.4
+ */
+public class RemoveColocatedRepositoryOperation extends RepositoryOperation {
+
+ private boolean removed = false;
+
+ public RemoveColocatedRepositoryOperation(String label, IMetadataRepository[] repos) {
+ super(label, new URL[repos.length], new String[repos.length]);
+ for (int i = 0; i < repos.length; i++) {
+ urls[i] = ColocatedRepositoryUtil.makeColocatedRepositoryURL(repos[i].getLocation());
+ names[i] = repos[i].getName();
+ }
+ }
+
+ protected IStatus doExecute(IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException {
+ for (int i = 0; i < urls.length; i++) {
+ ProvisioningUtil.removeMetadataRepository(ColocatedRepositoryUtil.makeMetadataRepositoryURL(urls[i]), monitor, uiInfo);
+ ProvisioningUtil.removeArtifactRepository(ColocatedRepositoryUtil.makeArtifactRepositoryURL(urls[i]), monitor, uiInfo);
+ }
+ removed = true;
+ return okStatus();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.commands.operations.AbstractOperation#canExecute()
+ */
+ public boolean canExecute() {
+ return !removed && super.canExecute();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.commands.operations.AbstractOperation#canUndo()
+ */
+ public boolean canUndo() {
+ return removed && super.canUndo();
+ }
+
+ protected IStatus doUndo(IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException {
+ for (int i = 0; i < urls.length; i++) {
+ URL metadataURL = ColocatedRepositoryUtil.makeMetadataRepositoryURL(urls[i]);
+ IRepositoryInfo repo = ProvisioningUtil.addMetadataRepository(metadataURL, monitor, uiInfo);
+ if (repo == null) {
+ return failureStatus();
+ }
+ if (names[i] != null) {
+ ProvisioningUtil.setRepositoryName(repo, names[i]);
+ }
+
+ repo = ProvisioningUtil.addArtifactRepository(ColocatedRepositoryUtil.makeArtifactRepositoryURL(urls[i]), monitor, uiInfo);
+ if (repo == null) {
+ // remove the metadata repo we just added
+ ProvisioningUtil.removeMetadataRepository(metadataURL, monitor, uiInfo);
+ return failureStatus();
+ }
+
+ }
+ removed = false;
+ return okStatus();
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/RemoveMetadataRepositoryOperation.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/RemoveMetadataRepositoryOperation.java
new file mode 100644
index 000000000..30e2fa282
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/RemoveMetadataRepositoryOperation.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.operations;
+
+import java.net.URL;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.prov.core.ProvisionException;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepository;
+import org.eclipse.equinox.prov.ui.ProvisioningUtil;
+
+/**
+ * Operation that removes the metadata repository with the given URL. *
+ *
+ * @since 3.4
+ */
+public class RemoveMetadataRepositoryOperation extends RepositoryOperation {
+
+ private boolean removed = false;
+
+ public RemoveMetadataRepositoryOperation(String label, IMetadataRepository[] repos) {
+ super(label, new URL[repos.length], new String[repos.length]);
+ for (int i = 0; i < repos.length; i++) {
+ urls[i] = repos[i].getLocation();
+ names[i] = repos[i].getName();
+ }
+ }
+
+ protected IStatus doExecute(IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException {
+ for (int i = 0; i < urls.length; i++) {
+ ProvisioningUtil.removeMetadataRepository(urls[i], monitor, uiInfo);
+ }
+ removed = true;
+ return okStatus();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.commands.operations.AbstractOperation#canExecute()
+ */
+ public boolean canExecute() {
+ return !removed && super.canExecute();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.commands.operations.AbstractOperation#canUndo()
+ */
+ public boolean canUndo() {
+ return removed && super.canUndo();
+ }
+
+ protected IStatus doUndo(IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException {
+ for (int i = 0; i < urls.length; i++) {
+ IMetadataRepository repo = ProvisioningUtil.addMetadataRepository(urls[i], monitor, uiInfo);
+ if (repo == null) {
+ return failureStatus();
+ }
+ if (names[i] != null) {
+ ProvisioningUtil.setRepositoryName(repo, names[i]);
+ }
+ }
+ removed = false;
+ return okStatus();
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/RemoveProfilesOperation.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/RemoveProfilesOperation.java
new file mode 100644
index 000000000..ba91c7594
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/RemoveProfilesOperation.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.operations;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.prov.core.ProvisionException;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.ui.ProvisioningUtil;
+
+/**
+ * Operation that removes a profile
+ *
+ * @since 3.4
+ */
+public class RemoveProfilesOperation extends ProfileOperation {
+ private boolean removed = false;
+
+ public RemoveProfilesOperation(String label, Profile[] profiles) {
+ super(label, profiles);
+ }
+
+ protected IStatus doExecute(IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException {
+ for (int i = 0; i < profileIds.length; i++) {
+ ProvisioningUtil.removeProfile(profileIds[i], monitor, uiInfo);
+ }
+ // assume the best if no exception
+ removed = true;
+ return okStatus();
+ }
+
+ protected IStatus doUndo(IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException {
+ for (int i = 0; i < cachedProfiles.length; i++) {
+ ProvisioningUtil.addProfile(cachedProfiles[i], monitor, uiInfo);
+ }
+ removed = false;
+ return okStatus();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.commands.operations.AbstractOperation#canExecute()
+ */
+ public boolean canExecute() {
+ return profileIds != null && !removed;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.commands.operations.AbstractOperation#canUndo()
+ */
+ public boolean canUndo() {
+ return cachedProfiles != null && removed;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/RepositoryOperation.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/RepositoryOperation.java
new file mode 100644
index 000000000..2b686491f
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/RepositoryOperation.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.operations;
+
+import java.net.URL;
+
+/**
+ * Abstract class representing provisioning repository operations
+ *
+ * @since 3.4
+ */
+public abstract class RepositoryOperation extends ProvisioningOperation {
+
+ URL[] urls;
+ String[] names;
+
+ RepositoryOperation(String label, URL[] urls, String[] names) {
+ super(label);
+ this.urls = urls;
+ this.names = names;
+ }
+
+ public boolean canExecute() {
+ return urls != null;
+ }
+
+ public boolean canUndo() {
+ return urls != null;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/UninstallOperation.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/UninstallOperation.java
new file mode 100644
index 000000000..5d44a1086
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/UninstallOperation.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.operations;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.prov.core.ProvisionException;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.metadata.IInstallableUnitConstants;
+import org.eclipse.equinox.prov.ui.ProvisioningUtil;
+
+/**
+ * An operation that uninstalls the specified IU's from the specified profile
+ *
+ * @since 3.4
+ */
+public class UninstallOperation extends ProfileModificationOperation {
+
+ private boolean installed = true;
+
+ public UninstallOperation(String label, String profileID, IInstallableUnit[] ius) {
+ super(label, profileID, ius);
+ }
+
+ protected IStatus doExecute(IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException {
+ for (int i = 0; i < ius.length; i++) {
+ if (entryPointName == null) {
+ String prop = ius[i].getProperty(IInstallableUnitConstants.ENTRYPOINT_IU_KEY);
+ if (prop != null && Boolean.valueOf(prop).booleanValue()) {
+ entryPointName = ius[i].getProperty(IInstallableUnitConstants.NAME);
+ }
+ } else {
+ break;
+ }
+ }
+ IStatus status = ProvisioningUtil.uninstall(ius, getProfiles()[0], monitor, uiInfo);
+ if (status.isOK()) {
+ installed = false;
+ }
+ return status;
+ }
+
+ protected IStatus doUndo(IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException {
+ IStatus status = ProvisioningUtil.install(ius, entryPointName, getProfiles()[0], monitor, uiInfo);
+ if (status.isOK()) {
+ installed = true;
+ }
+ return status;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.commands.operations.AbstractOperation#canExecute()
+ */
+ public boolean canExecute() {
+ // TODO should make sure it's actually installed in the profile
+ return isValid() && installed;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.commands.operations.AbstractOperation#canUndo()
+ */
+ public boolean canUndo() {
+ return isValid() && !installed;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/UpdateOperation.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/UpdateOperation.java
new file mode 100644
index 000000000..b9f43c5a2
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/operations/UpdateOperation.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.operations;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.prov.core.ProvisionException;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.ui.ProvUIActivator;
+import org.eclipse.equinox.prov.ui.ProvisioningUtil;
+import org.eclipse.equinox.prov.ui.internal.ProvUIMessages;
+
+/**
+ * An operation that installs the specified IU's into the specified profile
+ *
+ * @since 3.4
+ */
+public class UpdateOperation extends ProfileModificationOperation {
+
+ private IInstallableUnit[] replacementIUs;
+
+ public UpdateOperation(String label, String profileID, IInstallableUnit[] toUpdate, IInstallableUnit[] replacements) {
+ super(label, profileID, toUpdate);
+ replacementIUs = replacements;
+ }
+
+ protected IStatus doExecute(IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException {
+ return ProvisioningUtil.update(ius, replacementIUs, getProfiles()[0], monitor, uiInfo);
+ }
+
+ protected IStatus doUndo(IProgressMonitor monitor, IAdaptable uiInfo) throws ProvisionException {
+ // won't get called because canUndo() is currently false;
+ return Status.OK_STATUS;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.commands.operations.AbstractOperation#canExecute()
+ */
+ public boolean canExecute() {
+ return isValid();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.commands.operations.AbstractOperation#canUndo()
+ */
+ // TODO this should be implemented as a rollback
+ public boolean canUndo() {
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.commands.operations.IAdvancedUndoableOperation2#computeExecutionStatus(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public IStatus computeExecutionStatus(IProgressMonitor monitor) throws ExecutionException {
+ if (replacementIUs == null) {
+ try {
+ replacementIUs = ProvisioningUtil.updatesFor(ius, getProfile(), monitor, null);
+ } catch (ProvisionException e) {
+ return new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, e.getLocalizedMessage(), e);
+ }
+ }
+ if (replacementIUs.length > 0) {
+ return okStatus();
+ }
+ return new Status(IStatus.INFO, ProvUIActivator.PLUGIN_ID, ProvUIMessages.UpdateOperation_NothingToUpdate);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/viewers/ColocatedRepositoryLabelProvider.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/viewers/ColocatedRepositoryLabelProvider.java
new file mode 100644
index 000000000..fbfb945e6
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/viewers/ColocatedRepositoryLabelProvider.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.prov.ui.viewers;
+
+import java.net.URL;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepository;
+import org.eclipse.equinox.prov.ui.ColocatedRepositoryUtil;
+import org.eclipse.equinox.prov.ui.ProvUIImages;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * Label provider for colocated repositories.
+ *
+ * @since 3.4
+ */
+public class ColocatedRepositoryLabelProvider extends LabelProvider implements ITableLabelProvider {
+ final static int COLUMN_NAME = 0;
+ final static int COLUMN_LOCATION = 1;
+ final static String BLANK = ""; //$NON-NLS-1$
+
+ public String getColumnText(Object element, int columnIndex) {
+ IMetadataRepository repo = getRepository(element);
+ if (repo == null)
+ return BLANK;
+
+ switch (columnIndex) {
+ case COLUMN_NAME :
+ return repo.getName();
+ case COLUMN_LOCATION :
+ URL url = ColocatedRepositoryUtil.makeColocatedRepositoryURL(repo.getLocation());
+ return url.toExternalForm();
+ }
+ return BLANK;
+ }
+
+ public Image getColumnImage(Object element, int index) {
+ if (index == COLUMN_NAME && getRepository(element) != null) {
+ return ProvUIImages.getImage(ProvUIImages.IMG_METADATA_REPOSITORY);
+ }
+ return null;
+ }
+
+ private IMetadataRepository getRepository(Object element) {
+ if (element instanceof IMetadataRepository)
+ return (IMetadataRepository) element;
+ if (element instanceof IAdaptable)
+ return (IMetadataRepository) ((IAdaptable) element).getAdapter(IMetadataRepository.class);
+ return null;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/viewers/IUCapabilityFilter.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/viewers/IUCapabilityFilter.java
new file mode 100644
index 000000000..26d60351e
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/viewers/IUCapabilityFilter.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.prov.ui.viewers;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.equinox.prov.metadata.*;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+
+/**
+ * Viewer filter which filters IU's so that only those that satisfy the required
+ * capabilities appear in the viewer.
+ *
+ * @since 3.4
+ */
+public class IUCapabilityFilter extends ViewerFilter {
+
+ private RequiredCapability[] requirements;
+
+ public IUCapabilityFilter(RequiredCapability[] requiredCapabilities) {
+ super();
+ this.requirements = requiredCapabilities;
+ }
+
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ IInstallableUnit iu = null;
+ if (element instanceof InstallableUnit) {
+ iu = (IInstallableUnit) element;
+ } else if (element instanceof IAdaptable) {
+ iu = (IInstallableUnit) ((IAdaptable) element).getAdapter(InstallableUnit.class);
+ }
+ if (iu == null) {
+ return true;
+ }
+ ProvidedCapability[] capabilities = iu.getProvidedCapabilities();
+ for (int i = 0; i < requirements.length; i++) {
+ boolean satisfied = false;
+ for (int j = 0; j < capabilities.length; j++) {
+ if (capabilities[j].isSatisfiedBy(requirements[i])) {
+ satisfied = true;
+ break;
+ }
+ }
+ if (!satisfied) {
+ return false;
+ }
+ }
+ return true;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/viewers/IUDetailsLabelProvider.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/viewers/IUDetailsLabelProvider.java
new file mode 100644
index 000000000..29410e89f
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/viewers/IUDetailsLabelProvider.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.prov.ui.viewers;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.metadata.IInstallableUnitConstants;
+import org.eclipse.equinox.prov.ui.ProvUIImages;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * Label provider for showing IU's in a table.
+ *
+ * @since 3.4
+ */
+public class IUDetailsLabelProvider extends LabelProvider implements ITableLabelProvider {
+ final static int COLUMN_NAME = 0;
+ final static int COLUMN_VERSION = 1;
+ final static String BLANK = ""; //$NON-NLS-1$
+
+ public String getText(Object obj) {
+ return getColumnText(obj, COLUMN_NAME);
+ }
+
+ public Image getImage(Object obj) {
+ return getColumnImage(obj, COLUMN_NAME);
+ }
+
+ public String getColumnText(Object element, int columnIndex) {
+ IInstallableUnit iu = getIU(element);
+ if (iu == null)
+ return BLANK;
+
+ switch (columnIndex) {
+ case COLUMN_NAME :
+ String name = iu.getProperty(IInstallableUnitConstants.NAME);
+ if (name != null)
+ return name;
+ return iu.getId();
+ case COLUMN_VERSION :
+ return iu.getVersion().toString();
+ }
+ return BLANK;
+ }
+
+ public Image getColumnImage(Object element, int index) {
+ if (index == COLUMN_NAME && getIU(element) != null) {
+ return ProvUIImages.getImage(ProvUIImages.IMG_IU);
+ }
+ return null;
+ }
+
+ private IInstallableUnit getIU(Object element) {
+ if (element instanceof IInstallableUnit)
+ return (IInstallableUnit) element;
+ if (element instanceof IAdaptable)
+ return (IInstallableUnit) ((IAdaptable) element).getAdapter(IInstallableUnit.class);
+ return null;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/viewers/IUDragAdapter.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/viewers/IUDragAdapter.java
new file mode 100644
index 000000000..504b4af1d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/viewers/IUDragAdapter.java
@@ -0,0 +1,138 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.viewers;
+
+import java.util.*;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.jface.util.LocalSelectionTransfer;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.swt.dnd.*;
+import org.eclipse.swt.widgets.Control;
+
+/**
+ * *Implements drag behaviour when IU items are dragged from a repository view.
+ *
+ * @since 3.4
+ */
+public class IUDragAdapter extends DragSourceAdapter {
+
+ ISelectionProvider selectionProvider;
+
+ /**
+ * Constructs a new drag adapter.
+ *
+ * @param provider
+ * The selection provider
+ */
+ public IUDragAdapter(ISelectionProvider provider) {
+ selectionProvider = provider;
+ }
+
+ /**
+ * Set the drag data to represent the local selection of IU's if possible.
+ * Fallback to using a text description of each IU.
+ */
+ public void dragSetData(DragSourceEvent event) {
+ IInstallableUnit[] ius = getSelectedIUs();
+
+ if (ius == null || ius.length == 0) {
+ return;
+ }
+
+ // use local selection transfer if possible
+ if (LocalSelectionTransfer.getTransfer().isSupportedType(event.dataType)) {
+ event.data = LocalSelectionTransfer.getTransfer().getSelection();
+ return;
+ }
+ // resort to a text transfer
+ if (!TextTransfer.getInstance().isSupportedType(event.dataType)) {
+ return;
+ }
+
+ // Get a text description of each IU and set as the drag data
+ final StringBuffer buffer = new StringBuffer();
+
+ for (int i = 0; i < ius.length; i++) {
+ buffer.append(ius[i].toString());
+ buffer.append('\n');
+ }
+ event.data = buffer.toString();
+ }
+
+ /**
+ * Start the drag only if the selection contains IUs.
+ */
+ public void dragStart(DragSourceEvent event) {
+
+ // Focus workaround copied from navigator drag adapter
+ DragSource dragSource = (DragSource) event.widget;
+ Control control = dragSource.getControl();
+ if (control != control.getDisplay().getFocusControl()) {
+ event.doit = false;
+ return;
+ }
+
+ // Check the selection
+ IStructuredSelection selection = (IStructuredSelection) selectionProvider.getSelection();
+ // No drag if nothing is selected
+ if (selection.isEmpty()) {
+ event.doit = false;
+ return;
+ }
+ if (!areOnlyIUsSelected(selection)) {
+ event.doit = false;
+ return;
+ }
+ LocalSelectionTransfer.getTransfer().setSelection(selection);
+ event.doit = true;
+ }
+
+ private IInstallableUnit[] getSelectedIUs() {
+ List ius = new ArrayList();
+
+ ISelection selection = selectionProvider.getSelection();
+ if (!(selection instanceof IStructuredSelection) || selection.isEmpty()) {
+ return null;
+ }
+ IStructuredSelection structuredSelection = (IStructuredSelection) selection;
+
+ Iterator iter = structuredSelection.iterator();
+ while (iter.hasNext()) {
+ IInstallableUnit iu = getIU(iter.next());
+ if (iu != null) {
+ ius.add(iu);
+ }
+ }
+ return (IInstallableUnit[]) ius.toArray(new IInstallableUnit[ius.size()]);
+ }
+
+ private boolean areOnlyIUsSelected(IStructuredSelection selection) {
+ Iterator iter = selection.iterator();
+ while (iter.hasNext()) {
+ IInstallableUnit iu = getIU(iter.next());
+ if (iu == null) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private IInstallableUnit getIU(Object obj) {
+ if (obj instanceof IInstallableUnit) {
+ return (IInstallableUnit) obj;
+ }
+ if (obj instanceof IAdaptable) {
+ return (IInstallableUnit) ((IAdaptable) obj).getAdapter(IInstallableUnit.class);
+ }
+ return null;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/viewers/IUGroupFilter.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/viewers/IUGroupFilter.java
new file mode 100644
index 000000000..ba25ec062
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/viewers/IUGroupFilter.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.prov.ui.viewers;
+
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.metadata.RequiredCapability;
+
+/**
+ * Viewer filter which filters IU's so that only those with the kind "group" are
+ * included.
+ *
+ * @since 3.4
+ */
+public class IUGroupFilter extends IUCapabilityFilter {
+
+ public IUGroupFilter() {
+ super(new RequiredCapability[] {new RequiredCapability(IInstallableUnit.IU_KIND_NAMESPACE, "group", null, null, false, false)}); //$NON-NLS-1$
+
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/viewers/IUPropertyFilter.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/viewers/IUPropertyFilter.java
new file mode 100644
index 000000000..3b1b2f584
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/viewers/IUPropertyFilter.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.prov.ui.viewers;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+
+/**
+ * Viewer filter which shows only IUs that have a property matching
+ * the specified value.
+ *
+ * @since 3.4
+ */
+public class IUPropertyFilter extends ViewerFilter {
+
+ private String propertyName;
+ private String propertyValue;
+
+ public IUPropertyFilter(String name, String value) {
+ this.propertyName = name;
+ this.propertyValue = value;
+ }
+
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ IInstallableUnit iu = null;
+ if (element instanceof IInstallableUnit) {
+ iu = (IInstallableUnit) element;
+ } else if (element instanceof IAdaptable) {
+ iu = (IInstallableUnit) ((IAdaptable) element).getAdapter(IInstallableUnit.class);
+ }
+ if (iu == null)
+ return false;
+ String prop = iu.getProperty(propertyName);
+ if (prop == null)
+ return false;
+ return prop.equals(propertyValue);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/viewers/InstallIUDropAdapter.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/viewers/InstallIUDropAdapter.java
new file mode 100644
index 000000000..9735b7852
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/viewers/InstallIUDropAdapter.java
@@ -0,0 +1,242 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.ui.viewers;
+
+import java.util.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.ui.ProvUIActivator;
+import org.eclipse.equinox.prov.ui.actions.InstallAction;
+import org.eclipse.equinox.prov.ui.internal.ProvUIMessages;
+import org.eclipse.equinox.prov.ui.model.InstalledIUElement;
+import org.eclipse.equinox.prov.ui.operations.IOperationConfirmer;
+import org.eclipse.jface.util.LocalSelectionTransfer;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.swt.dnd.*;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * Defines drop behavior for selected IUs to mean install the IU on the target
+ * profile.
+ *
+ * @since 3.4
+ *
+ */
+public class InstallIUDropAdapter extends ViewerDropAdapter {
+
+ static boolean DEBUG = false;
+ private IOperationConfirmer confirmer;
+ private int entryPointStrategy = InstallAction.ENTRYPOINT_FORCE;
+
+ /**
+ * Constructs a new drop adapter.
+ *
+ * @param viewer
+ * the navigator's viewer
+ * @param confirmer
+ * a confirmer that should be used to confirm the operation, or
+ * <code>null</code> if no confirmation is necessary.
+ */
+ public InstallIUDropAdapter(StructuredViewer viewer, IOperationConfirmer confirmer) {
+ super(viewer);
+ this.confirmer = confirmer;
+ }
+
+ /**
+ * Returns an error status with the given info.
+ */
+ IStatus error(String message) {
+ return error(message, null);
+ }
+
+ /**
+ * Returns an error status with the given info.
+ */
+ IStatus error(String message, Throwable exception) {
+ return new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, 0, message, exception);
+ }
+
+ /**
+ * Returns the target profile for the drop. If the drop is positioned on an
+ * IU, return its parent profile.
+ */
+ private Profile getProfileTarget(Object mouseTarget) {
+ if (mouseTarget instanceof Profile) {
+ return (Profile) mouseTarget;
+ }
+
+ if (mouseTarget instanceof InstalledIUElement) {
+ return ((InstalledIUElement) mouseTarget).getProfile();
+ }
+ return null;
+ }
+
+ /**
+ * Returns the shell
+ */
+ private Shell getShell() {
+ return getViewer().getControl().getShell();
+ }
+
+ /**
+ * Returns an status indicating success.
+ */
+ private IStatus ok() {
+ return new Status(IStatus.OK, ProvUIActivator.PLUGIN_ID, 0, null, null);
+ }
+
+ /**
+ * Perform the drop.
+ *
+ * @see org.eclipse.swt.dnd.DropTargetListener#drop(org.eclipse.swt.dnd.DropTargetEvent)
+ */
+ public boolean performDrop(final Object data) {
+ if (DEBUG) {
+ System.out.println("Perform drop on target: " + getCurrentTarget() + " with data: " + data); //$NON-NLS-1$//$NON-NLS-2$
+ }
+ if (getCurrentTarget() == null || data == null)
+ return false;
+
+ ISelection selection = LocalSelectionTransfer.getTransfer().getSelection();
+ if (!(selection instanceof IStructuredSelection) || selection.isEmpty())
+ return false;
+
+ Profile profile = getProfileTarget(getCurrentTarget());
+ if (getCurrentOperation() == DND.DROP_COPY && profile != null) {
+ final IStructuredSelection structuredSelection = (IStructuredSelection) selection;
+ ISelectionProvider selectionProvider = new ISelectionProvider() {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ISelectionProvider#addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
+ */
+ public void addSelectionChangedListener(ISelectionChangedListener listener) {
+ // Ignore because the selection won't change
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ISelectionProvider#getSelection()
+ */
+ public ISelection getSelection() {
+ if (DEBUG) {
+ System.out.println("Selection was queried by action"); //$NON-NLS-1$
+ System.out.println(structuredSelection.toString());
+ }
+ return structuredSelection;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ISelectionProvider#removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
+ */
+ public void removeSelectionChangedListener(ISelectionChangedListener listener) {
+ // ignore because the selection is static
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ISelectionProvider#setSelection(org.eclipse.jface.viewers.ISelection)
+ */
+ public void setSelection(ISelection sel) {
+ throw new UnsupportedOperationException("This ISelectionProvider is static, and cannot be modified."); //$NON-NLS-1$
+ }
+ };
+ InstallAction action = new InstallAction(ProvUIMessages.Ops_InstallIUOperationLabel, selectionProvider, confirmer, profile, null, getShell());
+ action.setEntryPointStrategy(entryPointStrategy);
+ if (DEBUG)
+ System.out.println("Running install action"); //$NON-NLS-1$
+ action.run();
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Validate whether the drop is valid for the target
+ */
+ public boolean validateDrop(Object target, int dragOperation, TransferData transferType) {
+
+ if (LocalSelectionTransfer.getTransfer().isSupportedType(transferType)) {
+ IStatus status = validateTarget(target, transferType);
+ if (DEBUG) {
+ System.out.println("Validate target: " + status); //$NON-NLS-1$
+ }
+ return status.isOK();
+ }
+ return false;
+ }
+
+ /*
+ * Overridden to force a copy when the drag is valid.
+ *
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.ViewerDropAdapter#dragEnter(org.eclipse.swt.dnd.DropTargetEvent)
+ */
+ public void dragEnter(DropTargetEvent event) {
+ event.detail = DND.DROP_COPY;
+ super.dragEnter(event);
+ }
+
+ /**
+ * Ensures that the drop target meets certain criteria
+ */
+ private IStatus validateTarget(Object target, TransferData transferType) {
+ if (LocalSelectionTransfer.getTransfer().isSupportedType(transferType)) {
+ IInstallableUnit[] ius = getSelectedIUs();
+
+ if (ius.length == 0) {
+ return error(ProvUIMessages.ProvDropAdapter_NoIUsToDrop);
+ }
+ if (getProfileTarget(target) != null) {
+ return ok();
+ }
+ return error(ProvUIMessages.ProvDropAdapter_InvalidDropTarget);
+ }
+ return error(ProvUIMessages.ProvDropAdapter_UnsupportedDropOperation);
+ }
+
+ /**
+ * Returns the resource selection from the LocalSelectionTransfer.
+ *
+ * @return the resource selection from the LocalSelectionTransfer
+ */
+ private IInstallableUnit[] getSelectedIUs() {
+ ISelection selection = LocalSelectionTransfer.getTransfer().getSelection();
+ List ius = new ArrayList();
+
+ if (!(selection instanceof IStructuredSelection) || selection.isEmpty()) {
+ return null;
+ }
+ IStructuredSelection structuredSelection = (IStructuredSelection) selection;
+
+ Iterator iter = structuredSelection.iterator();
+ while (iter.hasNext()) {
+ IInstallableUnit iu = getIU(iter.next());
+ if (iu != null) {
+ ius.add(iu);
+ }
+ }
+ return (IInstallableUnit[]) ius.toArray(new IInstallableUnit[ius.size()]);
+ }
+
+ private IInstallableUnit getIU(Object obj) {
+ if (obj instanceof IInstallableUnit) {
+ return (IInstallableUnit) obj;
+ }
+ if (obj instanceof IAdaptable) {
+ return (IInstallableUnit) ((IAdaptable) obj).getAdapter(IInstallableUnit.class);
+ }
+ return null;
+ }
+
+ public void setEntryPointStrategy(int strategy) {
+ entryPointStrategy = strategy;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/viewers/InternalRepositoryFilter.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/viewers/InternalRepositoryFilter.java
new file mode 100644
index 000000000..5766b730c
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/viewers/InternalRepositoryFilter.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.prov.ui.viewers;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.equinox.prov.core.repository.IRepositoryInfo;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+
+/**
+ * Viewer filter which filters out internal repositories.
+ *
+ * @since 3.4
+ */
+public class InternalRepositoryFilter extends ViewerFilter {
+
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ IRepositoryInfo repo = null;
+ if (element instanceof IRepositoryInfo) {
+ repo = (IRepositoryInfo) element;
+ } else if (element instanceof IAdaptable) {
+ repo = (IRepositoryInfo) ((IAdaptable) element).getAdapter(IRepositoryInfo.class);
+ }
+ if (repo == null) {
+ return true;
+ }
+ return !(Boolean.valueOf(repo.getProperties().getProperty(IRepositoryInfo.IMPLEMENTATION_ONLY_KEY, "false"))).booleanValue(); //$NON-NLS-1$
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/viewers/ProvElementLabelProvider.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/viewers/ProvElementLabelProvider.java
new file mode 100644
index 000000000..98624250a
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/viewers/ProvElementLabelProvider.java
@@ -0,0 +1,126 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.prov.ui.viewers;
+
+import org.eclipse.equinox.prov.artifact.repository.IArtifactRepository;
+import org.eclipse.equinox.prov.core.repository.IRepositoryInfo;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.*;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepository;
+import org.eclipse.equinox.prov.ui.ProvUIImages;
+import org.eclipse.equinox.prov.ui.model.InstalledIUElement;
+import org.eclipse.equinox.prov.ui.model.ProvElement;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Label provider for provisioning elements. Some provisioning objects are
+ * wrapped by ProvElements and some are not. This is the most generic of the
+ * provisioning label providers. A two-column format for elements is
+ * supported, with the content of the columns dependent on the type of object.
+ *
+ * @since 3.4
+ */
+public class ProvElementLabelProvider extends LabelProvider implements ITableLabelProvider {
+
+ public String getText(Object obj) {
+ if (obj instanceof ProvElement) {
+ return ((ProvElement) obj).getLabel(obj);
+ }
+ if (obj instanceof Profile) {
+ return ((Profile) obj).getProfileId();
+ }
+ if (obj instanceof IInstallableUnit) {
+ IInstallableUnit iu = (IInstallableUnit) obj;
+ return iu.getId();
+ }
+ if (obj instanceof IRepositoryInfo) {
+ String name = ((IRepositoryInfo) obj).getName();
+ if (name != null && name.length() > 0) {
+ return name;
+ }
+ return ((IRepositoryInfo) obj).getLocation().toExternalForm();
+ }
+ if (obj instanceof IArtifactKey) {
+ IArtifactKey key = (IArtifactKey) obj;
+ return key.getId() + " [" + key.getNamespace() + "]"; //$NON-NLS-1$//$NON-NLS-2$
+ }
+
+ return obj.toString();
+ }
+
+ public Image getImage(Object obj) {
+ if (obj instanceof ProvElement) {
+ return ((ProvElement) obj).getImage(obj);
+ }
+ if (obj instanceof Profile) {
+ return ProvUIImages.getImage(ProvUIImages.IMG_PROFILE);
+ }
+ if (obj instanceof InstallableUnit) {
+ return ProvUIImages.getImage(ProvUIImages.IMG_IU);
+ }
+ if (obj instanceof IArtifactRepository) {
+ return ProvUIImages.getImage(ProvUIImages.IMG_ARTIFACT_REPOSITORY);
+ }
+ if (obj instanceof IMetadataRepository) {
+ return ProvUIImages.getImage(ProvUIImages.IMG_METADATA_REPOSITORY);
+ }
+ if (obj instanceof IArtifactKey) {
+ return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FILE);
+ }
+
+ return null;
+ }
+
+ public Image getColumnImage(Object element, int index) {
+ if (index == 0) {
+ return getImage(element);
+ }
+ return null;
+ }
+
+ public String getColumnText(Object element, int columnIndex) {
+
+ switch (columnIndex) {
+ case 0 :
+ return getText(element);
+ case 1 :
+ if (element instanceof Profile) {
+ return ((Profile) element).getValue(Profile.PROP_NAME);
+ }
+ if (element instanceof IInstallableUnit) {
+ IInstallableUnit iu = (IInstallableUnit) element;
+ return iu.getVersion().toString();
+ }
+ if (element instanceof IRepositoryInfo) {
+ String name = ((IRepositoryInfo) element).getName();
+ if (name != null && name.length() > 0) {
+ return ((IRepositoryInfo) element).getLocation().toExternalForm();
+ }
+ return ((IRepositoryInfo) element).getType();
+ }
+ if (element instanceof IArtifactKey) {
+ IArtifactKey key = (IArtifactKey) element;
+ return key.getVersion().toString();
+ }
+ if (element instanceof InstalledIUElement) {
+ IInstallableUnit iu = (IInstallableUnit) ((InstalledIUElement) element).getAdapter(IInstallableUnit.class);
+ if (iu != null)
+ return iu.getVersion().toString();
+ }
+ }
+ return null;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/viewers/StructuredViewerProvisioningListener.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/viewers/StructuredViewerProvisioningListener.java
new file mode 100644
index 000000000..317e435b3
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/prov/ui/viewers/StructuredViewerProvisioningListener.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.prov.ui.viewers;
+
+import java.util.EventObject;
+import org.eclipse.equinox.prov.core.eventbus.SynchronousProvisioningListener;
+import org.eclipse.equinox.prov.engine.*;
+import org.eclipse.equinox.prov.ui.IProvisioningProperties;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * ProvisioningListener which updates a structured viewer based on
+ * provisioning changes
+ *
+ * @since 3.4
+ */
+public class StructuredViewerProvisioningListener implements SynchronousProvisioningListener, IPropertyChangeListener {
+
+ // TODO this should be replaced with actual event topic ids from the event API once they are defined
+ // TODO the IPropertyChangeListener implementation should also disappear once repo events are supported
+ public static final int PROV_EVENT_REPOSITORY = 0x0001;
+ public static final int PROV_EVENT_IU = 0x0002;
+ public static final int PROV_EVENT_PROFILE = 0x0004;
+
+ int eventTypes = 0;
+ StructuredViewer viewer;
+ Display display;
+
+ public StructuredViewerProvisioningListener(StructuredViewer viewer, int eventTypes) {
+ this.viewer = viewer;
+ this.eventTypes = eventTypes;
+ this.display = viewer.getControl().getDisplay();
+ }
+
+ public void notify(EventObject o) {
+ // Commit operations on a profile will refresh the structure of the profile
+ if (o instanceof CommitOperationEvent && (((eventTypes & PROV_EVENT_PROFILE) == PROV_EVENT_PROFILE) || (eventTypes & PROV_EVENT_IU) == PROV_EVENT_IU)) {
+ CommitOperationEvent event = (CommitOperationEvent) o;
+ final Profile profile = event.getProfile();
+ display.asyncExec(new Runnable() {
+ public void run() {
+ viewer.refresh(profile);
+
+ }
+ });
+ } else if (o instanceof ProfileEvent && ((eventTypes & PROV_EVENT_IU) == PROV_EVENT_IU)) {
+ // We assume for now that it was either an add or remove of a
+ // profile, so rather than update a profile, we update everything.
+ display.asyncExec(new Runnable() {
+ public void run() {
+ viewer.refresh();
+ }
+ });
+ }
+ }
+
+ public void propertyChange(final PropertyChangeEvent event) {
+ // Currently we only support repo events
+ if ((eventTypes & PROV_EVENT_REPOSITORY) == PROV_EVENT_REPOSITORY) {
+ String property = event.getProperty();
+ if (property.equals(IProvisioningProperties.REPO_NAME)) {
+ display.asyncExec(new Runnable() {
+ public void run() {
+ viewer.update(event.getSource(), null);
+ }
+ });
+ } else if (property.equals(IProvisioningProperties.REPO_ADDED) || (property.equals(IProvisioningProperties.REPO_REMOVED))) {
+ display.asyncExec(new Runnable() {
+ public void run() {
+ viewer.refresh();
+ }
+ });
+ }
+ }
+
+ }
+
+ // TODO temporary for use by ProvUIActivator
+ public int getEventTypes() {
+ return eventTypes;
+ }
+}

Back to the top