Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Hallgren2009-12-29 11:10:10 +0000
committerThomas Hallgren2009-12-29 11:10:10 +0000
commitadc86299eb41a35ece8a67b9329480d359abe1a6 (patch)
treec390877f71f1d3dd3e519f3a3ccea49632a68c21 /bundles
parent53b17a1356bdeebcab1fff66577f9d2520ecb103 (diff)
downloadrt.equinox.p2-adc86299eb41a35ece8a67b9329480d359abe1a6.tar.gz
rt.equinox.p2-adc86299eb41a35ece8a67b9329480d359abe1a6.tar.xz
rt.equinox.p2-adc86299eb41a35ece8a67b9329480d359abe1a6.zip
298458: Add Java 5 Generics to the p2 code base
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/.classpath2
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/.settings/org.eclipse.jdt.core.prefs14
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/META-INF/MANIFEST.MF4
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/build.properties2
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/Activator.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRepositoryManager.java15
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepository.java92
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepositoryFactory.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorRequest.java13
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorSelector.java15
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/SignatureVerifier.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/BlobStore.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/DownloadJob.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/Mapper.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactDescriptor.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java87
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepositoryIO.java38
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ProcessingStepHandler.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/AbstractArtifactRepository.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/ArtifactRepositoryFactory.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/FlatteningIterator.java64
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/MappedCollectionIterator.java144
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/SimpleArtifactRepositoryFactory.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/CreateCompositeArtifactRepositoryTask.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.common/.classpath2
-rw-r--r--bundles/org.eclipse.equinox.p2.common/.settings/org.eclipse.jdt.core.prefs14
-rw-r--r--bundles/org.eclipse.equinox.p2.common/META-INF/MANIFEST.MF5
-rw-r--r--bundles/org.eclipse.equinox.p2.common/build.properties2
-rw-r--r--bundles/org.eclipse.equinox.p2.console/.classpath4
-rw-r--r--bundles/org.eclipse.equinox.p2.console/.settings/org.eclipse.jdt.core.prefs15
-rw-r--r--bundles/org.eclipse.equinox.p2.console/META-INF/MANIFEST.MF5
-rw-r--r--bundles/org.eclipse.equinox.p2.console/build.properties2
-rw-r--r--bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvCommandProvider.java18
-rw-r--r--bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvisioningHelper.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.core/.classpath2
-rw-r--r--bundles/org.eclipse.equinox.p2.core/.settings/org.eclipse.jdt.core.prefs626
-rw-r--r--bundles/org.eclipse.equinox.p2.core/META-INF/MANIFEST.MF5
-rw-r--r--bundles/org.eclipse.equinox.p2.core/build.properties2
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/Activator.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/DefaultAgentProvider.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/ProvisioningAgent.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/StringPool.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/CollectionUtils.java232
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/FileUtils.java42
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/LogHelper.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/OrderedProperties.java89
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/StringHelper.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/TarFile.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/.classpath2
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/.settings/org.eclipse.jdt.core.prefs14
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/META-INF/MANIFEST.MF5
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/build.properties2
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/Application.java45
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java108
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/src_ant/org/eclipse/equinox/p2/director/app/ant/DirectorTask.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.director/.classpath2
-rw-r--r--bundles/org.eclipse.equinox.p2.director/.settings/org.eclipse.jdt.core.prefs12
-rw-r--r--bundles/org.eclipse.equinox.p2.director/META-INF/MANIFEST.MF5
-rw-r--r--bundles/org.eclipse.equinox.p2.director/build.properties2
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/ApplicablePatchQuery.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/AttachmentHelper.java50
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Explanation.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/OperationGenerator.java100
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/PermissiveSlicer.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java333
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/QueryableArray.java48
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/SimplePlanner.java320
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Slicer.java93
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/TwoTierMap.java354
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/rollback/FormerState.java70
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/provisional/p2/director/ProfileChangeRequest.java124
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/provisional/p2/director/RequestStatus.java24
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/.classpath2
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/.settings/org.eclipse.jdt.core.prefs594
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/META-INF/MANIFEST.MF5
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/build.properties2
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/CachingArtifactRepository.java73
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/DirectoryWatcher.java42
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/EntryAdvice.java26
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.java47
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/.classpath2
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/.settings/org.eclipse.jdt.core.prefs14
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/META-INF/MANIFEST.MF3
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/build.properties2
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ActionManager.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/DebugHelper.java29
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/DownloadManager.java31
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/EngineSession.java47
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/InstallableUnitPhase.java49
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/InstructionParser.java26
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ParameterizedProvisioningAction.java24
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Phase.java66
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/PhaseSet.java22
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Profile.java89
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileMetadataRepository.java13
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileMetadataRepositoryFactory.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileParser.java21
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfilePreferences.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileWriter.java14
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java92
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SurrogateProfileHandler.java43
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/TouchpointManager.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CertificateChecker.java16
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CheckTrust.java18
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Collect.java19
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Configure.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Install.java39
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Property.java30
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Sizing.java25
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Unconfigure.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Uninstall.java40
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/DefaultPhaseSet.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/IProfile.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/IProfileRegistry.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/IProvisioningPlan.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/ISurrogateProfileHandler.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/MissingAction.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/ProvisioningContext.java22
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/ProvisioningPlan.java35
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/spi/Memento.java18
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/spi/ProvisioningAction.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/spi/Touchpoint.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.extensionlocation/.classpath2
-rw-r--r--bundles/org.eclipse.equinox.p2.extensionlocation/.settings/org.eclipse.jdt.core.prefs14
-rw-r--r--bundles/org.eclipse.equinox.p2.extensionlocation/META-INF/MANIFEST.MF5
-rw-r--r--bundles/org.eclipse.equinox.p2.extensionlocation/build.properties2
-rw-r--r--bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/BundlePoolFilteredListener.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepository.java17
-rw-r--r--bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepositoryFactory.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepository.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepositoryFactory.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/SiteListener.java40
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/provisional/p2/metadata/generator/Generator.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/.classpath2
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/.settings/org.eclipse.jdt.core.prefs14
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/META-INF/MANIFEST.MF4
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/build.properties2
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CacheManager.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepository.java28
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepositoryFactory.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/IUMap.java34
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/LocalMetadataRepository.java23
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/MetadataRepositoryIO.java14
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/MetadataRepositoryManager.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/URLMetadataRepository.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataParser.java168
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataWriter.java98
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/metadata/repository/AbstractMetadataRepository.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/metadata/repository/MetadataRepositoryFactory.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/metadata/repository/SimpleMetadataRepositoryFactory.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/CreateCompositeMetadataRepositoryTask.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/.classpath4
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/.settings/org.eclipse.jdt.core.prefs16
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/META-INF/MANIFEST.MF5
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/build.properties2
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/ArtifactKey.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/BasicVersion.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/IRequiredCapability.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/InstallableUnit.java79
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/InstallableUnitFragment.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/InstallableUnitPatch.java16
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/LDAPQuery.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/OSGiVersion.java21
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/OmniVersion.java18
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/RequiredCapability.java15
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/ResolvedInstallableUnit.java128
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/TouchpointData.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/TouchpointInstruction.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/TranslationSupport.java67
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/VersionFormat.java74
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/VersionFormatParser.java94
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/VersionParser.java24
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/VersionVector.java57
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/IInstallableUnitPatch.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/ITouchpointData.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/MetadataFactory.java70
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/Version.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/Collector.java42
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/CompoundQuery.java86
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/CompoundQueryable.java44
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/ContextQuery.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/ICompositeQuery.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/IMatchQuery.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/IQueryable.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/IUPropertyQuery.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/InstallableUnitQuery.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/LatestIUVersionQuery.java23
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/LimitQuery.java24
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/MatchQuery.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/ObjectMatchQuery.java20
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/PipedQuery.java29
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/QueryHelpers.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/UpdateQuery.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/IInstallableUnit.java21
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/IRequirement.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/query/CategoryMemberQuery.java18
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/query/CategoryQuery.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/query/FragmentQuery.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/query/GroupQuery.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/query/IQuery.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/query/IQueryResult.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/query/PatchQuery.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/.classpath2
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/.settings/org.eclipse.jdt.core.prefs16
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/META-INF/MANIFEST.MF3
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/build.properties2
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/FileSetDescriptor.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/QuotedTokenizer.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ExecutablesDescriptor.java22
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/eclipse/FeatureManifestParser.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/eclipse/FeatureParser.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/eclipse/IProductDescriptor.java14
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ProductFile.java69
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/swt/tools/IconExe.java6000
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AbstractPublisherAction.java143
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/IPublisherInfo.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/IPublisherResult.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/Publisher.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/PublisherInfo.java16
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/PublisherResult.java88
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/ILicenseAdvice.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/IPropertyAdvice.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/IRootIUAdvice.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/JREAction.java28
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/QueryableFilterAdvice.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/RootFilesAction.java18
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/RootIUAction.java34
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/RootIUAdvice.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/RootIUResultFilterAdvice.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/VersionAdvice.java80
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/AdviceFileAdvice.java28
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/AdviceFileParser.java102
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ApplicationLauncherAction.java31
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/BundlesAction.java122
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ConfigAdvice.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ConfigCUsAction.java71
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/EclipseInstallAction.java18
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/EquinoxExecutableAction.java14
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/EquinoxLauncherCUAction.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/Feature.java21
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/FeaturesAction.java123
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/FeaturesAndBundlesPublisherApplication.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/IBrandingAdvice.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/IConfigAdvice.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/InstallPublisherApplication.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ProductAction.java28
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ProductFileAdvice.java43
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ProductPublisherApplication.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/spi/p2/publisher/LocalizationHelper.java38
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/spi/p2/publisher/PublisherHelper.java19
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/AbstractPublishTask.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/FeaturesAndBundlesPublisherTask.java16
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/ProductPublisherTask.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/.classpath2
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/.settings/org.eclipse.jdt.core.prefs15
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/META-INF/MANIFEST.MF5
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/build.properties2
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/Disassembler.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/JarComparator.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/Signature.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/Mirroring.java26
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/AbstractApplication.java43
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/CompositeRepositoryApplication.java21
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/MirrorApplication.java49
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/RecreateRepositoryApplication.java24
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/Repo2Runnable.java40
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/SlicingOptions.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/HostCheckAnalyzer.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/LicenseAnalyzer.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/UniqueIUAnalyzer.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/UnzipFeatureJarAnalyzer.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/repository/tools/analyzer/IUAnalyzer.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/repository/tools/analyzer/RepositoryAnalyzer.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/AbstractRepositoryTask.java29
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/CompositeRepositoryTask.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/IUDescription.java31
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/MirrorTask.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/RemoveIUTask.java28
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/Repo2RunnableTask.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/RepositoryList.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/SlicingOption.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/.classpath2
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/.settings/org.eclipse.jdt.core.prefs14
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/META-INF/MANIFEST.MF3
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/build.properties2
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/CompositeParser.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/CompositeRepositoryState.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/XMLParser.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/XMLWriter.java17
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/CacheManager.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/Credentials.java36
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/ProgressStatistics.java14
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/RepositoryStatusHelper.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java113
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/DebugHelper.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/RepositoryHelper.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/repository/AbstractRepository.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/ICompositeRepository.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/IRepository.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/IRepositoryManager.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/ArtifactDescriptorQuery.java18
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/ArtifactKeyQuery.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/IArtifactDescriptor.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/IArtifactRepository.java24
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/IArtifactRepositoryManager.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/spi/ArtifactDescriptor.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/metadata/IMetadataRepository.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/metadata/IMetadataRepositoryManager.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/All p2 UI tests.launch5
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/AnyRequiredCapabilityTest.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/LatestIUVersionElementWrapperTest.java13
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryableArtifactRepositoryManagerTest.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryableMetadataRepositoryManagerTest.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/.externalToolBuilders/New_Builder.launch11
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/.settings/org.eclipse.jdt.core.prefs2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/META-INF/MANIFEST.MF3
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/build.properties4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractAntProvisioningTest.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java46
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractWrappedArtifactRepository.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/IUPropertyUtils.java18
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestArtifactRepository.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/MirrorTaskTest.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/Repo2RunnableTaskTests.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/Bug265577.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MD5Tests.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorRequestTest.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/SimpleArtifactRepositoryTest.java93
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/AggregateQueryTest.java28
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/CompoundQueryableTest.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/QueryTest.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/OperationGenerationTest.java129
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/directorywatcher/RepositoryListenerTest.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/directorywatcher/TestRepositoryWatcher.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/EngineTest.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/InstructionParserTest.java45
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/PhaseTest.java18
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfileRegistryTest.java13
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfileTest.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/generator/PatchIUGeneration.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/FragmentMethodTest.java41
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/FragmentTest.java38
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPatchPersistenceTest.java34
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPersistenceTest.java46
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/MultipleIUAndFragmentTest.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/CompositeMetadataRepositoryTest.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java106
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/ArtifactMirrorApplicationTest.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/NewMirrorApplicationArtifactTest.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AdditionalConstraints.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/NonMinimalState.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/TestArtifactRepository.java58
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AbstractPublisherActionTest.java48
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AccumulateConfigDataActionTest.java14
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ActionTest.java26
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AdviceFileParserTest.java110
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/BundlesActionTest.java32
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ConfigCUsActionTest.java15
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/DefaultCUsActionTest.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxExecutableActionTest.java29
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxLauncherCUActionTest.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/FeaturesActionTest.java38
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/JREActionTest.java14
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/LocalUpdateSiteActionTest.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTest.java14
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionWithAdviceFileTest.java15
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductFileAdviceTest.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductFileTest.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/RootFilesActionTest.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/RootIUActionTest.java15
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/EvaluatorTest.java62
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/PerformanceTest.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/TestQueryReimplementation.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/CollectActionTest.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/EclipseTouchpointTest.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/UtilTest.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/CollectActionTest.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/SiteXMLActionTest.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/UpdateSiteTest.java15
-rw-r--r--bundles/org.eclipse.equinox.p2.testserver/META-INF/MANIFEST.MF3
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/.classpath2
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/.settings/org.eclipse.jdt.core.prefs14
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/META-INF/MANIFEST.MF3
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/build.properties2
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/AggregatedBundleRepository.java52
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/EclipseMarkSetProvider.java41
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/EclipseTouchpoint.java38
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/PlatformConfigurationWrapper.java16
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/SourceManipulator.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java35
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddJVMArgumentAction.java13
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddProgramArgumentAction.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddRepositoryAction.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddSourceBundleAction.java18
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/CheckTrustAction.java16
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/ChmodAction.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/CollectAction.java37
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/InstallBundleAction.java18
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/InstallFeatureAction.java18
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/LinkAction.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/MarkStartedAction.java17
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveJVMArgumentAction.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveProgramArgumentAction.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveRepositoryAction.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveSourceBundleAction.java18
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RepositoryAction.java14
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetLauncherNameAction.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetProgramPropertyAction.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetStartLevelAction.java17
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/UninstallBundleAction.java19
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/UninstallFeatureAction.java18
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/Configuration.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/ConfigurationCache.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/ConfigurationParser.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/ConfigurationWriter.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/Site.java16
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/XMLWriter.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/p2/touchpoint/eclipse/query/OSGiBundleQuery.java17
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/.classpath4
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/.settings/org.eclipse.jdt.core.prefs16
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/META-INF/MANIFEST.MF5
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/build.properties2
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/BackupStore.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/NativeTouchpoint.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/Util.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/ChmodAction.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CleanupcopyAction.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CleanupzipAction.java20
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CollectAction.java18
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CopyAction.java14
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/LinkAction.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/MkdirAction.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/RemoveAction.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/RmdirAction.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/UnzipAction.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/.classpath4
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/.settings/org.eclipse.jdt.core.prefs16
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/META-INF/MANIFEST.MF3
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/build.properties5
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/AddProfileJob.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/MetadataRepositoriesView.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/ProfileFactory.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/ProfilesView.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/ProvView.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/RepositoriesView.java20
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/AddProfileDialog.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/IUGroup.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/IUImplementationGroup.java24
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/IUImplementationPropertyPage.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/ProfileGroup.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/ProfilePropertyPage.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/RepositoryImplementationPropertyPage.java14
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/.classpath4
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/.settings/org.eclipse.jdt.core.prefs15
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/META-INF/MANIFEST.MF3
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/build.properties2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ElementQueryDescriptor.java23
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ElementWrapper.java13
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUI.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIAdapterFactory.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryProvider.java70
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableArtifactRepositoryManager.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableMetadataRepositoryManager.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableRepositoryManager.java55
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/RepositoryLocationQuery.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/UpdateManagerCompatibility.java34
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/ColocatedRepositoryAction.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/ExistingIUInProfileAction.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/InstallAction.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/ProfileModificationAction.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/UpdateAction.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/AvailableIUGroup.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ComboAutoCompleteField.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ContainerCheckedTreeViewer.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/DelayedFilterCheckboxTree.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/IUPropertyPage.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/InstallWizard.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/PreselectedIUInstallWizard.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ProvisioningOperationWizard.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositorySelectionGroup.java16
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionResultsWizardPage.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/SelectableIUsPage.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/SizeComputingWizardPage.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UninstallWizard.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UninstallWizardPage.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UpdateWizard.java16
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ArtifactElement.java1
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ArtifactRepositoryElement.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/AvailableIUElement.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/CategoryElement.java22
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ElementUtils.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/IIUElement.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/IRepositoryElement.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/InstalledIUElement.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/MetadataRepositoryElement.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ProfileElement.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ProvElement.java1
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/QueriedElement.java15
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/QueriedElementWrapper.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/RollbackProfileElement.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/ArtifactRepositoryElementWrapper.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/AvailableIUWrapper.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/CategoryElementWrapper.java23
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/InstalledIUElementWrapper.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/MetadataRepositoryElementWrapper.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/QueryableProfileRegistry.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/QueryableUpdates.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/DeferredQueryContentProvider.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/IUComparator.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/IUDetailsLabelProvider.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/IUDragAdapter.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/InstallIUDropAdapter.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/ProvElementComparer.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/ProvElementContentProvider.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/ProvElementLabelProvider.java22
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/RepositoryDetailsLabelProvider.java16
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/AcceptLicensesWizardPage.java30
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/LoadMetadataRepositoryJob.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/Policy.java13
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RepositoryManipulationPage.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RevertProfilePage.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.updatesite/.classpath2
-rw-r--r--bundles/org.eclipse.equinox.p2.updatesite/.settings/org.eclipse.jdt.core.prefs14
-rw-r--r--bundles/org.eclipse.equinox.p2.updatesite/META-INF/MANIFEST.MF3
-rw-r--r--bundles/org.eclipse.equinox.p2.updatesite/build.properties2
-rw-r--r--bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/DefaultSiteParser.java20
-rw-r--r--bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/DigestParser.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/LocalUpdateSiteAction.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/RemoteFeaturesAction.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/RemoteUpdateSiteAction.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteCategory.java20
-rw-r--r--bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteFeature.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteModel.java37
-rw-r--r--bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteXMLAction.java93
-rw-r--r--bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/UpdateSite.java20
-rw-r--r--bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/artifact/UpdateSiteArtifactRepository.java13
-rw-r--r--bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/artifact/UpdateSiteArtifactRepositoryFactory.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepository.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepositoryFactory.java4
539 files changed, 9000 insertions, 9106 deletions
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/.classpath b/bundles/org.eclipse.equinox.p2.artifact.repository/.classpath
index ef379494d..834ea833e 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/.classpath
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <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.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" output="bin_ant" path="src_ant"/>
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
index fc844dcb3..2100382a8 100644
--- 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
@@ -1,4 +1,4 @@
-#Tue Dec 09 10:24:31 EST 2008
+#Tue Dec 22 19:31:57 CET 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
org.eclipse.jdt.core.builder.duplicateResourceTask=warning
@@ -7,17 +7,17 @@ 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.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.compliance=1.5
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.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
org.eclipse.jdt.core.compiler.problem.deadCode=warning
@@ -26,7 +26,7 @@ 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.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
@@ -88,7 +88,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enab
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.compiler.source=1.5
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
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
index 401f48a7f..06f8a61a9 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/META-INF/MANIFEST.MF
@@ -82,12 +82,14 @@ Import-Package: javax.xml.parsers,
org.eclipse.osgi.signedcontent;version="1.0.0",
org.eclipse.osgi.util;version="1.1.0",
org.osgi.framework;version="1.3.0",
+ org.osgi.service.prefs;version="1.1.1",
org.osgi.util.tracker;version="1.4.0",
org.w3c.dom,
org.xml.sax;resolution:=optional
Bundle-Activator: org.eclipse.equinox.internal.p2.artifact.repository.Activator
Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: J2SE-1.4,
+Bundle-RequiredExecutionEnvironment: J2SE-1.5,
+ J2SE-1.4,
CDC-1.1/Foundation-1.1
Require-Bundle: org.eclipse.equinox.common;bundle-version="[3.5.0,4.0.0)",
org.eclipse.equinox.registry,
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/build.properties b/bundles/org.eclipse.equinox.p2.artifact.repository/build.properties
index 6a66d4e05..086499396 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/build.properties
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/build.properties
@@ -14,3 +14,5 @@ src.includes = about.html,\
source.. = src/
source.ant_tasks/artifactRepository-ant.jar = src_ant/
jars.extra.classpath = platform:/plugin/org.apache.ant/lib/ant.jar
+javacTarget=jsr14
+javacSource=1.5 \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/Activator.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/Activator.java
index 2dd357fb1..9302f74ce 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/Activator.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/Activator.java
@@ -23,7 +23,7 @@ public class Activator implements BundleActivator, ServiceTrackerCustomizer {
private static BundleContext context;
private ServiceRegistration repositoryManagerRegistration;
- private static final Map createdManagers = new HashMap();
+ private static final Map<ArtifactRepositoryManager, IProvisioningAgent> createdManagers = new HashMap<ArtifactRepositoryManager, IProvisioningAgent>();
private ServiceTracker agentTracker;
public static BundleContext getContext() {
@@ -53,10 +53,10 @@ public class Activator implements BundleActivator, ServiceTrackerCustomizer {
repositoryManagerRegistration.unregister();
repositoryManagerRegistration = null;
synchronized (createdManagers) {
- for (Iterator it = createdManagers.keySet().iterator(); it.hasNext();) {
- ArtifactRepositoryManager manager = (ArtifactRepositoryManager) it.next();
+ for (Iterator<ArtifactRepositoryManager> it = createdManagers.keySet().iterator(); it.hasNext();) {
+ ArtifactRepositoryManager manager = it.next();
manager.shutdown();
- IProvisioningAgent agent = (IProvisioningAgent) createdManagers.get(manager);
+ IProvisioningAgent agent = createdManagers.get(manager);
agent.unregisterService(IArtifactRepositoryManager.SERVICE_NAME, manager);
}
createdManagers.clear();
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRepositoryManager.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRepositoryManager.java
index 45d3500c8..c4066d7fb 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRepositoryManager.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRepositoryManager.java
@@ -12,7 +12,8 @@
package org.eclipse.equinox.internal.p2.artifact.repository;
import java.net.URI;
-import java.util.*;
+import java.util.HashMap;
+import java.util.Map;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
@@ -30,7 +31,7 @@ import org.eclipse.equinox.p2.repository.artifact.*;
* TODO the current assumption that the "location" is the dir/root limits us to
* having just one repository in a given URL..
*/
-public class ArtifactRepositoryManager extends AbstractRepositoryManager implements IArtifactRepositoryManager {
+public class ArtifactRepositoryManager extends AbstractRepositoryManager<IArtifactKey> implements IArtifactRepositoryManager {
public ArtifactRepositoryManager() {
super();
@@ -40,11 +41,11 @@ public class ArtifactRepositoryManager extends AbstractRepositoryManager impleme
super.addRepository(repository, true, null);
}
- public IArtifactRequest createMirrorRequest(IArtifactKey key, IArtifactRepository destination, Properties destinationDescriptorProperties, Properties destinationRepositoryProperties) {
+ public IArtifactRequest createMirrorRequest(IArtifactKey key, IArtifactRepository destination, Map<String, String> destinationDescriptorProperties, Map<String, String> destinationRepositoryProperties) {
return new MirrorRequest(key, destination, destinationDescriptorProperties, destinationRepositoryProperties);
}
- public IArtifactRepository createRepository(URI location, String name, String type, Map properties) throws ProvisionException {
+ public IArtifactRepository createRepository(URI location, String name, String type, Map<String, String> properties) throws ProvisionException {
return (IArtifactRepository) doCreateRepository(location, name, type, properties);
}
@@ -52,7 +53,7 @@ public class ArtifactRepositoryManager extends AbstractRepositoryManager impleme
return (IArtifactRepository) basicGetRepository(location);
}
- protected IRepository factoryCreate(URI location, String name, String type, Map properties, IExtension extension) throws ProvisionException {
+ protected IRepository<IArtifactKey> factoryCreate(URI location, String name, String type, Map<String, String> properties, IExtension extension) throws ProvisionException {
ArtifactRepositoryFactory factory = (ArtifactRepositoryFactory) createExecutableExtension(extension, EL_FACTORY);
if (factory == null)
return null;
@@ -60,7 +61,7 @@ public class ArtifactRepositoryManager extends AbstractRepositoryManager impleme
return factory.create(location, name, type, properties);
}
- protected IRepository factoryLoad(URI location, IExtension extension, int flags, SubMonitor monitor) throws ProvisionException {
+ protected IRepository<IArtifactKey> factoryLoad(URI location, IExtension extension, int flags, SubMonitor monitor) throws ProvisionException {
ArtifactRepositoryFactory factory = (ArtifactRepositoryFactory) createExecutableExtension(extension, EL_FACTORY);
if (factory == null)
return null;
@@ -123,7 +124,7 @@ public class ArtifactRepositoryManager extends AbstractRepositoryManager impleme
LogHelper.log(new Status(IStatus.ERROR, Activator.ID, "Error occurred while loading download cache.", e)); //$NON-NLS-1$
}
try {
- Map properties = new HashMap(1);
+ Map<String, String> properties = new HashMap<String, String>(1);
properties.put(IRepository.PROP_SYSTEM, Boolean.TRUE.toString());
createRepository(cacheLocation, "download cache", TYPE_SIMPLE_REPOSITORY, properties); //$NON-NLS-1$
} catch (ProvisionException e) {
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepository.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepository.java
index 5b05cf8d9..1083d302e 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepository.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepository.java
@@ -35,7 +35,7 @@ import org.eclipse.equinox.p2.repository.IRepository;
import org.eclipse.equinox.p2.repository.artifact.*;
import org.eclipse.osgi.util.NLS;
-public class CompositeArtifactRepository extends AbstractArtifactRepository implements IArtifactRepository, ICompositeRepository {
+public class CompositeArtifactRepository extends AbstractArtifactRepository implements ICompositeRepository<IArtifactKey> {
static final public String REPOSITORY_TYPE = CompositeArtifactRepository.class.getName();
static final private Integer REPOSITORY_VERSION = new Integer(1);
@@ -46,9 +46,9 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
// keep a list of the child URIs. they can be absolute or relative. they may or may not point
// to a valid reachable repo
- private List childrenURIs = new ArrayList();
+ private List<URI> childrenURIs = new ArrayList<URI>();
// keep a list of the repositories that we have successfully loaded
- private List loadedRepos = new ArrayList();
+ private List<ChildInfo> loadedRepos = new ArrayList<ChildInfo>();
private IArtifactRepositoryManager manager;
/**
@@ -94,7 +94,7 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
addChild(state.getChildren()[i], false);
}
- CompositeArtifactRepository(IArtifactRepositoryManager manager, URI location, String repositoryName, Map properties) {
+ CompositeArtifactRepository(IArtifactRepositoryManager manager, URI location, String repositoryName, Map<String, String> properties) {
super(repositoryName, REPOSITORY_TYPE, REPOSITORY_VERSION.toString(), location, null, null, properties);
this.manager = manager;
save();
@@ -114,7 +114,7 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
result.setProvider(getProvider());
result.setProperties(getProperties());
// it is important to directly access the field so we have the relative URIs
- result.setChildren((URI[]) childrenURIs.toArray(new URI[childrenURIs.size()]));
+ result.setChildren(childrenURIs.toArray(new URI[childrenURIs.size()]));
return result;
}
@@ -123,7 +123,7 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
* in it. Return a boolean value indicating whether or not the object was
* actually added.
*/
- private static boolean add(List list, Object obj) {
+ private static <T> boolean add(List<T> list, T obj) {
return list.contains(obj) ? false : list.add(obj);
}
@@ -201,8 +201,8 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
if (removed) {
// we removed the child from the list so remove the associated repo object as well
ChildInfo found = null;
- for (Iterator iter = loadedRepos.iterator(); found == null && iter.hasNext();) {
- ChildInfo current = (ChildInfo) iter.next();
+ for (Iterator<ChildInfo> iter = loadedRepos.iterator(); found == null && iter.hasNext();) {
+ ChildInfo current = iter.next();
URI repoLocation = current.repo.getLocation();
if (URIUtil.sameURI(childURI, repoLocation))
found = current;
@@ -221,10 +221,10 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
save();
}
- public List getChildren() {
- List result = new ArrayList();
- for (Iterator iter = childrenURIs.iterator(); iter.hasNext();)
- result.add(URIUtil.makeAbsolute((URI) iter.next(), location));
+ public List<URI> getChildren() {
+ List<URI> result = new ArrayList<URI>();
+ for (Iterator<URI> iter = childrenURIs.iterator(); iter.hasNext();)
+ result.add(URIUtil.makeAbsolute(iter.next(), location));
return result;
}
@@ -273,8 +273,8 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
}
public boolean contains(IArtifactKey key) {
- for (Iterator repositoryIterator = loadedRepos.iterator(); repositoryIterator.hasNext();) {
- ChildInfo current = (ChildInfo) repositoryIterator.next();
+ for (Iterator<ChildInfo> repositoryIterator = loadedRepos.iterator(); repositoryIterator.hasNext();) {
+ ChildInfo current = repositoryIterator.next();
if (current.isGood() && current.repo.contains(key))
return true;
}
@@ -282,8 +282,8 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
}
public boolean contains(IArtifactDescriptor descriptor) {
- for (Iterator repositoryIterator = loadedRepos.iterator(); repositoryIterator.hasNext();) {
- ChildInfo current = (ChildInfo) repositoryIterator.next();
+ for (Iterator<ChildInfo> repositoryIterator = loadedRepos.iterator(); repositoryIterator.hasNext();) {
+ ChildInfo current = repositoryIterator.next();
if (current.isGood() && current.repo.contains(descriptor))
return true;
}
@@ -291,23 +291,23 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
}
public IArtifactDescriptor[] getArtifactDescriptors(IArtifactKey key) {
- ArrayList result = new ArrayList();
- for (Iterator repositoryIterator = loadedRepos.iterator(); repositoryIterator.hasNext();) {
- ChildInfo current = (ChildInfo) repositoryIterator.next();
+ ArrayList<IArtifactDescriptor> result = new ArrayList<IArtifactDescriptor>();
+ for (Iterator<ChildInfo> repositoryIterator = loadedRepos.iterator(); repositoryIterator.hasNext();) {
+ ChildInfo current = repositoryIterator.next();
if (current.isGood()) {
IArtifactDescriptor[] tempResult = current.repo.getArtifactDescriptors(key);
for (int i = 0; i < tempResult.length; i++)
add(result, tempResult[i]);
}
}
- return (IArtifactDescriptor[]) result.toArray(new IArtifactDescriptor[result.size()]);
+ return result.toArray(new IArtifactDescriptor[result.size()]);
}
public IStatus getArtifacts(IArtifactRequest[] requests, IProgressMonitor monitor) {
SubMonitor subMonitor = SubMonitor.convert(monitor, requests.length);
MultiStatus multiStatus = new MultiStatus(Activator.ID, IStatus.OK, Messages.message_childrenRepos, null);
- for (Iterator repositoryIterator = loadedRepos.iterator(); repositoryIterator.hasNext() && requests.length > 0;) {
- IArtifactRepository current = ((ChildInfo) repositoryIterator.next()).repo;
+ for (Iterator<ChildInfo> repositoryIterator = loadedRepos.iterator(); repositoryIterator.hasNext() && requests.length > 0;) {
+ IArtifactRepository current = repositoryIterator.next().repo;
IArtifactRequest[] applicable = getRequestsForRepository(current, requests);
IStatus dlStatus = current.getArtifacts(applicable, subMonitor.newChild(requests.length));
multiStatus.add(dlStatus);
@@ -331,8 +331,8 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
}
private IStatus getRawOrNormalArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor, boolean raw) {
- for (Iterator childIterator = loadedRepos.iterator(); childIterator.hasNext();) {
- ChildInfo current = (ChildInfo) childIterator.next();
+ for (Iterator<ChildInfo> childIterator = loadedRepos.iterator(); childIterator.hasNext();) {
+ ChildInfo current = childIterator.next();
if (current.isGood() && current.repo.contains(descriptor)) {
// Child hasn't failed & contains descriptor
IStatus status = raw ? current.repo.getRawArtifact(descriptor, destination, monitor) : current.repo.getArtifact(descriptor, destination, monitor);
@@ -358,7 +358,7 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
}
private IArtifactRequest[] filterUnfetched(IArtifactRequest[] requests) {
- ArrayList filteredRequests = new ArrayList();
+ ArrayList<IArtifactRequest> filteredRequests = new ArrayList<IArtifactRequest>();
for (int i = 0; i < requests.length; i++) {
if (requests[i].getResult() == null || !requests[i].getResult().isOK()) {
filteredRequests.add(requests[i]);
@@ -371,18 +371,18 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
}
private IArtifactRequest[] getRequestsForRepository(IArtifactRepository repository, IArtifactRequest[] requests) {
- ArrayList applicable = new ArrayList();
+ ArrayList<IArtifactRequest> applicable = new ArrayList<IArtifactRequest>();
for (int i = 0; i < requests.length; i++) {
if (repository.contains(requests[i].getArtifactKey()))
applicable.add(requests[i]);
}
- return (IArtifactRequest[]) applicable.toArray(new IArtifactRequest[applicable.size()]);
+ return applicable.toArray(new IArtifactRequest[applicable.size()]);
}
private void save() {
if (!isModifiable())
return;
- boolean compress = "true".equalsIgnoreCase((String) properties.get(PROP_COMPRESSED)); //$NON-NLS-1$
+ boolean compress = "true".equalsIgnoreCase(properties.get(PROP_COMPRESSED)); //$NON-NLS-1$
OutputStream os = null;
try {
URI actualLocation = getActualLocation(location, false);
@@ -441,8 +441,8 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
*/
private boolean isSane(IArtifactRepository toCheckRepo, String comparatorID) {
IArtifactComparator comparator = ArtifactComparatorFactory.getArtifactComparator(comparatorID);
- for (Iterator repositoryIterator = loadedRepos.iterator(); repositoryIterator.hasNext();) {
- IArtifactRepository current = ((ChildInfo) repositoryIterator.next()).repo;
+ for (Iterator<ChildInfo> repositoryIterator = loadedRepos.iterator(); repositoryIterator.hasNext();) {
+ IArtifactRepository current = repositoryIterator.next().repo;
if (!current.equals(toCheckRepo)) {
if (!isSane(toCheckRepo, current, comparator))
return false;
@@ -455,9 +455,9 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
* Check the two given repositories against each other using the given comparator.
*/
private boolean isSane(IArtifactRepository one, IArtifactRepository two, IArtifactComparator comparator) {
- IQueryResult toCheckKeys = one.query(ArtifactKeyQuery.ALL_KEYS, null);
- for (Iterator iterator = toCheckKeys.iterator(); iterator.hasNext();) {
- IArtifactKey key = (IArtifactKey) iterator.next();
+ IQueryResult<IArtifactKey> toCheckKeys = one.query(ArtifactKeyQuery.ALL_KEYS, null);
+ for (Iterator<IArtifactKey> iterator = toCheckKeys.iterator(); iterator.hasNext();) {
+ IArtifactKey key = iterator.next();
if (!two.contains(key))
continue;
IArtifactDescriptor[] toCheckDescriptors = one.getArtifactDescriptors(key);
@@ -489,7 +489,7 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
*/
public boolean validate(String comparatorID) {
IArtifactComparator comparator = ArtifactComparatorFactory.getArtifactComparator(comparatorID);
- ChildInfo[] repos = (ChildInfo[]) loadedRepos.toArray(new ChildInfo[loadedRepos.size()]);
+ ChildInfo[] repos = loadedRepos.toArray(new ChildInfo[loadedRepos.size()]);
for (int outer = 0; outer < repos.length; outer++) {
for (int inner = outer + 1; inner < repos.length; inner++) {
if (!isSane(repos[outer].repo, repos[inner].repo, comparator))
@@ -516,15 +516,29 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
}
}
- public IQueryResult query(IQuery query, IProgressMonitor monitor) {
+ public IQueryResult<IArtifactKey> query(IQuery<IArtifactKey> query, IProgressMonitor monitor) {
// Query all the all the repositories this composite repo contains
- List repos = new ArrayList();
- for (Iterator repositoryIterator = loadedRepos.iterator(); repositoryIterator.hasNext();) {
- ChildInfo info = (ChildInfo) repositoryIterator.next();
+ List<IArtifactRepository> repos = new ArrayList<IArtifactRepository>();
+ for (Iterator<ChildInfo> repositoryIterator = loadedRepos.iterator(); repositoryIterator.hasNext();) {
+ ChildInfo info = repositoryIterator.next();
if (info.isGood())
repos.add(info.repo);
}
- CompoundQueryable queryable = new CompoundQueryable((IQueryable[]) repos.toArray(new IQueryable[repos.size()]));
+ @SuppressWarnings("unchecked")
+ CompoundQueryable<IArtifactKey> queryable = new CompoundQueryable<IArtifactKey>(repos.toArray(new IQueryable[repos.size()]));
return queryable.query(query, monitor);
}
+
+ public IQueryable<IArtifactDescriptor> descriptorQueryable() {
+ // Query all the all the repositories this composite repo contains
+ List<IQueryable<IArtifactDescriptor>> repos = new ArrayList<IQueryable<IArtifactDescriptor>>();
+ for (Iterator<ChildInfo> repositoryIterator = loadedRepos.iterator(); repositoryIterator.hasNext();) {
+ ChildInfo info = repositoryIterator.next();
+ if (info.isGood())
+ repos.add(info.repo.descriptorQueryable());
+ }
+ @SuppressWarnings("unchecked")
+ CompoundQueryable<IArtifactDescriptor> queryable = new CompoundQueryable<IArtifactDescriptor>(repos.toArray(new IQueryable[repos.size()]));
+ return queryable;
+ }
}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepositoryFactory.java
index c5a2deb75..76cda1679 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepositoryFactory.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepositoryFactory.java
@@ -124,7 +124,7 @@ public class CompositeArtifactRepositoryFactory extends ArtifactRepositoryFactor
}
}
- public IArtifactRepository create(URI location, String name, String type, Map properties) {
+ public IArtifactRepository create(URI location, String name, String type, Map<String, String> properties) {
return new CompositeArtifactRepository(getManager(), location, name, properties);
}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorRequest.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorRequest.java
index bdcdf0da7..ff2f42237 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorRequest.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorRequest.java
@@ -13,7 +13,8 @@
package org.eclipse.equinox.internal.p2.artifact.repository;
import java.io.*;
-import java.util.Properties;
+import java.util.HashMap;
+import java.util.Map;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactDescriptor;
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.ProcessingStepHandler;
@@ -31,24 +32,24 @@ import org.eclipse.osgi.util.NLS;
public class MirrorRequest extends ArtifactRequest {
protected final IArtifactRepository target;
- private final Properties targetDescriptorProperties;
- private final Properties targetRepositoryProperties;
+ private final Map<String, String> targetDescriptorProperties;
+ private final Map<String, String> targetRepositoryProperties;
protected IArtifactDescriptor descriptor;
- public MirrorRequest(IArtifactKey key, IArtifactRepository targetRepository, Properties targetDescriptorProperties, Properties targetRepositoryProperties) {
+ public MirrorRequest(IArtifactKey key, IArtifactRepository targetRepository, Map<String, String> targetDescriptorProperties, Map<String, String> targetRepositoryProperties) {
super(key);
target = targetRepository;
if (targetDescriptorProperties == null || targetDescriptorProperties.isEmpty()) {
this.targetDescriptorProperties = null;
} else {
- this.targetDescriptorProperties = new Properties();
+ this.targetDescriptorProperties = new HashMap<String, String>();
this.targetDescriptorProperties.putAll(targetDescriptorProperties);
}
if (targetRepositoryProperties == null || targetRepositoryProperties.isEmpty()) {
this.targetRepositoryProperties = null;
} else {
- this.targetRepositoryProperties = new Properties();
+ this.targetRepositoryProperties = new HashMap<String, String>();
this.targetRepositoryProperties.putAll(targetRepositoryProperties);
}
}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorSelector.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorSelector.java
index 77b0f05a1..6fb6259de 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorSelector.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorSelector.java
@@ -39,7 +39,7 @@ public class MirrorSelector {
/**
* Encapsulates information about a single mirror
*/
- public static class MirrorInfo implements Comparable {
+ public static class MirrorInfo implements Comparable<MirrorInfo> {
long bytesPerSecond;
int failureCount;
private final int initialRank;
@@ -57,10 +57,7 @@ public class MirrorSelector {
/**
* Comparison used to sort mirrors.
*/
- public int compareTo(Object o) {
- if (!(o instanceof MirrorInfo))
- return 0;
- MirrorInfo that = (MirrorInfo) o;
+ public int compareTo(MirrorInfo that) {
//less failures is better
if (this.failureCount != that.failureCount)
return this.failureCount - that.failureCount;
@@ -91,7 +88,7 @@ public class MirrorSelector {
MirrorInfo[] mirrors;
- private final IRepository repository;
+ private final IRepository<?> repository;
private final Random random = new Random();
@@ -100,10 +97,10 @@ public class MirrorSelector {
* not contacted and the mirrorsURL document is not parsed until a
* mirror location request is sent.
*/
- public MirrorSelector(IRepository repository) {
+ public MirrorSelector(IRepository<?> repository) {
this.repository = repository;
try {
- String base = (String) repository.getProperties().get(IRepository.PROP_MIRRORS_BASE_URL);
+ String base = repository.getProperties().get(IRepository.PROP_MIRRORS_BASE_URL);
if (base != null) {
this.baseURI = new URI(base);
} else {
@@ -204,7 +201,7 @@ public class MirrorSelector {
private MirrorInfo[] initMirrors(IProgressMonitor monitor) {
if (mirrors != null)
return mirrors;
- String mirrorsURL = (String) repository.getProperties().get(IRepository.PROP_MIRRORS_URL);
+ String mirrorsURL = repository.getProperties().get(IRepository.PROP_MIRRORS_URL);
if (mirrorsURL != null)
mirrors = computeMirrors(mirrorsURL, monitor);
return mirrors;
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/SignatureVerifier.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/SignatureVerifier.java
index 55330678a..2108b52f4 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/SignatureVerifier.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/SignatureVerifier.java
@@ -78,7 +78,7 @@ public class SignatureVerifier extends ProcessingStep {
} catch (GeneralSecurityException e) {
return new Status(IStatus.ERROR, Activator.ID, Messages.SignatureVerification_failedRead + inputFile, e);
}
- ArrayList allStatus = new ArrayList(0);
+ ArrayList<IStatus> allStatus = new ArrayList<IStatus>(0);
SignedContentEntry[] entries = signedContent.getSignedEntries();
for (int i = 0; i < entries.length; i++)
try {
@@ -90,7 +90,7 @@ public class SignatureVerifier extends ProcessingStep {
break;
}
if (allStatus.size() > 0)
- return new MultiStatus(Activator.ID, IStatus.ERROR, (IStatus[]) allStatus.toArray(new IStatus[allStatus.size()]), Messages.SignatureVerification_invalidFileContent + inputFile, null);
+ return new MultiStatus(Activator.ID, IStatus.ERROR, allStatus.toArray(new IStatus[allStatus.size()]), Messages.SignatureVerification_invalidFileContent + inputFile, null);
return Status.OK_STATUS;
}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/BlobStore.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/BlobStore.java
index e3697cbee..cd795e85f 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/BlobStore.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/BlobStore.java
@@ -93,9 +93,9 @@ public class BlobStore {
/**
* Delete all of the blobs in the given set.
*/
- public void deleteBlobs(Set set) {
- for (Iterator i = set.iterator(); i.hasNext();)
- deleteBlob((byte[]) i.next());
+ public void deleteBlobs(Set<byte[]> set) {
+ for (Iterator<byte[]> i = set.iterator(); i.hasNext();)
+ deleteBlob(i.next());
}
public URI fileFor(byte[] uuid) {
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/DownloadJob.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/DownloadJob.java
index 6ef140ac3..69aee86ef 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/DownloadJob.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/DownloadJob.java
@@ -18,7 +18,7 @@ import org.eclipse.equinox.p2.repository.artifact.IArtifactRequest;
public class DownloadJob extends Job {
static final Object FAMILY = new Object();
- private LinkedList requestsPending;
+ private LinkedList<IArtifactRequest> requestsPending;
private SimpleArtifactRepository repository;
private IProgressMonitor masterMonitor;
private MultiStatus overallStatus;
@@ -28,7 +28,7 @@ public class DownloadJob extends Job {
setSystem(true);
}
- void initialize(SimpleArtifactRepository repository, LinkedList requestsPending, IProgressMonitor masterMonitor, MultiStatus overallStatus) {
+ void initialize(SimpleArtifactRepository repository, LinkedList<IArtifactRequest> requestsPending, IProgressMonitor masterMonitor, MultiStatus overallStatus) {
this.repository = repository;
this.requestsPending = requestsPending;
this.masterMonitor = masterMonitor;
@@ -53,7 +53,7 @@ public class DownloadJob extends Job {
synchronized (requestsPending) {
if (requestsPending.isEmpty())
break;
- request = (IArtifactRequest) requestsPending.removeFirst();
+ request = requestsPending.removeFirst();
}
if (masterMonitor.isCanceled())
return Status.CANCEL_STATUS;
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/Mapper.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/Mapper.java
index de962a7c7..a6a3f8780 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/Mapper.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/Mapper.java
@@ -53,7 +53,7 @@ public class Mapper {
public URI map(URI repositoryLocation, String classifier, String id, String version, String format) {
String locationString = URIUtil.toUnencodedString(repositoryLocation);
- Dictionary values = new Hashtable(5);
+ Dictionary<String, Object> values = new Hashtable<String, Object>(5);
if (repositoryLocation != null)
values.put(REPOURL, locationString);
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactDescriptor.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactDescriptor.java
index 23b3e6b70..e458813ee 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactDescriptor.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactDescriptor.java
@@ -19,7 +19,7 @@ import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor;
public class SimpleArtifactDescriptor extends ArtifactDescriptor {
public static final String ARTIFACT_REFERENCE = "artifact.reference"; //$NON-NLS-1$
- protected Map repositoryProperties = new OrderedProperties();
+ protected Map<String, String> repositoryProperties = new OrderedProperties();
public SimpleArtifactDescriptor(IArtifactKey key) {
super(key);
@@ -34,7 +34,7 @@ public class SimpleArtifactDescriptor extends ArtifactDescriptor {
}
public String getRepositoryProperty(String propertyKey) {
- return (String) repositoryProperties.get(propertyKey);
+ return repositoryProperties.get(propertyKey);
}
public void setRepositoryProperty(String key, String value) {
@@ -44,7 +44,7 @@ public class SimpleArtifactDescriptor extends ArtifactDescriptor {
repositoryProperties.put(key, value);
}
- public void addRepositoryProperties(Map additionalProperties) {
+ public void addRepositoryProperties(Map<String, String> additionalProperties) {
repositoryProperties.putAll(additionalProperties);
}
@@ -52,7 +52,7 @@ public class SimpleArtifactDescriptor extends ArtifactDescriptor {
* Returns a read-only collection of the repository properties of the artifact descriptor.
* @return the repository properties of this artifact descriptor.
*/
- public Map getRepositoryProperties() {
+ public Map<String, String> getRepositoryProperties() {
return OrderedProperties.unmodifiableProperties(repositoryProperties);
}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java
index 79c5f1f4f..5dd8240b2 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java
@@ -15,6 +15,7 @@ import java.io.*;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.*;
+import java.util.Map.Entry;
import java.util.jar.JarEntry;
import java.util.jar.JarOutputStream;
import org.eclipse.core.runtime.*;
@@ -28,10 +29,10 @@ import org.eclipse.equinox.internal.p2.repository.RepositoryTransport;
import org.eclipse.equinox.internal.p2.repository.Transport;
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.*;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.Collector;
+import org.eclipse.equinox.internal.provisional.p2.metadata.query.IQueryable;
import org.eclipse.equinox.internal.provisional.p2.repository.IStateful;
import org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.AbstractArtifactRepository;
-import org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.MappedCollectionIterator;
+import org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.FlatteningIterator;
import org.eclipse.equinox.p2.metadata.IArtifactKey;
import org.eclipse.equinox.p2.metadata.query.IQuery;
import org.eclipse.equinox.p2.metadata.query.IQueryResult;
@@ -202,11 +203,11 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
static final private Integer REPOSITORY_VERSION = new Integer(1);
private static final String XML_EXTENSION = ".xml"; //$NON-NLS-1$
- protected Set artifactDescriptors = new HashSet();
+ protected Set<SimpleArtifactDescriptor> artifactDescriptors = new HashSet<SimpleArtifactDescriptor>();
/**
* Map<IArtifactKey,List<IArtifactDescriptor>> containing the index of artifacts in the repository.
*/
- protected Map artifactMap = new HashMap();
+ protected Map<IArtifactKey, List<IArtifactDescriptor>> artifactMap = new HashMap<IArtifactKey, List<IArtifactDescriptor>>();
private transient BlobStore blobStore;
transient private Mapper mapper = new Mapper();
@@ -257,19 +258,19 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
/*
* This is only called by the parser when loading a repository.
*/
- SimpleArtifactRepository(String name, String type, String version, String description, String provider, Set artifacts, String[][] mappingRules, Map properties) {
+ SimpleArtifactRepository(String name, String type, String version, String description, String provider, Set<SimpleArtifactDescriptor> artifacts, String[][] mappingRules, Map<String, String> properties) {
super(name, type, version, null, description, provider, properties);
this.artifactDescriptors.addAll(artifacts);
this.mappingRules = mappingRules;
- for (Iterator it = artifactDescriptors.iterator(); it.hasNext();)
- mapDescriptor((IArtifactDescriptor) it.next());
+ for (Iterator<SimpleArtifactDescriptor> it = artifactDescriptors.iterator(); it.hasNext();)
+ mapDescriptor(it.next());
}
private void mapDescriptor(IArtifactDescriptor descriptor) {
IArtifactKey key = descriptor.getArtifactKey();
- Collection descriptors = (Collection) artifactMap.get(key);
+ List<IArtifactDescriptor> descriptors = artifactMap.get(key);
if (descriptors == null) {
- descriptors = new ArrayList();
+ descriptors = new ArrayList<IArtifactDescriptor>();
artifactMap.put(key, descriptors);
}
descriptors.add(descriptor);
@@ -277,7 +278,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
private void unmapDescriptor(IArtifactDescriptor descriptor) {
IArtifactKey key = descriptor.getArtifactKey();
- Collection descriptors = (Collection) artifactMap.get(key);
+ List<IArtifactDescriptor> descriptors = artifactMap.get(key);
if (descriptors == null)
return;
@@ -286,13 +287,13 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
artifactMap.remove(key);
}
- public SimpleArtifactRepository(String repositoryName, URI location, Map properties) {
+ public SimpleArtifactRepository(String repositoryName, URI location, Map<String, String> properties) {
super(repositoryName, REPOSITORY_TYPE, REPOSITORY_VERSION.toString(), location, null, null, properties);
initializeAfterLoad(location);
if (properties != null) {
if (properties.containsKey(PUBLISH_PACK_FILES_AS_SIBLINGS)) {
synchronized (this) {
- String newValue = (String) properties.get(PUBLISH_PACK_FILES_AS_SIBLINGS);
+ String newValue = properties.get(PUBLISH_PACK_FILES_AS_SIBLINGS);
if (Boolean.TRUE.toString().equals(newValue)) {
mappingRules = PACKED_MAPPING_RULES;
} else {
@@ -326,10 +327,10 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
if (isFolderBased(descriptor))
internal.setRepositoryProperty(ARTIFACT_FOLDER, Boolean.TRUE.toString());
if (descriptor instanceof SimpleArtifactDescriptor) {
- Map repoProperties = ((SimpleArtifactDescriptor) descriptor).getRepositoryProperties();
- for (Iterator iterator = repoProperties.keySet().iterator(); iterator.hasNext();) {
- String key = (String) iterator.next();
- internal.setRepositoryProperty(key, (String) repoProperties.get(key));
+ Map<String, String> repoProperties = ((SimpleArtifactDescriptor) descriptor).getRepositoryProperties();
+ for (Iterator<Entry<String, String>> iterator = repoProperties.entrySet().iterator(); iterator.hasNext();) {
+ Entry<String, String> entry = iterator.next();
+ internal.setRepositoryProperty(entry.getKey(), entry.getValue());
}
}
return internal;
@@ -339,7 +340,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
for (int i = 0; i < descriptors.length; i++) {
if (artifactDescriptors.contains(descriptors[i]))
continue;
- ArtifactDescriptor internalDescriptor = createInternalDescriptor(descriptors[i]);
+ SimpleArtifactDescriptor internalDescriptor = createInternalDescriptor(descriptors[i]);
artifactDescriptors.add(internalDescriptor);
mapDescriptor(internalDescriptor);
}
@@ -347,17 +348,17 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
}
private synchronized OutputStream addPostSteps(ProcessingStepHandler handler, IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) {
- ArrayList steps = new ArrayList();
+ ArrayList<ProcessingStep> steps = new ArrayList<ProcessingStep>();
steps.add(new SignatureVerifier());
if (steps.isEmpty())
return destination;
- ProcessingStep[] stepArray = (ProcessingStep[]) steps.toArray(new ProcessingStep[steps.size()]);
+ ProcessingStep[] stepArray = 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();
+ ArrayList<ProcessingStep> steps = new ArrayList<ProcessingStep>();
if (IArtifactDescriptor.TYPE_ZIP.equals(descriptor.getProperty(IArtifactDescriptor.DOWNLOAD_CONTENTTYPE)))
steps.add(new ZipVerifierStep());
if (MD5_CHECK_ENABLED && descriptor.getProperty(IArtifactDescriptor.DOWNLOAD_MD5) != null)
@@ -365,7 +366,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
// Add steps here if needed
if (steps.isEmpty())
return destination;
- ProcessingStep[] stepArray = (ProcessingStep[]) steps.toArray(new ProcessingStep[steps.size()]);
+ ProcessingStep[] stepArray = steps.toArray(new ProcessingStep[steps.size()]);
// TODO should probably be using createAndLink here
return handler.link(stepArray, destination, monitor);
}
@@ -527,6 +528,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
return mirrors.getMirrorLocation(baseLocation, monitor);
}
+ @SuppressWarnings("rawtypes")
public Object getAdapter(Class adapter) {
// if we are adapting to file or writable repositories then make sure we have a file location
if (adapter == IFileArtifactRepository.class)
@@ -556,11 +558,11 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
}
public synchronized IArtifactDescriptor[] getArtifactDescriptors(IArtifactKey key) {
- Collection result = (Collection) artifactMap.get(key);
+ List<IArtifactDescriptor> result = artifactMap.get(key);
if (result == null)
return new IArtifactDescriptor[0];
- return (IArtifactDescriptor[]) result.toArray(new IArtifactDescriptor[result.size()]);
+ return result.toArray(new IArtifactDescriptor[result.size()]);
}
public File getArtifactFile(IArtifactDescriptor descriptor) {
@@ -579,7 +581,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
public IStatus getArtifacts(IArtifactRequest[] requests, IProgressMonitor monitor) {
final MultiStatus overallStatus = new MultiStatus(Activator.ID, IStatus.OK, null, null);
- LinkedList requestsPending = new LinkedList(Arrays.asList(requests));
+ LinkedList<IArtifactRequest> requestsPending = new LinkedList<IArtifactRequest>(Arrays.asList(requests));
int numberOfJobs = Math.min(requests.length, getMaximumThreads());
if (numberOfJobs <= 1 || (!isForceThreading() && isLocal())) {
@@ -619,12 +621,12 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
}
public synchronized IArtifactDescriptor getCompleteArtifactDescriptor(IArtifactKey key) {
- Collection descriptors = (Collection) artifactMap.get(key);
+ List<IArtifactDescriptor> descriptors = artifactMap.get(key);
if (descriptors == null)
return null;
- for (Iterator iterator = descriptors.iterator(); iterator.hasNext();) {
- IArtifactDescriptor desc = (IArtifactDescriptor) iterator.next();
+ for (Iterator<IArtifactDescriptor> iterator = descriptors.iterator(); iterator.hasNext();) {
+ IArtifactDescriptor desc = iterator.next();
// look for a descriptor that matches the key and is "complete"
if (desc.getArtifactKey().equals(key) && desc.getProcessingSteps().length == 0)
return desc;
@@ -632,7 +634,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
return null;
}
- public synchronized Set getDescriptors() {
+ public synchronized Set<SimpleArtifactDescriptor> getDescriptors() {
return artifactDescriptors;
}
@@ -700,7 +702,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
*/
private int getMaximumThreads() {
try {
- String maxThreadString = (String) getProperties().get(PROP_MAX_THREADS);
+ String maxThreadString = getProperties().get(PROP_MAX_THREADS);
if (maxThreadString != null)
return Math.max(1, Integer.parseInt(maxThreadString));
} catch (NumberFormatException nfe) {
@@ -794,8 +796,8 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
this.location = repoLocation;
blobStore = new BlobStore(getBlobStoreLocation(repoLocation), 128);
initializeMapper();
- for (Iterator i = artifactDescriptors.iterator(); i.hasNext();) {
- ((ArtifactDescriptor) i.next()).setRepository(this);
+ for (Iterator<SimpleArtifactDescriptor> i = artifactDescriptors.iterator(); i.hasNext();) {
+ i.next().setRepository(this);
}
}
@@ -839,7 +841,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
}
public synchronized void removeAll() {
- IArtifactDescriptor[] toRemove = (IArtifactDescriptor[]) artifactDescriptors.toArray(new IArtifactDescriptor[artifactDescriptors.size()]);
+ IArtifactDescriptor[] toRemove = artifactDescriptors.toArray(new IArtifactDescriptor[artifactDescriptors.size()]);
boolean changed = false;
for (int i = 0; i < toRemove.length; i++)
changed |= doRemoveArtifact(toRemove[i]);
@@ -903,7 +905,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
}
public void save() {
- boolean compress = "true".equalsIgnoreCase((String) properties.get(PROP_COMPRESSED)); //$NON-NLS-1$
+ boolean compress = "true".equalsIgnoreCase(properties.get(PROP_COMPRESSED)); //$NON-NLS-1$
save(compress);
}
@@ -980,16 +982,17 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
return location.toString();
}
- public synchronized IQueryResult query(IQuery query, IProgressMonitor monitor) {
- if (monitor != null && monitor.isCanceled())
- return Collector.EMPTY_COLLECTOR;
+ public IQueryable<IArtifactDescriptor> descriptorQueryable() {
+ final Collection<List<IArtifactDescriptor>> descs = artifactMap.values();
+ return new IQueryable<IArtifactDescriptor>() {
- boolean excludeKeys = Boolean.TRUE.equals(query.getProperty(IArtifactRepository.QUERY_EXCLUDE_KEYS));
- boolean excludeDescriptors = Boolean.TRUE.equals(query.getProperty(IArtifactRepository.QUERY_EXCLUDE_DESCRIPTORS));
- if (excludeKeys && excludeDescriptors)
- return Collector.EMPTY_COLLECTOR;
+ public IQueryResult<IArtifactDescriptor> query(IQuery<IArtifactDescriptor> query, IProgressMonitor monitor) {
+ return query.perform(new FlatteningIterator<IArtifactDescriptor>(descs.iterator()));
+ }
+ };
+ }
- Iterator iterator = !excludeDescriptors ? new MappedCollectionIterator(artifactMap, !excludeKeys) : artifactMap.keySet().iterator();
- return query.perform(iterator);
+ public IQueryResult<IArtifactKey> query(IQuery<IArtifactKey> query, IProgressMonitor monitor) {
+ return query.perform(artifactMap.keySet().iterator());
}
}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepositoryIO.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepositoryIO.java
index ebc3c0755..b08652d13 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepositoryIO.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepositoryIO.java
@@ -174,11 +174,11 @@ public class SimpleArtifactRepositoryIO {
}
}
- private void writeArtifacts(Set artifactDescriptors) {
+ private void writeArtifacts(Set<SimpleArtifactDescriptor> artifactDescriptors) {
start(ARTIFACTS_ELEMENT);
attribute(COLLECTION_SIZE_ATTRIBUTE, artifactDescriptors.size());
- for (Iterator iter = artifactDescriptors.iterator(); iter.hasNext();) {
- SimpleArtifactDescriptor descriptor = (SimpleArtifactDescriptor) iter.next();
+ for (Iterator<SimpleArtifactDescriptor> iter = artifactDescriptors.iterator(); iter.hasNext();) {
+ SimpleArtifactDescriptor descriptor = iter.next();
IArtifactKey key = descriptor.getArtifactKey();
start(ARTIFACT_ELEMENT);
attribute(ARTIFACT_CLASSIFIER_ATTRIBUTE, key.getClassifier());
@@ -324,9 +324,9 @@ public class SimpleArtifactRepositoryIO {
if (isValidXML()) {
String[][] mappingRules = (mappingRulesHandler == null ? new String[0][0] //
: mappingRulesHandler.getMappingRules());
- Map properties = (propertiesHandler == null ? new OrderedProperties(0) //
+ Map<String, String> properties = (propertiesHandler == null ? new OrderedProperties(0) //
: propertiesHandler.getProperties());
- Set artifacts = (artifactsHandler == null ? new HashSet(0) //
+ Set<SimpleArtifactDescriptor> artifacts = (artifactsHandler == null ? new HashSet<SimpleArtifactDescriptor>(0) //
: artifactsHandler.getArtifacts());
repository = new SimpleArtifactRepository(attrValues[0], attrValues[1], attrValues[2], attrValues[3], //
attrValues[4], artifacts, mappingRules, properties);
@@ -336,18 +336,18 @@ public class SimpleArtifactRepositoryIO {
protected class MappingRulesHandler extends AbstractHandler {
- private List mappingRules;
+ private List<String[]> mappingRules;
public MappingRulesHandler(AbstractHandler parentHandler, Attributes attributes) {
super(parentHandler, MAPPING_RULES_ELEMENT);
String size = parseOptionalAttribute(attributes, COLLECTION_SIZE_ATTRIBUTE);
- mappingRules = (size != null ? new ArrayList(new Integer(size).intValue()) : new ArrayList(4));
+ mappingRules = (size != null ? new ArrayList<String[]>(new Integer(size).intValue()) : new ArrayList<String[]>(4));
}
public String[][] getMappingRules() {
String[][] rules = new String[mappingRules.size()][2];
for (int index = 0; index < mappingRules.size(); index++) {
- String[] ruleAttributes = (String[]) mappingRules.get(index);
+ String[] ruleAttributes = mappingRules.get(index);
rules[index] = ruleAttributes;
}
return rules;
@@ -366,7 +366,7 @@ public class SimpleArtifactRepositoryIO {
private final String[] required = new String[] {MAPPING_RULE_FILTER_ATTRIBUTE, MAPPING_RULE_OUTPUT_ATTRIBUTE};
- public MappingRuleHandler(AbstractHandler parentHandler, Attributes attributes, List mappingRules) {
+ public MappingRuleHandler(AbstractHandler parentHandler, Attributes attributes, List<String[]> mappingRules) {
super(parentHandler, MAPPING_RULE_ELEMENT);
mappingRules.add(parseRequiredAttributes(attributes, required));
}
@@ -378,15 +378,15 @@ public class SimpleArtifactRepositoryIO {
protected class ArtifactsHandler extends AbstractHandler {
- private Set artifacts;
+ private Set<SimpleArtifactDescriptor> artifacts;
public ArtifactsHandler(AbstractHandler parentHandler, Attributes attributes) {
super(parentHandler, ARTIFACTS_ELEMENT);
String size = parseOptionalAttribute(attributes, COLLECTION_SIZE_ATTRIBUTE);
- artifacts = (size != null ? new LinkedHashSet(new Integer(size).intValue()) : new LinkedHashSet(4));
+ artifacts = (size != null ? new LinkedHashSet<SimpleArtifactDescriptor>(new Integer(size).intValue()) : new LinkedHashSet<SimpleArtifactDescriptor>(4));
}
- public Set getArtifacts() {
+ public Set<SimpleArtifactDescriptor> getArtifacts() {
return artifacts;
}
@@ -403,14 +403,14 @@ public class SimpleArtifactRepositoryIO {
private final String[] required = new String[] {ARTIFACT_CLASSIFIER_ATTRIBUTE, ID_ATTRIBUTE, VERSION_ATTRIBUTE};
- private Set artifacts;
+ private Set<SimpleArtifactDescriptor> artifacts;
SimpleArtifactDescriptor currentArtifact = null;
private PropertiesHandler propertiesHandler = null;
private PropertiesHandler repositoryPropertiesHandler = null;
private ProcessingStepsHandler processingStepsHandler = null;
- public ArtifactHandler(AbstractHandler parentHandler, Attributes attributes, Set artifacts) {
+ public ArtifactHandler(AbstractHandler parentHandler, Attributes attributes, Set<SimpleArtifactDescriptor> artifacts) {
super(parentHandler, ARTIFACT_ELEMENT);
this.artifacts = artifacts;
String[] values = parseRequiredAttributes(attributes, required);
@@ -445,7 +445,7 @@ public class SimpleArtifactRepositoryIO {
protected void finished() {
if (isValidXML() && currentArtifact != null) {
- Map properties = (propertiesHandler == null ? new OrderedProperties(0) : propertiesHandler.getProperties());
+ Map<String, String> properties = (propertiesHandler == null ? new OrderedProperties(0) : propertiesHandler.getProperties());
currentArtifact.addProperties(properties);
properties = (repositoryPropertiesHandler == null ? new OrderedProperties(0) : repositoryPropertiesHandler.getProperties());
@@ -461,16 +461,16 @@ public class SimpleArtifactRepositoryIO {
protected class ProcessingStepsHandler extends AbstractHandler {
- private List processingSteps;
+ private List<ProcessingStepDescriptor> processingSteps;
public ProcessingStepsHandler(AbstractHandler parentHandler, Attributes attributes) {
super(parentHandler, PROCESSING_STEPS_ELEMENT);
String size = parseOptionalAttribute(attributes, COLLECTION_SIZE_ATTRIBUTE);
- processingSteps = (size != null ? new ArrayList(new Integer(size).intValue()) : new ArrayList(4));
+ processingSteps = (size != null ? new ArrayList<ProcessingStepDescriptor>(new Integer(size).intValue()) : new ArrayList<ProcessingStepDescriptor>(4));
}
public ProcessingStepDescriptor[] getProcessingSteps() {
- return (ProcessingStepDescriptor[]) processingSteps.toArray(new ProcessingStepDescriptor[processingSteps.size()]);
+ return processingSteps.toArray(new ProcessingStepDescriptor[processingSteps.size()]);
}
public void startElement(String name, Attributes attributes) {
@@ -487,7 +487,7 @@ public class SimpleArtifactRepositoryIO {
private final String[] required = new String[] {ID_ATTRIBUTE, STEP_REQUIRED_ATTRIBUTE};
private final String[] optional = new String[] {STEP_DATA_ATTRIBUTE};
- public ProcessingStepHandler(AbstractHandler parentHandler, Attributes attributes, List processingSteps) {
+ public ProcessingStepHandler(AbstractHandler parentHandler, Attributes attributes, List<ProcessingStepDescriptor> processingSteps) {
super(parentHandler, PROCESSING_STEP_ELEMENT);
String[] attributeValues = parseAttributes(attributes, required, optional);
processingSteps.add(new ProcessingStepDescriptor(attributeValues[0], attributeValues[2], checkBoolean(PROCESSING_STEP_ELEMENT, STEP_REQUIRED_ATTRIBUTE, attributeValues[1]).booleanValue()));
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ProcessingStepHandler.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ProcessingStepHandler.java
index 5faebcdf8..96e31da46 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ProcessingStepHandler.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ProcessingStepHandler.java
@@ -61,11 +61,11 @@ public class ProcessingStepHandler {
public static IStatus getStatus(OutputStream stream, boolean deep) {
if (!deep)
return getStatus(stream);
- ArrayList list = new ArrayList();
+ ArrayList<IStatus> list = new ArrayList<IStatus>();
int severity = collectStatus(stream, list);
if (severity == IStatus.OK)
return Status.OK_STATUS;
- IStatus[] result = (IStatus[]) list.toArray(new IStatus[list.size()]);
+ IStatus[] result = list.toArray(new IStatus[list.size()]);
return new MultiStatus(Activator.ID, severity, result, Messages.processing_step_results, null);
}
@@ -75,15 +75,15 @@ public class ProcessingStepHandler {
* @return the requested status
*/
public static IStatus getErrorStatus(OutputStream stream) {
- ArrayList list = new ArrayList();
+ ArrayList<IStatus> list = new ArrayList<IStatus>();
int severity = collectErrorStatus(stream, list);
if (severity == IStatus.OK)
return Status.OK_STATUS;
- IStatus[] result = (IStatus[]) list.toArray(new IStatus[list.size()]);
+ IStatus[] result = list.toArray(new IStatus[list.size()]);
return new MultiStatus(Activator.ID, 0, result, Messages.processing_step_results, null);
}
- private static int collectErrorStatus(OutputStream stream, ArrayList list) {
+ private static int collectErrorStatus(OutputStream stream, ArrayList<IStatus> list) {
IStatus status = getStatus(stream);
if (!status.isOK())
list.add(status);
@@ -106,7 +106,7 @@ public class ProcessingStepHandler {
return Status.OK_STATUS;
}
- private static int collectStatus(OutputStream stream, ArrayList list) {
+ private static int collectStatus(OutputStream stream, ArrayList<IStatus> list) {
IStatus status = getStatus(stream);
list.add(status);
OutputStream destination = getDestination(stream);
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/AbstractArtifactRepository.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/AbstractArtifactRepository.java
index 1cec5b8e8..78d0444ab 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/AbstractArtifactRepository.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/AbstractArtifactRepository.java
@@ -20,9 +20,9 @@ import org.eclipse.equinox.p2.metadata.IArtifactKey;
import org.eclipse.equinox.p2.repository.artifact.*;
import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor;
-public abstract class AbstractArtifactRepository extends AbstractRepository implements IArtifactRepository {
+public abstract class AbstractArtifactRepository extends AbstractRepository<IArtifactKey> implements IArtifactRepository {
- protected AbstractArtifactRepository(String name, String type, String version, URI location, String description, String provider, Map properties) {
+ protected AbstractArtifactRepository(String name, String type, String version, URI location, String description, String provider, Map<String, String> properties) {
super(name, type, version, location, description, provider, properties);
}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/ArtifactRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/ArtifactRepositoryFactory.java
index 663b772fd..c3225cd91 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/ArtifactRepositoryFactory.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/ArtifactRepositoryFactory.java
@@ -43,7 +43,7 @@ public abstract class ArtifactRepositoryFactory {
* <li>A repository already exists at that location.</li>
* </ul>
*/
- public abstract IArtifactRepository create(URI location, String name, String type, Map properties) throws ProvisionException;
+ public abstract IArtifactRepository create(URI location, String name, String type, Map<String, String> properties) throws ProvisionException;
/**
* Returns the provisioning agent associated with this factory, or <code>null</code>
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/FlatteningIterator.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/FlatteningIterator.java
new file mode 100644
index 000000000..e39968a1f
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/FlatteningIterator.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this 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.provisional.spi.p2.artifact.repository;
+
+import java.util.*;
+
+/**
+ * An iterator over values that are provided by iterating over collections.
+ */
+public class FlatteningIterator<T> implements Iterator<T> {
+ private static final Object NO_ELEMENT = new Object();
+ private final Iterator<? extends Collection<T>> collectionIterator;
+ private Iterator<T> currentIterator;
+
+ private T nextObject = noElement();
+
+ public FlatteningIterator(Iterator<? extends Collection<T>> collectionIterator) {
+ this.collectionIterator = collectionIterator;
+ }
+
+ public boolean hasNext() {
+ return positionNext();
+ }
+
+ public T next() {
+ if (!positionNext())
+ throw new NoSuchElementException();
+
+ T nxt = nextObject;
+ nextObject = noElement();
+ return nxt;
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+
+ private boolean positionNext() {
+ if (nextObject != NO_ELEMENT)
+ return true;
+
+ while (currentIterator == null || !currentIterator.hasNext()) {
+ if (!collectionIterator.hasNext())
+ return false;
+ currentIterator = collectionIterator.next().iterator();
+ }
+ nextObject = currentIterator.next();
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ private static <T> T noElement() {
+ return (T) NO_ELEMENT;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/MappedCollectionIterator.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/MappedCollectionIterator.java
deleted file mode 100644
index 706e523a4..000000000
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/MappedCollectionIterator.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this 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.provisional.spi.p2.artifact.repository;
-
-import java.util.*;
-
-/**
- * An iterator over a Map, For each key we return the key, then the value. If the value is a collection, then
- * instead of returning the value, we iterate over that collection before continuing to the
- * next key.
- */
-public class MappedCollectionIterator implements Iterator {
- private Iterator keys = null;
- private Iterator collection = null;
- private Object nextValue = null;
- private boolean returnKeys = false;
- private Map map = null;
-
- /**
- * @param map - the map to iterate over
- * @param returnKeys - whether or not to include the keys, if false return only values
- */
- public MappedCollectionIterator(Map map, boolean returnKeys) {
- this.map = map;
- this.returnKeys = returnKeys;
- this.keys = map.keySet().iterator();
- }
-
- /**
- * See {@link Iterator#hasNext()}
- */
- public boolean hasNext() {
- if (returnKeys) //keys and values
- return (collection != null && collection.hasNext()) || nextValue != null || keys.hasNext();
-
- //values only
- if (collection != null && collection.hasNext())
- return true;
- while (keys.hasNext()) {
- Object key = keys.next();
- Object value = map.get(key);
- if (value instanceof Collection) {
- collection = ((Collection) value).iterator();
- } else if (value != null) {
- nextValue = value;
- collection = null;
- return true;
- }
- if (collection.hasNext())
- return true;
- }
- return false;
- }
-
- /**
- * See {@link Iterator#next()}
- */
- public Object next() {
- if (nextValue != null) {
- Object next = nextValue;
- nextValue = null;
- return next;
- }
-
- if (returnKeys) {
- if (collection != null && collection.hasNext())
- return collection.next();
-
- Object nextKey = keys.next();
- Object value = map.get(nextKey);
- if (value instanceof Collection)
- collection = ((Collection) value).iterator();
- else if (value != null) {
- nextValue = value;
- collection = null;
- }
- return nextKey;
- }
-
- //values only
- if (collection != null && collection.hasNext())
- return collection.next();
- while (keys.hasNext()) {
- Object key = keys.next();
- Object value = map.get(key);
- if (value instanceof Collection) {
- collection = ((Collection) value).iterator();
- if (!collection.hasNext())
- continue;
- return collection.next();
- } else if (value != null)
- return value;
- }
- throw new NoSuchElementException();
- }
-
- /**
- * Returns true if the iteration contains more keys
- * @return boolean
- */
- public boolean hasNextKey() {
- if (!returnKeys)
- return false;
- return keys.hasNext();
- }
-
- /**
- * Get the next key skipping over any values
- * @return the next key
- * @throws IllegalStateException if this iterator is not returning keys
- */
- public Object nextKey() {
- if (!returnKeys)
- throw new IllegalStateException();
- Object nextKey = keys.next();
- Object value = map.get(nextKey);
- if (value instanceof Collection) {
- collection = ((Collection) value).iterator();
- nextValue = null;
- } else if (value != null) {
- nextValue = value;
- collection = null;
- }
- return nextKey;
- }
-
- /**
- * See {@link Iterator#remove()}
- * This operation is not supported
- * @throws UnsupportedOperationException
- */
- public void remove() {
- throw new UnsupportedOperationException();
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/SimpleArtifactRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/SimpleArtifactRepositoryFactory.java
index 208ff7848..2f372528d 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/SimpleArtifactRepositoryFactory.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/SimpleArtifactRepositoryFactory.java
@@ -122,7 +122,7 @@ public class SimpleArtifactRepositoryFactory extends ArtifactRepositoryFactory {
}
}
- public IArtifactRepository create(URI location, String name, String type, Map properties) {
+ public IArtifactRepository create(URI location, String name, String type, Map<String, String> properties) {
return new SimpleArtifactRepository(name, location, properties);
}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/CreateCompositeArtifactRepositoryTask.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/CreateCompositeArtifactRepositoryTask.java
index cfcc803ec..d6c64b210 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/CreateCompositeArtifactRepositoryTask.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/CreateCompositeArtifactRepositoryTask.java
@@ -34,7 +34,7 @@ public class CreateCompositeArtifactRepositoryTask extends Task {
String name = "Composite Artifact Repository";
boolean compressed = true;
boolean failOnExists = false; // should we fail if a repo already exists?
- Map properties = new HashMap();
+ Map<String, String> properties = new HashMap<String, String>();
/* (non-Javadoc)
* @see org.apache.tools.ant.Task#execute()
diff --git a/bundles/org.eclipse.equinox.p2.common/.classpath b/bundles/org.eclipse.equinox.p2.common/.classpath
index 6f3b481ac..64c5e31b7 100644
--- a/bundles/org.eclipse.equinox.p2.common/.classpath
+++ b/bundles/org.eclipse.equinox.p2.common/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <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.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
diff --git a/bundles/org.eclipse.equinox.p2.common/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.common/.settings/org.eclipse.jdt.core.prefs
index becffc0e3..95c93c13e 100644
--- a/bundles/org.eclipse.equinox.p2.common/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.equinox.p2.common/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,4 @@
-#Thu Nov 19 09:43:53 EST 2009
+#Mon Dec 28 16:50:20 CET 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
org.eclipse.jdt.core.builder.duplicateResourceTask=warning
@@ -7,17 +7,17 @@ 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.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.compliance=1.5
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.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
org.eclipse.jdt.core.compiler.problem.deadCode=warning
@@ -26,7 +26,7 @@ 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.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
@@ -89,7 +89,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enab
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.compiler.source=1.5
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
diff --git a/bundles/org.eclipse.equinox.p2.common/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.common/META-INF/MANIFEST.MF
index cc2444519..81eb9fa2e 100644
--- a/bundles/org.eclipse.equinox.p2.common/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.common/META-INF/MANIFEST.MF
@@ -14,8 +14,9 @@ Import-Package:
org.eclipse.equinox.p2.engine,
org.eclipse.equinox.p2.metadata.query,
org.osgi.framework;version="1.3.0"
-Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
- J2SE-1.4
+Bundle-RequiredExecutionEnvironment: J2SE-1.5,
+ J2SE-1.4,
+ CDC-1.1/Foundation-1.1
Export-Package: org.eclipse.equinox.internal.p2.common;x-internal:=true,
org.eclipse.equinox.p2.common
Require-Bundle: org.eclipse.equinox.common;bundle-version="[3.3.0,4.0)",
diff --git a/bundles/org.eclipse.equinox.p2.common/build.properties b/bundles/org.eclipse.equinox.p2.common/build.properties
index dc77b9c16..ca5030900 100644
--- a/bundles/org.eclipse.equinox.p2.common/build.properties
+++ b/bundles/org.eclipse.equinox.p2.common/build.properties
@@ -15,3 +15,5 @@ bin.includes = META-INF/,\
about.html,\
plugin.properties
src.includes = about.html
+javacTarget=jsr14
+javacSource=1.5
diff --git a/bundles/org.eclipse.equinox.p2.console/.classpath b/bundles/org.eclipse.equinox.p2.console/.classpath
index 7cdeb7319..64c5e31b7 100644
--- a/bundles/org.eclipse.equinox.p2.console/.classpath
+++ b/bundles/org.eclipse.equinox.p2.console/.classpath
@@ -1,7 +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.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
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
index a455b6228..87192e52e 100644
--- 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
@@ -1,4 +1,4 @@
-#Thu Sep 13 22:02:41 EDT 2007
+#Mon Dec 28 17:08:33 CET 2009
eclipse.preferences.version=1
instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
@@ -8,24 +8,24 @@ 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.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.compliance=1.5
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.assertIdentifier=error
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.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
@@ -81,7 +81,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=en
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.compiler.source=1.5
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
@@ -153,7 +153,6 @@ 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
diff --git a/bundles/org.eclipse.equinox.p2.console/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.console/META-INF/MANIFEST.MF
index 40c872b6f..98f1d963b 100644
--- a/bundles/org.eclipse.equinox.p2.console/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.console/META-INF/MANIFEST.MF
@@ -24,5 +24,6 @@ Import-Package: org.eclipse.core.runtime;common=split,
org.eclipse.osgi.service.environment;version="1.0.0",
org.osgi.framework;version="1.4.0",
org.osgi.util.tracker;version="1.3.0"
-Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
- J2SE-1.4
+Bundle-RequiredExecutionEnvironment: J2SE-1.5,
+ J2SE-1.4,
+ CDC-1.1/Foundation-1.1
diff --git a/bundles/org.eclipse.equinox.p2.console/build.properties b/bundles/org.eclipse.equinox.p2.console/build.properties
index a6b8330d2..246ea6cb7 100644
--- a/bundles/org.eclipse.equinox.p2.console/build.properties
+++ b/bundles/org.eclipse.equinox.p2.console/build.properties
@@ -15,3 +15,5 @@ bin.includes = META-INF/,\
about.html,\
plugin.properties
src.includes = about.html
+javacTarget=jsr14
+javacSource=1.5
diff --git a/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvCommandProvider.java b/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvCommandProvider.java
index 02d3765c2..5c1d62131 100644
--- a/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvCommandProvider.java
+++ b/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvCommandProvider.java
@@ -261,9 +261,9 @@ public class ProvCommandProvider implements CommandProvider {
*/
public void _provlg(CommandInterpreter interpreter) {
String urlString = processArgument(interpreter.nextArgument());
- IQueryable queryable = null;
+ IQueryable<IInstallableUnit> queryable = null;
if (urlString == null) {
- queryable = (IQueryable) ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.SERVICE_NAME);
+ queryable = (IQueryable<IInstallableUnit>) ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.SERVICE_NAME);
if (queryable == null)
return;
} else {
@@ -299,7 +299,7 @@ public class ProvCommandProvider implements CommandProvider {
if (repoURL == null)
return;
IArtifactRepository repo = ProvisioningHelper.getArtifactRepository(repoURL);
- IQueryResult keys = null;
+ IQueryResult<IArtifactKey> keys = null;
try {
keys = (repo != null) ? repo.query(ArtifactKeyQuery.ALL_KEYS, null) : null;
} catch (UnsupportedOperationException e) {
@@ -311,8 +311,8 @@ public class ProvCommandProvider implements CommandProvider {
return;
}
IFileArtifactRepository fileRepo = (IFileArtifactRepository) repo.getAdapter(IFileArtifactRepository.class);
- for (Iterator iterator = keys.iterator(); iterator.hasNext();) {
- IArtifactKey key = (IArtifactKey) iterator.next();
+ for (Iterator<IArtifactKey> iterator = keys.iterator(); iterator.hasNext();) {
+ IArtifactKey key = iterator.next();
IArtifactDescriptor[] descriptors = repo.getArtifactDescriptors(key);
for (int j = 0; j < descriptors.length; j++) {
IArtifactDescriptor descriptor = descriptors[j];
@@ -442,10 +442,10 @@ public class ProvCommandProvider implements CommandProvider {
}
}
- private IInstallableUnit[] sort(IQueryResult queryResult) {
- IInstallableUnit[] units = (IInstallableUnit[]) queryResult.toArray(IInstallableUnit.class);
- Arrays.sort(units, new Comparator() {
- public int compare(Object arg0, Object arg1) {
+ private IInstallableUnit[] sort(IQueryResult<IInstallableUnit> queryResult) {
+ IInstallableUnit[] units = queryResult.toArray(IInstallableUnit.class);
+ Arrays.sort(units, new Comparator<IInstallableUnit>() {
+ public int compare(IInstallableUnit arg0, IInstallableUnit arg1) {
return arg0.toString().compareTo(arg1.toString());
}
});
diff --git a/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvisioningHelper.java b/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvisioningHelper.java
index 8300d7f59..5115dc164 100644
--- a/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvisioningHelper.java
+++ b/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvisioningHelper.java
@@ -19,6 +19,7 @@ import org.eclipse.equinox.internal.provisional.p2.director.*;
import org.eclipse.equinox.internal.provisional.p2.metadata.Version;
import org.eclipse.equinox.internal.provisional.p2.metadata.query.*;
import org.eclipse.equinox.p2.engine.*;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.query.IQuery;
import org.eclipse.equinox.p2.metadata.query.IQueryResult;
import org.eclipse.equinox.p2.repository.IRepositoryManager;
@@ -151,16 +152,16 @@ public class ProvisioningHelper {
* @param monitor A progress monitor, or <code>null</code>
* @return The IUs that match the query
*/
- public static IQueryResult getInstallableUnits(URI location, IQuery query, IProgressMonitor monitor) {
- IQueryable queryable = null;
+ public static IQueryResult<IInstallableUnit> getInstallableUnits(URI location, IQuery<IInstallableUnit> query, IProgressMonitor monitor) {
+ IQueryable<IInstallableUnit> queryable = null;
if (location == null) {
- queryable = (IQueryable) ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.SERVICE_NAME);
+ queryable = (IQueryable<IInstallableUnit>) ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.SERVICE_NAME);
} else {
queryable = getMetadataRepository(location);
}
if (queryable != null)
return queryable.query(query, monitor);
- return Collector.EMPTY_COLLECTOR;
+ return Collector.emptyCollector();
}
public static URI[] getMetadataRepositories() {
@@ -180,7 +181,7 @@ public class ProvisioningHelper {
public static IStatus install(String unitId, String version, IProfile profile, IProgressMonitor progress) throws ProvisionException {
if (profile == null)
return null;
- IQueryResult units = getInstallableUnits((URI) null, new InstallableUnitQuery(unitId, Version.create(version)), progress);
+ IQueryResult<IInstallableUnit> units = getInstallableUnits((URI) null, new InstallableUnitQuery(unitId, Version.create(version)), progress);
if (units.isEmpty()) {
StringBuffer error = new StringBuffer();
error.append("Installable unit not found: " + unitId + ' ' + version + '\n');
diff --git a/bundles/org.eclipse.equinox.p2.core/.classpath b/bundles/org.eclipse.equinox.p2.core/.classpath
index 6f3b481ac..64c5e31b7 100644
--- a/bundles/org.eclipse.equinox.p2.core/.classpath
+++ b/bundles/org.eclipse.equinox.p2.core/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <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.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
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
index 327fbe678..14cc6924d 100644
--- 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
@@ -1,346 +1,346 @@
-#Mon Aug 24 11:19:53 EDT 2009
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
-org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
-org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
-org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
-org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+#Tue Dec 22 00:34:34 CET 2009
+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=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+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=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+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.missingJavadocTagsVisibility=public
-org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=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_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+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.annotationSuperInterface=warning
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
-org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+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.missingHashCodeMethod=error
+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.missingSynchronizedOnInheritedMethod=ignore
+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=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
-org.eclipse.jdt.core.formatter.comment.format_source_code=true
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
-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_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
-org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+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.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
-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_local_declarations=insert
-org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
-org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
-org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
-org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.formatter.comment.format_header=false
-org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
-org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.comment.line_length=80
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+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.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+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.formatter.insert_space_after_binary_operator=insert
-org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
-org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
-org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.builder.cleanOutputFolder=clean
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
-org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false
-org.eclipse.jdt.core.formatter.continuation_indentation=2
-org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
-org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.5
+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.insert_space_after_comma_in_parameterized_type_reference=insert
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+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.compiler.problem.missingJavadocTagsOverriding=enabled
-org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+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.builder.resourceCopyExclusionFilter=*.launch
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+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.insert_new_line_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.incompleteClasspath=error
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
-instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=error
-org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+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.insert_space_before_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert
+org.eclipse.jdt.core.formatter.comment.format_header=false
org.eclipse.jdt.core.formatter.comment.format_html=true
-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_closing_paren_in_enum_constant=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_closing_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
-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_closing_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
-org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
-org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
-org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=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_comma_in_enum_constant_arguments=do not insert
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=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_between_empty_braces_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=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.alignment_for_throws_clause_in_method_declaration=16
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
-org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=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_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_space_before_colon_in_labeled_statement=do not insert
-org.eclipse.jdt.core.circularClasspath=error
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=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.alignment_for_arguments_in_enum_constant=16
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+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.compiler.problem.incompleteEnumSwitch=ignore
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=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.alignment_for_enum_constants=0
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
-org.eclipse.jdt.core.formatter.tabulation.char=tab
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
-org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+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_before_comma_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.compact_else_if=true
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
-org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=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_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.compiler.problem.finalParameterBound=ignore
-org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=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_comma_in_enum_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=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.indent_body_declarations_compare_to_enum_declaration_header=true
-org.eclipse.jdt.core.compiler.problem.discouragedReference=error
-org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
-org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
-org.eclipse.jdt.core.formatter.comment.format_line_comments=false
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
-org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.indentation.size=4
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+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.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=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.comment.indent_root_tags=false
-org.eclipse.jdt.core.compiler.problem.deprecation=warning
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+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.compiler.problem.invalidJavadocTagsVisibility=private
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
-org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
-org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
-org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
-org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.blank_lines_before_package=0
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
-org.eclipse.jdt.core.formatter.indent_empty_lines=false
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
-org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+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_comma_in_constructor_declaration_throws=do not insert
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
-org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
-org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
-org.eclipse.jdt.core.compiler.problem.unusedImport=error
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
-org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
-org.eclipse.jdt.core.builder.invalidClasspath=abort
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=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_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.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.incompatibleJDKLevel=ignore
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.compiler.problem.nullReference=warning
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=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.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
-org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=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_after_closing_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+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.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
-org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
-org.eclipse.jdt.core.compiler.source=1.3
-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_method_body=insert
+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.compiler.problem.assertIdentifier=warning
-org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
-org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
-org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
-org.eclipse.jdt.core.builder.duplicateResourceTask=warning
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert
-org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.compiler.doc.comment.support=enabled
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=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_closing_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.compiler.compliance=1.4
-org.eclipse.jdt.core.formatter.blank_lines_after_package=1
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
-org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
-org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+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/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.core/META-INF/MANIFEST.MF
index d4e12693b..d9322015f 100644
--- a/bundles/org.eclipse.equinox.p2.core/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.core/META-INF/MANIFEST.MF
@@ -97,8 +97,9 @@ Export-Package: org.eclipse.equinox.internal.p2.core;x-friends:="org.eclipse.equ
org.eclipse.equinox.p2.core.spi
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
-Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
- J2SE-1.4
+Bundle-RequiredExecutionEnvironment: J2SE-1.5,
+ J2SE-1.4,
+ CDC-1.1/Foundation-1.1
Bundle-Activator: org.eclipse.equinox.internal.p2.core.Activator
Require-Bundle: org.eclipse.equinox.common;bundle-version="[3.5.0,4.0.0)"
Service-Component: OSGI-INF/eventBus.xml, OSGI-INF/agentProvider.xml
diff --git a/bundles/org.eclipse.equinox.p2.core/build.properties b/bundles/org.eclipse.equinox.p2.core/build.properties
index 4f52e07f1..98b717479 100644
--- a/bundles/org.eclipse.equinox.p2.core/build.properties
+++ b/bundles/org.eclipse.equinox.p2.core/build.properties
@@ -16,3 +16,5 @@ bin.includes = META-INF/,\
OSGI-INF/
src.includes = about.html
source.. = src/
+javacTarget=jsr14
+javacSource=1.5
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/Activator.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/Activator.java
index c633815c3..45f8a9d66 100644
--- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/Activator.java
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/Activator.java
@@ -159,7 +159,7 @@ public class Activator implements BundleActivator {
Activator.context = aContext;
URI defaultLocation = URIUtil.fromString(aContext.getProperty(PROP_CONFIG_DIR) + DEFAULT_AGENT_LOCATION + '/');
agentDataLocation = buildLocation(PROP_AGENT_DATA_AREA, defaultLocation, false, true);
- Dictionary locationProperties = new Hashtable();
+ Dictionary<String, Object> locationProperties = new Hashtable<String, Object>();
if (agentDataLocation != null) {
locationProperties.put("type", PROP_AGENT_DATA_AREA); //$NON-NLS-1$
agentLocationRegistration = aContext.registerService(IAgentLocation.SERVICE_NAME, agentDataLocation, locationProperties);
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/DefaultAgentProvider.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/DefaultAgentProvider.java
index 8d086e55e..158e28177 100644
--- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/DefaultAgentProvider.java
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/DefaultAgentProvider.java
@@ -31,7 +31,7 @@ public class DefaultAgentProvider implements IProvisioningAgentProvider {
result.setBundleContext(context);
result.setLocation(location);
IAgentLocation agentLocation = (IAgentLocation) result.getService(IAgentLocation.SERVICE_NAME);
- Dictionary properties = new Hashtable(5);
+ Dictionary<String, Object> properties = new Hashtable<String, Object>(5);
if (agentLocation != null)
properties.put("locationURI", String.valueOf(agentLocation.getRootLocation())); //$NON-NLS-1$
//make the currently running system have a higher service ranking
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/ProvisioningAgent.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/ProvisioningAgent.java
index dc2d49ef5..c0fd26504 100644
--- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/ProvisioningAgent.java
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/ProvisioningAgent.java
@@ -22,7 +22,7 @@ import org.osgi.framework.*;
*/
public class ProvisioningAgent implements IProvisioningAgent {
- private final Map agentServices = Collections.synchronizedMap(new HashMap());
+ private final Map<String, Object> agentServices = Collections.synchronizedMap(new HashMap<String, Object>());
private BundleContext context;
private boolean stopped = false;
private ServiceRegistration reg;
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/StringPool.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/StringPool.java
index 930378462..f7ff68cd6 100644
--- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/StringPool.java
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/StringPool.java
@@ -23,7 +23,7 @@ import java.util.HashMap;
*/
public final class StringPool {
private int savings;
- private final HashMap map = new HashMap();
+ private final HashMap<String, String> map = new HashMap<String, String>();
/**
* Creates a new string pool.
@@ -41,11 +41,11 @@ public final class StringPool {
public String add(String string) {
if (string == null)
return string;
- Object result = map.get(string);
+ String result = map.get(string);
if (result != null) {
if (result != string)
savings += 44 + 2 * string.length();
- return (String) result;
+ return result;
}
//explicitly copy the string to trim excess baggage
String trim = new String(string.toCharArray());
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/CollectionUtils.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/CollectionUtils.java
new file mode 100644
index 000000000..48797a222
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/CollectionUtils.java
@@ -0,0 +1,232 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Cloudsmith Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cloudsmith Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.p2.core.helpers;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Array;
+import java.util.*;
+
+/**
+ * Helper class that provides some useful support when dealing with collections.
+ */
+public class CollectionUtils {
+
+ /**
+ * A unmodifiable {@link List} implementation on top of an object array.
+ * @param <E> The element type.
+ */
+ private static class UnmodifiableArrayList<E> extends AbstractList<E> implements RandomAccess, java.io.Serializable {
+ private static final long serialVersionUID = 7435304230643855579L;
+ final E[] array;
+
+ UnmodifiableArrayList(E[] array) {
+ this.array = array;
+ }
+
+ public boolean contains(Object o) {
+ return indexOf(o) != -1;
+ }
+
+ public E get(int index) {
+ return array[index];
+ }
+
+ public int indexOf(Object o) {
+ int size = array.length;
+ if (o == null) {
+ for (int i = 0; i < size; i++)
+ if (array[i] == null)
+ return i;
+ } else {
+ for (int i = 0; i < size; i++)
+ if (o.equals(array[i]))
+ return i;
+ }
+ return -1;
+ }
+
+ public Iterator<E> iterator() {
+ return listIterator();
+ }
+
+ /**
+ * Rapid iterator, motivated by the fact that we don't need to check
+ * for concurrent modifications.
+ */
+ public ListIterator<E> listIterator() {
+ return new ListIterator<E>() {
+ private int index = 0;
+
+ public boolean hasNext() {
+ return index < array.length;
+ }
+
+ public E next() {
+ if (index >= array.length)
+ throw new NoSuchElementException();
+ return array[index++];
+ }
+
+ public boolean hasPrevious() {
+ return index > 0;
+ }
+
+ public E previous() {
+ if (--index < 0) {
+ ++index;
+ throw new NoSuchElementException();
+ }
+ return array[index];
+ }
+
+ public int nextIndex() {
+ return index;
+ }
+
+ public int previousIndex() {
+ return index - 1;
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+
+ public void set(E e) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void add(E e) {
+ throw new UnsupportedOperationException();
+ }
+ };
+ }
+
+ public int lastIndexOf(Object o) {
+ int idx = array.length;
+ if (o == null) {
+ while (--idx >= 0)
+ if (array[idx] == null)
+ return idx;
+ } else {
+ while (--idx >= 0)
+ if (o.equals(array[idx]))
+ return idx;
+ }
+ return -1;
+ }
+
+ public E set(int index, E element) {
+ throw new UnsupportedOperationException();
+ }
+
+ public int size() {
+ return array.length;
+ }
+
+ public Object[] toArray() {
+ return array.clone();
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T[] toArray(T[] a) {
+ int size = array.length;
+ if (a.length < size)
+ a = (T[]) Array.newInstance(a.getClass().getComponentType(), size);
+ System.arraycopy(this.array, 0, a, 0, size);
+ while (size < a.length)
+ a[size++] = null;
+ return a;
+ }
+ }
+
+ /**
+ * The emptyList() method was introduced in Java 1.5 so we need this here to be able to
+ * down compile to 1.4.
+ * @param <T> The type of the elements
+ * @return An empty list
+ */
+ @SuppressWarnings("unchecked")
+ public static <T> List<T> emptyList() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * The emptySet() method was introduced in Java 1.5 so we need this here to be able to
+ * down compile to 1.4.
+ * @param <T> The type of the elements
+ * @return An empty set
+ */
+ @SuppressWarnings("unchecked")
+ public static <T> Set<T> emptySet() {
+ return Collections.EMPTY_SET;
+ }
+
+ /**
+ * The emptyMap() method was introduced in Java 1.5 so we need this here to be able to
+ * down compile to 1.4.
+ * @param <T> The type of the elements
+ * @return An empty set
+ */
+ @SuppressWarnings("unchecked")
+ public static <K, V> Map<K, V> emptyMap() {
+ return Collections.EMPTY_MAP;
+ }
+
+ /**
+ * Returns an unmodifiable list that is backed by the <code>array</code>.
+ * @param <T> The list element type
+ * @param array The array of elements
+ * @return The unmodifiable list
+ */
+ public static <T> List<T> unmodifiableList(T[] array) {
+ return array == null || array.length == 0 ? CollectionUtils.<T> emptyList() : new UnmodifiableArrayList<T>(array);
+ }
+
+ /**
+ * Reads a property list using the {@link Properties#load(InputStream)} method. The
+ * properties are stored in a map.
+ * @param stream The stream to read from
+ * @return The resulting map
+ * @throws IOException propagated from the load method.
+ */
+ public static Map<String, String> loadProperties(InputStream stream) throws IOException {
+ Properties properties = new Properties();
+ properties.load(stream);
+ return toMap(properties);
+ }
+
+ /**
+ * Copies all elements from <code>properties</code> into a Map. The returned map might be unmodifiable
+ * @param properties
+ * @return The map containing all elements
+ */
+ public static Map<String, String> toMap(Properties properties) {
+ if (properties == null || properties.isEmpty())
+ return emptyMap();
+
+ Map<String, String> props = new HashMap<String, String>(properties.size());
+ putAll(properties, props);
+ return props;
+ }
+
+ /**
+ * Copies all elements from <code>properties</code> into the given <code>result</code>.
+ * @param properties
+ * @param result
+ */
+ public static void putAll(Properties properties, Map<String, String> result) {
+ for (Enumeration<Object> keys = properties.keys(); keys.hasMoreElements();) {
+ String key = (String) keys.nextElement();
+ result.put(key, properties.getProperty(key));
+ }
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/FileUtils.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/FileUtils.java
index 96a9f9810..ded76dffc 100644
--- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/FileUtils.java
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/FileUtils.java
@@ -21,10 +21,10 @@ public class FileUtils {
private static File[] untarFile(File source, File outputDir) throws IOException, TarException {
TarFile tarFile = new TarFile(source);
- List untarredFiles = new ArrayList();
+ List<File> untarredFiles = new ArrayList<File>();
try {
- for (Enumeration e = tarFile.entries(); e.hasMoreElements();) {
- TarEntry entry = (TarEntry) e.nextElement();
+ for (Enumeration<TarEntry> e = tarFile.entries(); e.hasMoreElements();) {
+ TarEntry entry = e.nextElement();
InputStream input = tarFile.getInputStream(entry);
try {
File outFile = new File(outputDir, entry.getName());
@@ -52,7 +52,7 @@ public class FileUtils {
} finally {
tarFile.close();
}
- return (File[]) untarredFiles.toArray(new File[untarredFiles.size()]);
+ return untarredFiles.toArray(new File[untarredFiles.size()]);
}
/**
@@ -107,7 +107,7 @@ public class FileUtils {
in.close();
throw new IOException(Messages.Util_Invalid_Zip_File_Format);
}
- ArrayList unzippedFiles = new ArrayList();
+ ArrayList<File> unzippedFiles = new ArrayList<File>();
do {
File outFile = new File(outputDir, ze.getName());
unzippedFiles.add(outFile);
@@ -131,7 +131,7 @@ public class FileUtils {
} while ((ze = in.getNextEntry()) != null);
in.close();
- return (File[]) unzippedFiles.toArray(new File[unzippedFiles.size()]);
+ return unzippedFiles.toArray(new File[unzippedFiles.size()]);
}
// Delete empty directories under dir, including dir itself.
@@ -243,8 +243,8 @@ public class FileUtils {
public static void zip(File[] inclusions, File[] exclusions, File destinationArchive, IPathComputer pathComputer) throws IOException {
FileOutputStream fileOutput = new FileOutputStream(destinationArchive);
ZipOutputStream output = new ZipOutputStream(fileOutput);
- HashSet exclusionSet = exclusions == null ? new HashSet() : new HashSet(Arrays.asList(exclusions));
- HashSet directoryEntries = new HashSet();
+ HashSet<File> exclusionSet = exclusions == null ? new HashSet<File>() : new HashSet<File>(Arrays.asList(exclusions));
+ HashSet<IPath> directoryEntries = new HashSet<IPath>();
try {
for (int i = 0; i < inclusions.length; i++) {
pathComputer.reset();
@@ -273,11 +273,11 @@ public class FileUtils {
* @param pathComputer - computer used to create the path of the files in the result.
* @throws IOException
*/
- public static void zip(ZipOutputStream output, File source, Set exclusions, IPathComputer pathComputer) throws IOException {
- zip(output, source, exclusions, pathComputer, new HashSet());
+ public static void zip(ZipOutputStream output, File source, Set<File> exclusions, IPathComputer pathComputer) throws IOException {
+ zip(output, source, exclusions, pathComputer, new HashSet<IPath>());
}
- public static void zip(ZipOutputStream output, File source, Set exclusions, IPathComputer pathComputer, Set directoryEntries) throws IOException {
+ public static void zip(ZipOutputStream output, File source, Set<File> exclusions, IPathComputer pathComputer, Set<IPath> directoryEntries) throws IOException {
if (exclusions.contains(source))
return;
if (source.isDirectory()) //if the file path is a URL then isDir and isFile are both false
@@ -286,7 +286,7 @@ public class FileUtils {
zipFile(output, source, pathComputer, directoryEntries);
}
- private static void zipDirectoryEntry(ZipOutputStream output, IPath entry, long time, Set directoryEntries) throws IOException {
+ private static void zipDirectoryEntry(ZipOutputStream output, IPath entry, long time, Set<IPath> directoryEntries) throws IOException {
entry = entry.addTrailingSeparator();
if (!directoryEntries.contains(entry)) {
//make sure parent entries are in the zip
@@ -314,7 +314,7 @@ public class FileUtils {
* 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, Set exclusions, IPathComputer pathComputer, Set directoryEntries) throws IOException {
+ private static void zipDir(ZipOutputStream output, File source, Set<File> exclusions, IPathComputer pathComputer, Set<IPath> directoryEntries) throws IOException {
File[] files = source.listFiles();
if (files.length == 0) {
zipDirectoryEntry(output, pathComputer.computePath(source), source.lastModified(), directoryEntries);
@@ -326,16 +326,16 @@ public class FileUtils {
// foo/bar.txt
// foo/something/bar2.txt
// foo/something/else/bar3.txt
- Arrays.sort(files, new Comparator() {
- public int compare(Object arg0, Object arg1) {
- Path a = new Path(((File) arg0).getAbsolutePath());
- Path b = new Path(((File) arg1).getAbsolutePath());
+ Arrays.sort(files, new Comparator<File>() {
+ public int compare(File arg0, File arg1) {
+ Path a = new Path(arg0.getAbsolutePath());
+ Path b = new Path(arg1.getAbsolutePath());
if (a.segmentCount() == b.segmentCount()) {
- if (((File) arg0).isDirectory() && ((File) arg1).isFile())
+ if (arg0.isDirectory() && arg1.isFile())
return 1;
- else if (((File) arg0).isDirectory() && ((File) arg1).isDirectory())
+ else if (arg0.isDirectory() && arg1.isDirectory())
return 0;
- else if (((File) arg0).isFile() && ((File) arg1).isDirectory())
+ else if (arg0.isFile() && arg1.isDirectory())
return -1;
else
return 0;
@@ -352,7 +352,7 @@ public class FileUtils {
* 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 source, IPathComputer pathComputer, Set directoryEntries) throws IOException {
+ private static void zipFile(ZipOutputStream output, File source, IPathComputer pathComputer, Set<IPath> directoryEntries) throws IOException {
boolean isManifest = false; //manifest files are special
InputStream input = new BufferedInputStream(new FileInputStream(source));
try {
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/LogHelper.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/LogHelper.java
index cb3fd613a..d8da0bf58 100644
--- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/LogHelper.java
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/LogHelper.java
@@ -39,7 +39,7 @@ public class LogHelper {
*/
private static FrameworkLogEntry getLog(IStatus status) {
Throwable t = status.getException();
- ArrayList childlist = new ArrayList();
+ ArrayList<FrameworkLogEntry> childlist = new ArrayList<FrameworkLogEntry>();
int stackCode = t instanceof CoreException ? 1 : 0;
// ensure a substatus inside a CoreException is properly logged
@@ -57,7 +57,7 @@ public class LogHelper {
}
}
- FrameworkLogEntry[] children = (FrameworkLogEntry[]) (childlist.size() == 0 ? null : childlist.toArray(new FrameworkLogEntry[childlist.size()]));
+ FrameworkLogEntry[] children = (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/internal/p2/core/helpers/OrderedProperties.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/OrderedProperties.java
index 442132bf6..56caeab6c 100644
--- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/OrderedProperties.java
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/OrderedProperties.java
@@ -26,11 +26,11 @@ import java.util.*;
* The class does not support default properties as they can be expressed by
* creating java.util.Properties hierarchies.
*/
-public class OrderedProperties extends Dictionary implements Map {
+public class OrderedProperties extends Dictionary<String, String> implements Map<String, String> {
- LinkedHashMap propertyMap = null;
+ LinkedHashMap<String, String> propertyMap = null;
- public static OrderedProperties unmodifiableProperties(Map properties) {
+ public static OrderedProperties unmodifiableProperties(Map<String, String> properties) {
return new UnmodifiableProperties(properties);
}
@@ -40,12 +40,12 @@ public class OrderedProperties extends Dictionary implements Map {
public OrderedProperties(int size) {
super();
- propertyMap = new LinkedHashMap(size);
+ propertyMap = new LinkedHashMap<String, String>(size);
}
public OrderedProperties(OrderedProperties properties) {
super();
- propertyMap = new LinkedHashMap(properties.size());
+ propertyMap = new LinkedHashMap<String, String>(properties.size());
putAll(properties);
}
@@ -67,11 +67,11 @@ public class OrderedProperties extends Dictionary implements Map {
}
public String getProperty(String key) {
- return (String) (propertyMap == null ? null : propertyMap.get(key));
+ return (propertyMap == null ? null : propertyMap.get(key));
}
public void putAll(OrderedProperties properties) {
- putAll((Map) properties);
+ putAll(properties);
}
/**
@@ -79,7 +79,7 @@ public class OrderedProperties extends Dictionary implements Map {
*/
private void init() {
if (propertyMap == null) {
- propertyMap = new LinkedHashMap();
+ propertyMap = new LinkedHashMap<String, String>();
}
}
@@ -95,9 +95,9 @@ public class OrderedProperties extends Dictionary implements Map {
propertyMap = null;
}
- public Object put(Object arg0, Object arg1) {
+ public String put(String key, String value) {
init();
- return propertyMap.put(arg0, arg1);
+ return propertyMap.put(key, value);
}
public boolean containsKey(Object key) {
@@ -108,29 +108,29 @@ public class OrderedProperties extends Dictionary implements Map {
return propertyMap != null ? propertyMap.containsValue(value) : false;
}
- public Set entrySet() {
- return propertyMap != null ? propertyMap.entrySet() : Collections.EMPTY_SET;
+ public Set<Map.Entry<String, String>> entrySet() {
+ return propertyMap != null ? propertyMap.entrySet() : CollectionUtils.<Map.Entry<String, String>> emptySet();
}
- public Object get(Object key) {
+ public String get(Object key) {
return propertyMap != null ? propertyMap.get(key) : null;
}
- public Set keySet() {
- return propertyMap != null ? propertyMap.keySet() : Collections.EMPTY_SET;
+ public Set<String> keySet() {
+ return propertyMap != null ? propertyMap.keySet() : CollectionUtils.<String> emptySet();
}
- public void putAll(Map arg0) {
+ public void putAll(Map<? extends String, ? extends String> arg0) {
init();
propertyMap.putAll(arg0);
}
- public Object remove(Object key) {
+ public String remove(Object key) {
return propertyMap != null ? propertyMap.remove(key) : null;
}
- public Collection values() {
- return propertyMap != null ? propertyMap.values() : Collections.EMPTY_LIST;
+ public Collection<String> values() {
+ return propertyMap != null ? propertyMap.values() : CollectionUtils.<String> emptyList();
}
public boolean equals(Object o) {
@@ -147,8 +147,8 @@ public class OrderedProperties extends Dictionary implements Map {
return rhs.propertyMap.equals(this.propertyMap);
}
if (this.propertyMap == null) {
- if (o instanceof Map)
- return ((Map) o).isEmpty();
+ if (o instanceof Map<?, ?>)
+ return ((Map<?, ?>) o).isEmpty();
return false;
}
return this.propertyMap.equals(o);
@@ -164,54 +164,37 @@ public class OrderedProperties extends Dictionary implements Map {
return sb.toString();
}
- private class ElementsEnum implements Enumeration {
+ private class StringsEnum implements Enumeration<String> {
- Iterator iterator = null;
+ private final Iterator<String> iterator;
- public ElementsEnum(OrderedProperties properties) {
- iterator = properties.propertyMap.values().iterator();
+ public StringsEnum(Collection<String> elems) {
+ this.iterator = elems.iterator();
}
public boolean hasMoreElements() {
return iterator.hasNext();
}
- public Object nextElement() {
+ public String nextElement() {
return iterator.next();
}
}
- public Enumeration elements() {
- return new ElementsEnum(this);
- }
-
- private class KeysEnum implements Enumeration {
-
- Iterator iterator = null;
-
- public KeysEnum(OrderedProperties properties) {
- iterator = properties.propertyMap.keySet().iterator();
- }
-
- public boolean hasMoreElements() {
- return iterator.hasNext();
- }
-
- public Object nextElement() {
- return iterator.next();
- }
+ public Enumeration<String> elements() {
+ return new StringsEnum(propertyMap.values());
}
- public Enumeration keys() {
- return new KeysEnum(this);
+ public Enumeration<String> keys() {
+ return new StringsEnum(propertyMap.keySet());
}
private static class UnmodifiableProperties extends OrderedProperties {
- UnmodifiableProperties(Map properties) {
+ UnmodifiableProperties(Map<String, String> properties) {
super();
- for (Iterator iter = properties.entrySet().iterator(); iter.hasNext();) {
- Map.Entry entry = (Map.Entry) iter.next();
+ for (Iterator<Map.Entry<String, String>> iter = properties.entrySet().iterator(); iter.hasNext();) {
+ Map.Entry<String, String> entry = iter.next();
super.put(entry.getKey(), entry.getValue());
}
}
@@ -220,15 +203,15 @@ public class OrderedProperties extends Dictionary implements Map {
throw new UnsupportedOperationException();
}
- public synchronized Object put(Object key, Object value) {
+ public synchronized String put(String key, String value) {
throw new UnsupportedOperationException();
}
- public synchronized Object remove(Object key) {
+ public synchronized String remove(Object key) {
throw new UnsupportedOperationException();
}
- public synchronized void putAll(Map t) {
+ public synchronized void putAll(Map<? extends String, ? extends String> t) {
throw new UnsupportedOperationException();
}
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/StringHelper.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/StringHelper.java
index c1995c27f..2d6a9e557 100644
--- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/StringHelper.java
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/StringHelper.java
@@ -26,7 +26,7 @@ public class StringHelper {
if (spec.length() > 0)
resultArr = new String[] {spec};
} else {
- List result = new ArrayList();
+ List<String> result = new ArrayList<String>();
while (splitIdx >= 0) {
String part = spec.substring(0, splitIdx).trim();
if (part.length() > 0)
@@ -37,7 +37,7 @@ public class StringHelper {
spec = spec.trim();
if (spec.length() > 0)
result.add(spec);
- resultArr = (String[]) result.toArray(new String[result.size()]);
+ resultArr = result.toArray(new String[result.size()]);
}
}
return resultArr;
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/TarFile.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/TarFile.java
index 5500bc765..4b4971236 100644
--- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/TarFile.java
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/TarFile.java
@@ -70,13 +70,13 @@ public class TarFile {
*
* @return enumeration of all files in the archive
*/
- public Enumeration entries() {
- return new Enumeration() {
+ public Enumeration<TarEntry> entries() {
+ return new Enumeration<TarEntry>() {
public boolean hasMoreElements() {
return (curEntry != null);
}
- public Object nextElement() {
+ public TarEntry nextElement() {
TarEntry oldEntry = curEntry;
try {
curEntry = entryEnumerationStream.getNextEntry();
diff --git a/bundles/org.eclipse.equinox.p2.director.app/.classpath b/bundles/org.eclipse.equinox.p2.director.app/.classpath
index 75116d75c..834ea833e 100644
--- a/bundles/org.eclipse.equinox.p2.director.app/.classpath
+++ b/bundles/org.eclipse.equinox.p2.director.app/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <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.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" output="bin_ant" path="src_ant"/>
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
index 802d3818a..b2e21d59e 100644
--- 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
@@ -1,4 +1,4 @@
-#Wed Oct 07 15:35:11 EDT 2009
+#Mon Dec 28 07:04:08 CET 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
org.eclipse.jdt.core.builder.duplicateResourceTask=warning
@@ -8,17 +8,17 @@ 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.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.compliance=1.5
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.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
org.eclipse.jdt.core.compiler.problem.deadCode=warning
@@ -27,7 +27,7 @@ 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.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
@@ -90,7 +90,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enab
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.compiler.source=1.5
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
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
index a70c8b478..60f0aac5d 100644
--- a/bundles/org.eclipse.equinox.p2.director.app/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.director.app/META-INF/MANIFEST.MF
@@ -26,7 +26,8 @@ Import-Package: org.eclipse.equinox.app,
org.osgi.service.packageadmin
Bundle-Activator: org.eclipse.equinox.internal.p2.director.app.Activator
Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
- J2SE-1.4
+Bundle-RequiredExecutionEnvironment: J2SE-1.5,
+ J2SE-1.4,
+ CDC-1.1/Foundation-1.1
Require-Bundle: org.eclipse.equinox.common;bundle-version="[3.5.0,4.0.0)"
Export-Package: org.eclipse.equinox.internal.p2.director.app;x-internal:=true
diff --git a/bundles/org.eclipse.equinox.p2.director.app/build.properties b/bundles/org.eclipse.equinox.p2.director.app/build.properties
index fd5507d03..d80a7ff0d 100644
--- a/bundles/org.eclipse.equinox.p2.director.app/build.properties
+++ b/bundles/org.eclipse.equinox.p2.director.app/build.properties
@@ -21,3 +21,5 @@ src.includes = about.html
jars.compile.order=.,ant_tasks/director-ant.jar
extra.ant_tasks/director-ant.jar = platform:/plugin/org.apache.ant
jars.extra.classpath = platform:/plugin/org.apache.ant/lib/ant.jar
+javacTarget=jsr14
+javacSource=1.5
diff --git a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/Application.java b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/Application.java
index 14759ee99..127003367 100644
--- a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/Application.java
+++ b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/Application.java
@@ -92,7 +92,7 @@ public class Application implements IApplication {
throw new CoreException(new Status(IStatus.ERROR, Activator.ID, NLS.bind(Messages.Ambigous_Command, new Object[] {COMMAND_NAMES[cmd1], COMMAND_NAMES[cmd2]})));
}
- private ProfileChangeRequest buildProvisioningRequest(IProfile profile, IQueryResult roots, boolean install) {
+ private ProfileChangeRequest buildProvisioningRequest(IProfile profile, IQueryResult<IInstallableUnit> roots, boolean install) {
ProfileChangeRequest request = new ProfileChangeRequest(profile);
markRoots(request, roots);
if (install) {
@@ -120,7 +120,7 @@ public class Application implements IApplication {
}
private String getEnvironmentProperty() {
- Properties values = new Properties();
+ Map<String, String> values = new HashMap<String, String>();
if (os != null)
values.put("osgi.os", os); //$NON-NLS-1$
if (nl != null)
@@ -250,9 +250,9 @@ public class Application implements IApplication {
throw new RuntimeException(Messages.Missing_Engine);
}
- private void markRoots(ProfileChangeRequest request, IQueryResult roots) {
- for (Iterator iterator = roots.iterator(); iterator.hasNext();) {
- request.setInstallableUnitProfileProperty((IInstallableUnit) iterator.next(), IProfile.PROP_PROFILE_ROOT_IU, Boolean.TRUE.toString());
+ private void markRoots(ProfileChangeRequest request, IQueryResult<IInstallableUnit> roots) {
+ for (Iterator<IInstallableUnit> iterator = roots.iterator(); iterator.hasNext();) {
+ request.setInstallableUnitProfileProperty(iterator.next(), IProfile.PROP_PROFILE_ROOT_IU, Boolean.TRUE.toString());
}
}
@@ -403,7 +403,7 @@ public class Application implements IApplication {
IStatus operationStatus = Status.OK_STATUS;
InstallableUnitQuery query;
- IQueryResult roots;
+ IQueryResult<IInstallableUnit> roots;
try {
initializeRepositories(command == COMMAND_INSTALL);
switch (command) {
@@ -412,7 +412,7 @@ public class Application implements IApplication {
IProfile profile = initializeProfile();
query = new InstallableUnitQuery(root, version == null ? VersionRange.emptyRange : new VersionRange(version, true, version, true));
- roots = collectRootIUs(metadataRepositoryLocations, new PipedQuery(new IQuery[] {query, new LatestIUVersionQuery()}));
+ roots = collectRootIUs(metadataRepositoryLocations, new PipedQuery<IInstallableUnit>(query, new LatestIUVersionQuery<IInstallableUnit>()));
if (roots.isEmpty())
roots = profile.query(query, new NullProgressMonitor());
if (roots.isEmpty()) {
@@ -449,9 +449,9 @@ public class Application implements IApplication {
missingArgument("metadataRepository"); //$NON-NLS-1$
roots = collectRootIUs(metadataRepositoryLocations, query);
- Iterator unitIterator = roots.iterator();
+ Iterator<IInstallableUnit> unitIterator = roots.iterator();
while (unitIterator.hasNext()) {
- IInstallableUnit iu = (IInstallableUnit) unitIterator.next();
+ IInstallableUnit iu = unitIterator.next();
System.out.println(iu.getId());
}
break;
@@ -484,29 +484,30 @@ public class Application implements IApplication {
}
}
- class LocationQueryable implements IQueryable {
+ class LocationQueryable implements IQueryable<IInstallableUnit> {
private URI location;
public LocationQueryable(URI location) {
this.location = location;
}
- public IQueryResult query(IQuery query, IProgressMonitor monitor) {
+ public IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor) {
return ProvisioningHelper.getInstallableUnits(location, query, monitor);
}
}
- private IQueryResult collectRootIUs(URI[] locations, IQuery query) {
+ private IQueryResult<IInstallableUnit> collectRootIUs(URI[] locations, IQuery<IInstallableUnit> query) {
IProgressMonitor nullMonitor = new NullProgressMonitor();
if (locations == null || locations.length == 0)
return ProvisioningHelper.getInstallableUnits((URI) null, query, nullMonitor);
- IQueryable[] locationQueryables = new IQueryable[locations.length];
+ @SuppressWarnings("unchecked")
+ IQueryable<IInstallableUnit>[] locationQueryables = new IQueryable[locations.length];
for (int i = 0; i < locations.length; i++) {
locationQueryables[i] = new LocationQueryable(locations[i]);
}
- return new CompoundQueryable(locationQueryables).query(query, nullMonitor);
+ return new CompoundQueryable<IInstallableUnit>(locationQueryables).query(query, nullMonitor);
}
private synchronized void setPackageAdmin(PackageAdmin service) {
@@ -537,14 +538,14 @@ public class Application implements IApplication {
Activator.getContext().ungetService(packageAdminRef);
}
- private String toString(Properties context) {
+ private String toString(Map<String, String> context) {
StringBuffer result = new StringBuffer();
- for (Enumeration iter = context.keys(); iter.hasMoreElements();) {
- String key = (String) iter.nextElement();
+ for (Iterator<String> iter = context.keySet().iterator(); iter.hasNext();) {
+ String key = iter.next();
result.append(key);
result.append('=');
result.append(context.get(key));
- if (iter.hasMoreElements())
+ if (iter.hasNext())
result.append(',');
}
return result.toString();
@@ -602,7 +603,7 @@ public class Application implements IApplication {
if (spec == null)
return null;
String[] urlSpecs = getArrayFromString(spec, ","); //$NON-NLS-1$
- ArrayList result = new ArrayList(urlSpecs.length);
+ ArrayList<URI> result = new ArrayList<URI>(urlSpecs.length);
for (int i = 0; i < urlSpecs.length; i++) {
try {
result.add(URIUtil.fromString(urlSpecs[i]));
@@ -612,7 +613,7 @@ public class Application implements IApplication {
}
if (result.size() == 0)
return null;
- return (URI[]) result.toArray(new URI[result.size()]);
+ return result.toArray(new URI[result.size()]);
}
/**
@@ -622,13 +623,13 @@ public class Application implements IApplication {
public static String[] getArrayFromString(String list, String separator) {
if (list == null || list.trim().equals("")) //$NON-NLS-1$
return new String[0];
- List result = new ArrayList();
+ List<String> result = new ArrayList<String>();
for (StringTokenizer tokens = new StringTokenizer(list, separator); tokens.hasMoreTokens();) {
String token = tokens.nextToken().trim();
if (!token.equals("")) //$NON-NLS-1$
result.add(token);
}
- return (String[]) result.toArray(new String[result.size()]);
+ return result.toArray(new String[result.size()]);
}
private void logFailure(IStatus status) {
diff --git a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java
index 8bab64db9..bfed367f8 100644
--- a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java
+++ b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java
@@ -16,6 +16,7 @@ import java.io.*;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.*;
+import java.util.Map.Entry;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.app.IApplication;
import org.eclipse.equinox.app.IApplicationContext;
@@ -47,7 +48,7 @@ import org.osgi.service.packageadmin.PackageAdmin;
* p2 data location. See bug 268138 for related discussion.
*/
public class DirectorApplication implements IApplication {
- class LocationQueryable implements IQueryable {
+ class LocationQueryable implements IQueryable<IInstallableUnit> {
private URI location;
public LocationQueryable(URI location) {
@@ -55,7 +56,7 @@ public class DirectorApplication implements IApplication {
Assert.isNotNull(location);
}
- public IQueryResult query(IQuery query, IProgressMonitor monitor) {
+ public IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor) {
return getInstallableUnits(location, query, monitor);
}
}
@@ -122,7 +123,7 @@ public class DirectorApplication implements IApplication {
public static final String LINE_SEPARATOR = System.getProperty("line.separator"); //$NON-NLS-1$
- private static void getURIs(List uris, String spec) throws CoreException {
+ private static void getURIs(List<URI> uris, String spec) throws CoreException {
if (spec == null)
return;
String[] urlSpecs = StringHelper.getArrayFromString(spec, ',');
@@ -155,7 +156,7 @@ public class DirectorApplication implements IApplication {
return null;
}
- private static void parseIUsArgument(List vnames, String arg) {
+ private static void parseIUsArgument(List<IVersionedId> vnames, String arg) {
String[] roots = StringHelper.getArrayFromString(arg, ',');
for (int i = 0; i < roots.length; ++i)
vnames.add(VersionedId.parse(roots[i]));
@@ -175,11 +176,11 @@ public class DirectorApplication implements IApplication {
private URI[] artifactReposForRemoval;
private URI[] metadataReposForRemoval;
- private final List artifactRepositoryLocations = new ArrayList();
- private final List metadataRepositoryLocations = new ArrayList();
- private final List rootsToInstall = new ArrayList();
- private final List rootsToUninstall = new ArrayList();
- private final List rootsToList = new ArrayList();
+ private final List<URI> artifactRepositoryLocations = new ArrayList<URI>();
+ private final List<URI> metadataRepositoryLocations = new ArrayList<URI>();
+ private final List<IVersionedId> rootsToInstall = new ArrayList<IVersionedId>();
+ private final List<IVersionedId> rootsToUninstall = new ArrayList<IVersionedId>();
+ private final List<IVersionedId> rootsToList = new ArrayList<IVersionedId>();
private File bundlePool = null;
private File destination;
@@ -228,41 +229,42 @@ public class DirectorApplication implements IApplication {
}
}
- private IQueryResult collectRootIUs(IQuery query) {
+ private IQueryResult<IInstallableUnit> collectRootIUs(IQuery<IInstallableUnit> query) {
IProgressMonitor nullMonitor = new NullProgressMonitor();
int top = metadataRepositoryLocations.size();
if (top == 0)
return getInstallableUnits(null, query, nullMonitor);
- IQueryable[] locationQueryables = new IQueryable[top];
+ @SuppressWarnings("unchecked")
+ IQueryable<IInstallableUnit>[] locationQueryables = new IQueryable[top];
for (int i = 0; i < top; i++)
- locationQueryables[i] = new LocationQueryable((URI) metadataRepositoryLocations.get(i));
- return new CompoundQueryable(locationQueryables).query(query, nullMonitor);
+ locationQueryables[i] = new LocationQueryable(metadataRepositoryLocations.get(i));
+ return new CompoundQueryable<IInstallableUnit>(locationQueryables).query(query, nullMonitor);
}
- private IInstallableUnit[] collectRoots(IProfile profile, List rootNames, boolean forInstall) throws CoreException {
- ArrayList allRoots = new ArrayList();
+ private IInstallableUnit[] collectRoots(IProfile profile, List<IVersionedId> rootNames, boolean forInstall) throws CoreException {
+ ArrayList<IInstallableUnit> allRoots = new ArrayList<IInstallableUnit>();
int top = rootNames.size();
for (int i = 0; i < top; ++i) {
- IVersionedId rootName = (IVersionedId) rootNames.get(i);
+ IVersionedId rootName = rootNames.get(i);
Version v = rootName.getVersion();
- IQuery query = new InstallableUnitQuery(rootName.getId(), Version.emptyVersion.equals(v) ? VersionRange.emptyRange : new VersionRange(v, true, v, true));
- IQueryResult roots = null;
+ IQuery<IInstallableUnit> query = new InstallableUnitQuery(rootName.getId(), Version.emptyVersion.equals(v) ? VersionRange.emptyRange : new VersionRange(v, true, v, true));
+ IQueryResult<IInstallableUnit> roots = null;
if (forInstall)
- roots = collectRootIUs(new PipedQuery(new IQuery[] {query, new LatestIUVersionQuery()}));
+ roots = collectRootIUs(new PipedQuery<IInstallableUnit>(query, new LatestIUVersionQuery<IInstallableUnit>()));
if (roots == null || roots.isEmpty())
roots = profile.query(query, new NullProgressMonitor());
- Iterator itor = roots.iterator();
+ Iterator<IInstallableUnit> itor = roots.iterator();
if (!itor.hasNext())
throw new CoreException(new Status(IStatus.ERROR, org.eclipse.equinox.internal.p2.director.app.Activator.ID, NLS.bind(Messages.Missing_IU, rootName)));
do {
allRoots.add(itor.next());
} while (itor.hasNext());
}
- return (IInstallableUnit[]) allRoots.toArray(new IInstallableUnit[allRoots.size()]);
+ return allRoots.toArray(new IInstallableUnit[allRoots.size()]);
}
synchronized Bundle getBundle(String symbolicName) {
@@ -282,7 +284,7 @@ public class DirectorApplication implements IApplication {
}
private String getEnvironmentProperty() {
- HashMap values = new HashMap();
+ HashMap<String, String> values = new HashMap<String, String>();
if (os != null)
values.put("osgi.os", os); //$NON-NLS-1$
if (nl != null)
@@ -307,18 +309,18 @@ public class DirectorApplication implements IApplication {
if (flavor == null)
flavor = System.getProperty("eclipse.p2.configurationFlavor", FLAVOR_DEFAULT); //$NON-NLS-1$
- Properties props = new Properties();
- props.setProperty(IProfile.PROP_INSTALL_FOLDER, destination.toString());
+ Map<String, String> props = new HashMap<String, String>();
+ props.put(IProfile.PROP_INSTALL_FOLDER, destination.toString());
if (bundlePool == null)
- props.setProperty(IProfile.PROP_CACHE, sharedLocation == null ? destination.getAbsolutePath() : sharedLocation.getAbsolutePath());
+ props.put(IProfile.PROP_CACHE, sharedLocation == null ? destination.getAbsolutePath() : sharedLocation.getAbsolutePath());
else
- props.setProperty(IProfile.PROP_CACHE, bundlePool.getAbsolutePath());
+ props.put(IProfile.PROP_CACHE, bundlePool.getAbsolutePath());
if (roamingProfile)
- props.setProperty(IProfile.PROP_ROAMING, Boolean.TRUE.toString());
+ props.put(IProfile.PROP_ROAMING, Boolean.TRUE.toString());
String env = getEnvironmentProperty();
if (env != null)
- props.setProperty(IProfile.PROP_ENVIRONMENTS, env);
+ props.put(IProfile.PROP_ENVIRONMENTS, env);
if (profileProperties != null)
putProperties(profileProperties, props);
profile = profileRegistry.addProfile(profileId, props);
@@ -341,7 +343,7 @@ public class DirectorApplication implements IApplication {
boolean anyValid = false; // do we have any valid repos or did they all fail to load?
artifactReposForRemoval = new URI[artifactRepositoryLocations.size()];
for (int i = 0; i < artifactRepositoryLocations.size(); i++) {
- URI location = (URI) artifactRepositoryLocations.get(i);
+ URI location = artifactRepositoryLocations.get(i);
try {
if (!artifactManager.contains(location)) {
artifactManager.loadRepository(location, null);
@@ -369,7 +371,7 @@ public class DirectorApplication implements IApplication {
int top = metadataRepositoryLocations.size();
metadataReposForRemoval = new URI[top];
for (int i = 0; i < top; i++) {
- URI location = (URI) metadataRepositoryLocations.get(i);
+ URI location = metadataRepositoryLocations.get(i);
try {
if (!metadataManager.contains(location)) {
metadataManager.loadRepository(location, null);
@@ -462,27 +464,27 @@ public class DirectorApplication implements IApplication {
if (metadataRepositoryLocations.isEmpty())
missingArgument("metadataRepository"); //$NON-NLS-1$
- ArrayList allRoots = new ArrayList();
+ ArrayList<IInstallableUnit> allRoots = new ArrayList<IInstallableUnit>();
if (rootsToList.size() == 0) {
- Iterator roots = collectRootIUs(InstallableUnitQuery.ANY).iterator();
+ Iterator<IInstallableUnit> roots = collectRootIUs(InstallableUnitQuery.ANY).iterator();
while (roots.hasNext())
allRoots.add(roots.next());
} else {
- Iterator r = rootsToList.iterator();
+ Iterator<IVersionedId> r = rootsToList.iterator();
while (r.hasNext()) {
- IVersionedId rootName = (IVersionedId) r.next();
+ IVersionedId rootName = r.next();
Version v = rootName.getVersion();
- IQuery query = new InstallableUnitQuery(rootName.getId(), Version.emptyVersion.equals(v) ? VersionRange.emptyRange : new VersionRange(v, true, v, true));
- Iterator roots = collectRootIUs(query).iterator();
+ IQuery<IInstallableUnit> query = new InstallableUnitQuery(rootName.getId(), Version.emptyVersion.equals(v) ? VersionRange.emptyRange : new VersionRange(v, true, v, true));
+ Iterator<IInstallableUnit> roots = collectRootIUs(query).iterator();
while (roots.hasNext())
allRoots.add(roots.next());
}
}
Collections.sort(allRoots);
- Iterator i = allRoots.iterator();
+ Iterator<IInstallableUnit> i = allRoots.iterator();
while (i.hasNext()) {
- IInstallableUnit iu = (IInstallableUnit) i.next();
+ IInstallableUnit iu = i.next();
System.out.println(iu.getId() + '=' + iu.getVersion());
}
}
@@ -496,8 +498,8 @@ public class DirectorApplication implements IApplication {
boolean wasRoaming = Boolean.valueOf(profile.getProperty(IProfile.PROP_ROAMING)).booleanValue();
try {
updateRoamingProperties(profile);
- ProvisioningContext context = new ProvisioningContext((URI[]) metadataRepositoryLocations.toArray(new URI[metadataRepositoryLocations.size()]));
- context.setArtifactRepositories((URI[]) artifactRepositoryLocations.toArray(new URI[artifactRepositoryLocations.size()]));
+ ProvisioningContext context = new ProvisioningContext(metadataRepositoryLocations.toArray(new URI[metadataRepositoryLocations.size()]));
+ context.setArtifactRepositories(artifactRepositoryLocations.toArray(new URI[artifactRepositoryLocations.size()]));
ProfileChangeRequest request = buildProvisioningRequest(profile, installs, uninstalls);
printRequest(request);
planAndExecute(profile, context, request);
@@ -679,7 +681,7 @@ public class DirectorApplication implements IApplication {
* @param pairs a comma separated list of tag=value pairs
* @param properties the collection into which the pairs are put
*/
- private void putProperties(String pairs, Properties properties) {
+ private void putProperties(String pairs, Map<String, String> properties) {
String[] propPairs = StringHelper.getArrayFromString(pairs, ',');
for (int i = 0; i < propPairs.length; ++i) {
String propPair = propPairs[i];
@@ -755,8 +757,8 @@ public class DirectorApplication implements IApplication {
throw new CoreException(new Status(IStatus.ERROR, Activator.ID, Messages.Missing_profile));
IProvisioningPlan plan = planner.getDiffPlan(profile, targetProfile, new NullProgressMonitor());
- ProvisioningContext context = new ProvisioningContext((URI[]) metadataRepositoryLocations.toArray(new URI[metadataRepositoryLocations.size()]));
- context.setArtifactRepositories((URI[]) artifactRepositoryLocations.toArray(new URI[artifactRepositoryLocations.size()]));
+ ProvisioningContext context = new ProvisioningContext(metadataRepositoryLocations.toArray(new URI[metadataRepositoryLocations.size()]));
+ context.setArtifactRepositories(artifactRepositoryLocations.toArray(new URI[artifactRepositoryLocations.size()]));
executePlan(context, plan);
}
@@ -777,8 +779,8 @@ public class DirectorApplication implements IApplication {
strm.print(' ');
}
- IQueryResult getInstallableUnits(URI location, IQuery query, IProgressMonitor monitor) {
- IQueryable queryable = null;
+ IQueryResult<IInstallableUnit> getInstallableUnits(URI location, IQuery<IInstallableUnit> query, IProgressMonitor monitor) {
+ IQueryable<IInstallableUnit> queryable = null;
if (location == null) {
queryable = metadataManager;
} else {
@@ -790,7 +792,7 @@ public class DirectorApplication implements IApplication {
}
if (queryable != null)
return queryable.query(query, monitor);
- return Collector.EMPTY_COLLECTOR;
+ return Collector.emptyCollector();
}
private void deeplyPrint(CoreException ce, PrintStream strm, int level) {
@@ -859,16 +861,16 @@ public class DirectorApplication implements IApplication {
return run((String[]) context.getArguments().get("application.args")); //$NON-NLS-1$
}
- private String toString(Map context) {
+ private String toString(Map<String, String> context) {
StringBuffer result = new StringBuffer();
- Iterator entries = context.entrySet().iterator();
+ Iterator<Entry<String, String>> entries = context.entrySet().iterator();
while (entries.hasNext()) {
- Map.Entry entry = (Map.Entry) entries.next();
+ Entry<String, String> entry = entries.next();
if (result.length() > 0)
result.append(',');
- result.append((String) entry.getKey());
+ result.append(entry.getKey());
result.append('=');
- result.append((String) entry.getValue());
+ result.append(entry.getValue());
}
return result.toString();
}
@@ -891,9 +893,9 @@ public class DirectorApplication implements IApplication {
ProfileChangeRequest request = new ProfileChangeRequest(profile);
if (!destination.equals(new File(profile.getProperty(IProfile.PROP_INSTALL_FOLDER))))
- request.setProfileProperty(IProfile.PROP_INSTALL_FOLDER, destination);
+ request.setProfileProperty(IProfile.PROP_INSTALL_FOLDER, destination.getAbsolutePath());
if (!destination.equals(new File(profile.getProperty(IProfile.PROP_CACHE))))
- request.setProfileProperty(IProfile.PROP_CACHE, destination);
+ request.setProfileProperty(IProfile.PROP_CACHE, destination.getAbsolutePath());
if (request.getProfileProperties().size() == 0)
return;
diff --git a/bundles/org.eclipse.equinox.p2.director.app/src_ant/org/eclipse/equinox/p2/director/app/ant/DirectorTask.java b/bundles/org.eclipse.equinox.p2.director.app/src_ant/org/eclipse/equinox/p2/director/app/ant/DirectorTask.java
index ca48ca948..e3d1d56ae 100644
--- a/bundles/org.eclipse.equinox.p2.director.app/src_ant/org/eclipse/equinox/p2/director/app/ant/DirectorTask.java
+++ b/bundles/org.eclipse.equinox.p2.director.app/src_ant/org/eclipse/equinox/p2/director/app/ant/DirectorTask.java
@@ -48,7 +48,7 @@ public class DirectorTask extends Task {
}
private String[] getArguments() {
- List result = new ArrayList();
+ List<String> result = new ArrayList<String>();
if (roaming)
result.add("-roaming");
if (profile != null) {
@@ -106,7 +106,7 @@ public class DirectorTask extends Task {
result.add(Application.COMMAND_NAMES[Application.COMMAND_UNINSTALL]);
result.add(uninstallIU);
}
- return (String[]) result.toArray(new String[result.size()]);
+ return result.toArray(new String[result.size()]);
}
public void setArch(String value) {
diff --git a/bundles/org.eclipse.equinox.p2.director/.classpath b/bundles/org.eclipse.equinox.p2.director/.classpath
index f4025822f..64c5e31b7 100644
--- a/bundles/org.eclipse.equinox.p2.director/.classpath
+++ b/bundles/org.eclipse.equinox.p2.director/.classpath
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<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="output" path="bin"/>
</classpath>
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
index b486accf6..89330506e 100644
--- 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
@@ -1,4 +1,4 @@
-#Sat Feb 28 12:14:19 CET 2009
+#Mon Dec 21 23:16:26 CET 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
org.eclipse.jdt.core.builder.duplicateResourceTask=warning
@@ -8,23 +8,23 @@ 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=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.compliance=1.5
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.assertIdentifier=error
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.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
@@ -71,7 +71,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=en
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.compiler.source=1.5
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
diff --git a/bundles/org.eclipse.equinox.p2.director/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.director/META-INF/MANIFEST.MF
index 78a279d15..2f30c357c 100644
--- a/bundles/org.eclipse.equinox.p2.director/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.director/META-INF/MANIFEST.MF
@@ -38,8 +38,9 @@ Export-Package: org.eclipse.equinox.internal.p2.director;x-friends:="org.eclipse
org.eclipse.pde.core"
Bundle-Activator: org.eclipse.equinox.internal.p2.director.DirectorActivator
Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
- J2SE-1.4
+Bundle-RequiredExecutionEnvironment: J2SE-1.5,
+ J2SE-1.4,
+ CDC-1.1/Foundation-1.1
Require-Bundle: org.eclipse.equinox.common;bundle-version="[3.3.0,4.0.0)",
org.sat4j.core;bundle-version="2.1.0",
org.sat4j.pb;bundle-version="2.1.0",
diff --git a/bundles/org.eclipse.equinox.p2.director/build.properties b/bundles/org.eclipse.equinox.p2.director/build.properties
index 9334e284d..9ac550cbd 100644
--- a/bundles/org.eclipse.equinox.p2.director/build.properties
+++ b/bundles/org.eclipse.equinox.p2.director/build.properties
@@ -16,3 +16,5 @@ bin.includes = META-INF/,\
plugin.properties
src.includes = about.html
source.. = src/
+javacTarget=jsr14
+javacSource=1.5
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/ApplicablePatchQuery.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/ApplicablePatchQuery.java
index 2feb2a82f..41460f283 100644
--- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/ApplicablePatchQuery.java
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/ApplicablePatchQuery.java
@@ -18,7 +18,7 @@ import org.eclipse.equinox.p2.metadata.IRequirement;
/**
* A query that accepts any patch that applies to a given installable unit.
*/
-public class ApplicablePatchQuery extends MatchQuery {
+public class ApplicablePatchQuery extends MatchQuery<IInstallableUnit> {
IInstallableUnit iu;
/**
@@ -30,7 +30,7 @@ public class ApplicablePatchQuery extends MatchQuery {
this.iu = iu;
}
- public boolean isMatch(Object candidate) {
+ public boolean isMatch(IInstallableUnit candidate) {
if (!(candidate instanceof IInstallableUnitPatch))
return false;
IInstallableUnitPatch patchIU = (IInstallableUnitPatch) candidate;
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/AttachmentHelper.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/AttachmentHelper.java
index bccf51be2..f22e580bc 100644
--- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/AttachmentHelper.java
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/AttachmentHelper.java
@@ -21,38 +21,36 @@ import org.eclipse.equinox.p2.metadata.query.FragmentQuery;
public class AttachmentHelper {
private static final IInstallableUnitFragment[] NO_FRAGMENTS = new IInstallableUnitFragment[0];
- public static Collection attachFragments(Iterator toAttach, Map fragmentsToIUs) {
- Map fragmentBindings = new HashMap();
+ public static Collection<IInstallableUnit> attachFragments(Iterator<IInstallableUnit> toAttach, Map<IInstallableUnitFragment, List<IInstallableUnit>> fragmentsToIUs) {
+ Map<IInstallableUnit, IInstallableUnitFragment> fragmentBindings = new HashMap<IInstallableUnit, IInstallableUnitFragment>();
//Build a map inverse of the one provided in input (host --> List of fragments)
- Map iusToFragment = new HashMap(fragmentsToIUs.size());
- for (Iterator iterator = fragmentsToIUs.entrySet().iterator(); iterator.hasNext();) {
- Entry mapping = (Entry) iterator.next();
- IInstallableUnitFragment fragment = (IInstallableUnitFragment) mapping.getKey();
- List existingMatches = (List) mapping.getValue();
+ Map<IInstallableUnit, List<IInstallableUnitFragment>> iusToFragment = new HashMap<IInstallableUnit, List<IInstallableUnitFragment>>(fragmentsToIUs.size());
+ for (Iterator<Entry<IInstallableUnitFragment, List<IInstallableUnit>>> iterator = fragmentsToIUs.entrySet().iterator(); iterator.hasNext();) {
+ Entry<IInstallableUnitFragment, List<IInstallableUnit>> mapping = iterator.next();
+ IInstallableUnitFragment fragment = mapping.getKey();
+ List<IInstallableUnit> existingMatches = mapping.getValue();
- for (Iterator iterator2 = existingMatches.iterator(); iterator2.hasNext();) {
- Object host = iterator2.next();
- List potentialFragments = (List) iusToFragment.get(host);
+ for (Iterator<IInstallableUnit> iterator2 = existingMatches.iterator(); iterator2.hasNext();) {
+ IInstallableUnit host = iterator2.next();
+ List<IInstallableUnitFragment> potentialFragments = iusToFragment.get(host);
if (potentialFragments == null) {
- potentialFragments = new ArrayList();
+ potentialFragments = new ArrayList<IInstallableUnitFragment>();
iusToFragment.put(host, potentialFragments);
}
potentialFragments.add(fragment);
}
}
- for (Iterator iterator = iusToFragment.entrySet().iterator(); iterator.hasNext();) {
- Entry entry = (Entry) iterator.next();
- IInstallableUnit hostIU = (IInstallableUnit) entry.getKey();
- List potentialIUFragments = (List) entry.getValue();
- ArrayList applicableFragments = new ArrayList();
- for (Iterator iterator2 = potentialIUFragments.iterator(); iterator2.hasNext();) {
- IInstallableUnit dependentIU = (IInstallableUnitFragment) iterator2.next();
- if (hostIU.equals(dependentIU) || !FragmentQuery.isFragment(dependentIU))
+ for (Iterator<Entry<IInstallableUnit, List<IInstallableUnitFragment>>> iterator = iusToFragment.entrySet().iterator(); iterator.hasNext();) {
+ Entry<IInstallableUnit, List<IInstallableUnitFragment>> entry = iterator.next();
+ IInstallableUnit hostIU = entry.getKey();
+ List<IInstallableUnitFragment> potentialIUFragments = entry.getValue();
+ ArrayList<IInstallableUnitFragment> applicableFragments = new ArrayList<IInstallableUnitFragment>();
+ for (Iterator<IInstallableUnitFragment> iterator2 = potentialIUFragments.iterator(); iterator2.hasNext();) {
+ IInstallableUnitFragment potentialFragment = iterator2.next();
+ if (hostIU.equals(potentialFragment))
continue;
- IInstallableUnitFragment potentialFragment = (IInstallableUnitFragment) dependentIU;
-
// Check to make sure the host meets the requirements of the fragment
IRequirement reqsFromFragment[] = potentialFragment.getHost();
boolean match = true;
@@ -74,8 +72,8 @@ public class AttachmentHelper {
IInstallableUnitFragment theFragment = null;
int specificityLevel = 0;
- for (Iterator iterator4 = applicableFragments.iterator(); iterator4.hasNext();) {
- IInstallableUnitFragment fragment = (IInstallableUnitFragment) iterator4.next();
+ for (Iterator<IInstallableUnitFragment> iterator4 = applicableFragments.iterator(); iterator4.hasNext();) {
+ IInstallableUnitFragment fragment = iterator4.next();
if (fragment.getHost().length > specificityLevel) {
theFragment = fragment;
specificityLevel = fragment.getHost().length;
@@ -85,9 +83,9 @@ public class AttachmentHelper {
fragmentBindings.put(hostIU, theFragment);
}
//build the collection of resolved IUs
- Collection result = new HashSet();
+ Collection<IInstallableUnit> result = new HashSet<IInstallableUnit>();
while (toAttach.hasNext()) {
- IInstallableUnit iu = (IInstallableUnit) toAttach.next();
+ IInstallableUnit iu = toAttach.next();
if (iu == null)
continue;
//just return fragments as they are
@@ -96,7 +94,7 @@ public class AttachmentHelper {
continue;
}
//return a new IU that combines the IU with its bound fragments
- IInstallableUnitFragment fragment = (IInstallableUnitFragment) fragmentBindings.get(iu);
+ IInstallableUnitFragment fragment = fragmentBindings.get(iu);
IInstallableUnitFragment[] fragments;
if (fragment == null)
fragments = NO_FRAGMENTS;
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Explanation.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Explanation.java
index ecc502d68..5d42c3741 100644
--- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Explanation.java
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Explanation.java
@@ -17,7 +17,7 @@ import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.IRequirement;
import org.eclipse.osgi.util.NLS;
-public abstract class Explanation implements Comparable {
+public abstract class Explanation implements Comparable<Explanation> {
public static class PatchedHardRequirement extends Explanation {
public final IInstallableUnit iu;
@@ -197,8 +197,7 @@ public abstract class Explanation implements Comparable {
super();
}
- public int compareTo(Object arg0) {
- Explanation exp = (Explanation) arg0;
+ public int compareTo(Explanation exp) {
if (this.orderValue() == exp.orderValue()) {
return this.toString().compareTo(exp.toString());
}
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/OperationGenerator.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/OperationGenerator.java
index b1042905e..51ec7853d 100644
--- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/OperationGenerator.java
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/OperationGenerator.java
@@ -21,83 +21,61 @@ import org.eclipse.equinox.p2.metadata.IInstallableUnit;
public class OperationGenerator {
private static final IInstallableUnit NULL_IU = MetadataFactory.createResolvedInstallableUnit(MetadataFactory.createInstallableUnit(new InstallableUnitDescription()), new IInstallableUnitFragment[0]);
- public InstallableUnitOperand[] generateOperation(Collection from_, Collection to_) {
- Collection intersection = new HashSet(from_);
+ public List<InstallableUnitOperand> generateOperation(Collection<IInstallableUnit> from_, Collection<IInstallableUnit> to_) {
+ Collection<IInstallableUnit> intersection = new HashSet<IInstallableUnit>(from_);
intersection.retainAll(to_);
- HashSet tmpFrom = new HashSet(from_);
- HashSet tmpTo = new HashSet(to_);
+ HashSet<IInstallableUnit> tmpFrom = new HashSet<IInstallableUnit>(from_);
+ HashSet<IInstallableUnit> tmpTo = new HashSet<IInstallableUnit>(to_);
tmpFrom.removeAll(intersection);
tmpTo.removeAll(intersection);
- List from = new ArrayList(tmpFrom);
+ List<IInstallableUnit> from = new ArrayList<IInstallableUnit>(tmpFrom);
Collections.sort(from);
- List to = new ArrayList(tmpTo);
+ List<IInstallableUnit> to = new ArrayList<IInstallableUnit>(tmpTo);
Collections.sort(to);
- ArrayList operations = new ArrayList();
+ ArrayList<InstallableUnitOperand> operations = new ArrayList<InstallableUnitOperand>();
generateUpdates(from, to, operations);
generateInstallUninstall(from, to, operations);
generateConfigurationChanges(to_, intersection, operations);
- InstallableUnitOperand[] ops = (InstallableUnitOperand[]) operations.toArray(new InstallableUnitOperand[operations.size()]);
- return ops;
+ return operations;
}
//This generates operations that are causing the IUs to be reconfigured.
- private void generateConfigurationChanges(Collection to_, Collection intersection, ArrayList operations) {
+ private void generateConfigurationChanges(Collection<IInstallableUnit> to_, Collection<IInstallableUnit> intersection, ArrayList<InstallableUnitOperand> operations) {
if (intersection.size() == 0)
return;
//We retain from each set the things that are the same.
//Note that despite the fact that they are the same, a different CU can be attached.
//The objects contained in the intersection are the one that were originally in the from collection.
- TreeSet to = new TreeSet(to_);
- for (Iterator iterator = intersection.iterator(); iterator.hasNext();) {
- IInstallableUnit fromIU = (IInstallableUnit) iterator.next();
- IInstallableUnit toIU = (IInstallableUnit) to.tailSet(fromIU).first();
+ TreeSet<IInstallableUnit> to = new TreeSet<IInstallableUnit>(to_);
+ for (Iterator<IInstallableUnit> iterator = intersection.iterator(); iterator.hasNext();) {
+ IInstallableUnit fromIU = iterator.next();
+ IInstallableUnit toIU = to.tailSet(fromIU).first();
generateConfigurationOperation(fromIU, toIU, operations);
}
}
- private void generateConfigurationOperation(IInstallableUnit fromIU, IInstallableUnit toIU, ArrayList operations) {
- IInstallableUnitFragment[] fromFragments = fromIU.getFragments();
- IInstallableUnitFragment[] toFragments = toIU.getFragments();
+ private void generateConfigurationOperation(IInstallableUnit fromIU, IInstallableUnit toIU, ArrayList<InstallableUnitOperand> operations) {
+ List<IInstallableUnitFragment> fromFragments = fromIU.getFragments();
+ List<IInstallableUnitFragment> toFragments = toIU.getFragments();
if (fromFragments == toFragments)
return;
//Check to see if the two arrays are equals independently of the order of the fragments
- boolean different = false;
- if (fromFragments != null && toFragments != null) {
- if (fromFragments.length != toFragments.length)
- different = true;
- else {
- for (int i = 0; i < fromFragments.length; i++) {
- boolean found = false;
- for (int j = 0; j < toFragments.length; j++) {
- if (fromFragments[i].equals(toFragments[j]))
- found = true;
- }
- if (!found) {
- different = true;
- break;
- }
- }
- }
- } else {
- //One of the two array is null
- different = true;
- }
- if (!different)
+ if (fromFragments.size() == toFragments.size() && fromFragments.containsAll(toFragments))
return;
operations.add(new InstallableUnitOperand(fromIU, toIU));
}
- private void generateInstallUninstall(List from, List to, ArrayList operations) {
+ private void generateInstallUninstall(List<IInstallableUnit> from, List<IInstallableUnit> to, ArrayList<InstallableUnitOperand> operations) {
int toIdx = 0;
int fromIdx = 0;
while (fromIdx != from.size() && toIdx != to.size()) {
- IInstallableUnit fromIU = (IInstallableUnit) from.get(fromIdx);
- IInstallableUnit toIU = (IInstallableUnit) to.get(toIdx);
+ IInstallableUnit fromIU = from.get(fromIdx);
+ IInstallableUnit toIU = to.get(toIdx);
int comparison = toIU.compareTo(fromIU);
if (comparison < 0) {
operations.add(createInstallOperation(toIU));
@@ -113,36 +91,36 @@ public class OperationGenerator {
}
if (fromIdx != from.size()) {
for (int i = fromIdx; i < from.size(); i++) {
- operations.add(createUninstallOperation((IInstallableUnit) from.get(i)));
+ operations.add(createUninstallOperation(from.get(i)));
}
}
if (toIdx != to.size()) {
for (int i = toIdx; i < to.size(); i++) {
- operations.add(createInstallOperation((IInstallableUnit) to.get(i)));
+ operations.add(createInstallOperation(to.get(i)));
}
}
}
- private void generateUpdates(List from, List to, ArrayList operations) {
- Set processed = new HashSet();
- Set removedFromTo = new HashSet();
-
+ private void generateUpdates(List<IInstallableUnit> from, List<IInstallableUnit> to, ArrayList<InstallableUnitOperand> operations) {
if (to.isEmpty() || from.isEmpty())
return;
- Map fromById = new HashMap();
- for (Iterator iterator = from.iterator(); iterator.hasNext();) {
- IInstallableUnit iuFrom = (IInstallableUnit) iterator.next();
- List ius = (List) fromById.get(iuFrom.getId());
+ Set<IInstallableUnit> processed = new HashSet<IInstallableUnit>();
+ Set<IInstallableUnit> removedFromTo = new HashSet<IInstallableUnit>();
+
+ Map<String, List<IInstallableUnit>> fromById = new HashMap<String, List<IInstallableUnit>>();
+ for (Iterator<IInstallableUnit> iterator = from.iterator(); iterator.hasNext();) {
+ IInstallableUnit iuFrom = iterator.next();
+ List<IInstallableUnit> ius = fromById.get(iuFrom.getId());
if (ius == null) {
- ius = new ArrayList();
+ ius = new ArrayList<IInstallableUnit>();
fromById.put(iuFrom.getId(), ius);
}
ius.add(iuFrom);
}
for (int toIdx = 0; toIdx < to.size(); toIdx++) {
- IInstallableUnit iuTo = (IInstallableUnit) to.get(toIdx);
+ IInstallableUnit iuTo = to.get(toIdx);
if (iuTo.getId().equals(next(to, toIdx).getId())) { //This handle the case where there are multiple versions of the same IU in the target. Eg we are trying to update from A 1.0.0 to A 1.1.1 and A 1.2.2
toIdx = skip(to, iuTo, toIdx) - 1;
//System.out.println("Can't update " + iuTo + " because another iu with same id is in the target state");
@@ -151,18 +129,18 @@ public class OperationGenerator {
if (iuTo.getUpdateDescriptor() == null)
continue;
- List fromIdIndexList = (List) fromById.get(iuTo.getUpdateDescriptor().getId());
+ List<IInstallableUnit> fromIdIndexList = fromById.get(iuTo.getUpdateDescriptor().getId());
if (fromIdIndexList == 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
InstallableUnitQuery updateQuery = new InstallableUnitQuery(iuTo.getUpdateDescriptor().getId(), iuTo.getUpdateDescriptor().getRange());
- Iterator updates = updateQuery.perform(fromIdIndexList.iterator()).iterator();
+ Iterator<IInstallableUnit> updates = updateQuery.perform(fromIdIndexList.iterator()).iterator();
if (!updates.hasNext()) { //Nothing to update from.
continue;
}
- IInstallableUnit iuFrom = (IInstallableUnit) updates.next();
+ IInstallableUnit iuFrom = 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;
@@ -194,17 +172,17 @@ public class OperationGenerator {
return new InstallableUnitOperand(from, to);
}
- private IInstallableUnit next(List l, int i) {
+ private IInstallableUnit next(List<IInstallableUnit> l, int i) {
i++;
if (i >= l.size())
return NULL_IU;
- return (IInstallableUnit) l.get(i);
+ return l.get(i);
}
- private int skip(List c, IInstallableUnit id, int idx) {
+ private int skip(List<IInstallableUnit> c, IInstallableUnit id, int idx) {
int i = idx;
for (; i < c.size(); i++) {
- if (!id.getId().equals(((IInstallableUnit) c.get(i)).getId()))
+ if (!id.getId().equals(c.get(i).getId()))
return i;
}
return i;
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/PermissiveSlicer.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/PermissiveSlicer.java
index 45e305a8d..a81fa2635 100644
--- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/PermissiveSlicer.java
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/PermissiveSlicer.java
@@ -22,7 +22,7 @@ public class PermissiveSlicer extends Slicer {
private boolean evalFilterTo;
private boolean onlyFilteredRequirements;
- public PermissiveSlicer(IQueryable input, Dictionary context, boolean includeOptionalDependencies, boolean everythingGreedy, boolean evalFilterTo, boolean considerOnlyStrictDependency, boolean onlyFilteredRequirements) {
+ public PermissiveSlicer(IQueryable<IInstallableUnit> input, Dictionary<? extends Object, ? extends Object> context, boolean includeOptionalDependencies, boolean everythingGreedy, boolean evalFilterTo, boolean considerOnlyStrictDependency, boolean onlyFilteredRequirements) {
super(input, context, true);
this.considerFilter = (context != null && context.size() > 1) ? true : false;
this.includeOptionalDependencies = includeOptionalDependencies;
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java
index 53b91ea0d..21ed85341 100644
--- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java
@@ -16,6 +16,7 @@ import java.util.*;
import java.util.Map.Entry;
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils;
import org.eclipse.equinox.internal.p2.core.helpers.Tracing;
import org.eclipse.equinox.internal.p2.metadata.IRequiredCapability;
import org.eclipse.equinox.internal.p2.metadata.LDAPQuery;
@@ -41,28 +42,28 @@ import org.sat4j.specs.*;
public class Projector {
static boolean DEBUG = Tracing.DEBUG_PLANNER_PROJECTOR;
private static boolean DEBUG_ENCODING = false;
- private IQueryable picker;
+ private IQueryable<IInstallableUnit> picker;
private QueryableArray patches;
- private Map noopVariables; //key IU, value AbstractVariable
- private List abstractVariables;
+ private Map<IInstallableUnit, AbstractVariable> noopVariables; //key IU, value AbstractVariable
+ private List<AbstractVariable> abstractVariables;
- private TwoTierMap slice; //The IUs that have been considered to be part of the problem
+ private Map<String, Map<Version, IInstallableUnit>> slice; //The IUs that have been considered to be part of the problem
- private Dictionary selectionContext;
+ private Dictionary<String, String> selectionContext;
- DependencyHelper dependencyHelper;
- private Collection solution;
- private Collection assumptions;
+ DependencyHelper<Object, Explanation> dependencyHelper;
+ private Collection<IInstallableUnit> solution;
+ private Collection<Object> assumptions;
private MultiStatus result;
- private Collection alreadyInstalledIUs;
- private IQueryable lastState;
+ private Collection<IInstallableUnit> alreadyInstalledIUs;
+ private IQueryable<IInstallableUnit> lastState;
private boolean considerMetaRequirements;
private IInstallableUnit entryPoint;
- private Map fragments = new HashMap();
+ private Map<IInstallableUnitFragment, Set<IInstallableUnit>> fragments = new HashMap<IInstallableUnitFragment, Set<IInstallableUnit>>();
static class AbstractVariable {
public String toString() {
@@ -74,7 +75,7 @@ public class Projector {
* Job for computing SAT failure explanation in the background.
*/
class ExplanationJob extends Job {
- private Set explanation;
+ private Set<Explanation> explanation;
public ExplanationJob() {
super(Messages.Planner_NoSolution);
@@ -91,7 +92,7 @@ public class Projector {
dependencyHelper.stopExplanation();
}
- public Set getExplanationResult() {
+ public Set<Explanation> getExplanationResult() {
return explanation;
}
@@ -107,7 +108,7 @@ public class Projector {
long stop = System.currentTimeMillis();
Tracing.debug("Explanation found: " + (stop - start)); //$NON-NLS-1$
Tracing.debug("Explanation:"); //$NON-NLS-1$
- for (Iterator i = explanation.iterator(); i.hasNext();) {
+ for (Iterator<Explanation> i = explanation.iterator(); i.hasNext();) {
Tracing.debug(i.next().toString());
}
}
@@ -117,7 +118,7 @@ public class Projector {
} finally {
//must never have a null result, because caller is waiting on result to be non-null
if (explanation == null)
- explanation = Collections.EMPTY_SET;
+ explanation = CollectionUtils.emptySet();
}
synchronized (this) {
ExplanationJob.this.notify();
@@ -127,14 +128,14 @@ public class Projector {
}
- public Projector(IQueryable q, Dictionary context, boolean considerMetaRequirements) {
+ public Projector(IQueryable<IInstallableUnit> q, Dictionary<String, String> context, boolean considerMetaRequirements) {
picker = q;
- noopVariables = new HashMap();
- slice = new TwoTierMap();
+ noopVariables = new HashMap<IInstallableUnit, AbstractVariable>();
+ slice = new HashMap<String, Map<Version, IInstallableUnit>>();
selectionContext = context;
- abstractVariables = new ArrayList();
+ abstractVariables = new ArrayList<AbstractVariable>();
result = new MultiStatus(DirectorActivator.PI_DIRECTOR, IStatus.OK, Messages.Planner_Problems_resolving_plan, null);
- assumptions = new ArrayList();
+ assumptions = new ArrayList<Object>();
this.considerMetaRequirements = considerMetaRequirements;
}
@@ -142,7 +143,7 @@ public class Projector {
return !lastState.query(new InstallableUnitQuery(iu), null).isEmpty();
}
- public void encode(IInstallableUnit entryPointIU, IInstallableUnit[] alreadyExistingRoots, IQueryable installedIUs, IInstallableUnit[] newRoots, IProgressMonitor monitor) {
+ public void encode(IInstallableUnit entryPointIU, IInstallableUnit[] alreadyExistingRoots, IQueryable<IInstallableUnit> installedIUs, IInstallableUnit[] newRoots, IProgressMonitor monitor) {
alreadyInstalledIUs = Arrays.asList(alreadyExistingRoots);
lastState = installedIUs;
this.entryPoint = entryPointIU;
@@ -159,12 +160,12 @@ public class Projector {
solver = SolverFactory.newEclipseP2();
}
solver.setTimeoutOnConflicts(1000);
- IQueryResult queryResult = picker.query(InstallableUnitQuery.ANY, null);
- dependencyHelper = new DependencyHelper(solver);
+ IQueryResult<IInstallableUnit> queryResult = picker.query(InstallableUnitQuery.ANY, null);
+ dependencyHelper = new DependencyHelper<Object, Explanation>(solver);
- Iterator iusToEncode = queryResult.iterator();
+ Iterator<IInstallableUnit> iusToEncode = queryResult.iterator();
if (DEBUG) {
- List iusToOrder = new ArrayList();
+ List<IInstallableUnit> iusToOrder = new ArrayList<IInstallableUnit>();
while (iusToEncode.hasNext()) {
iusToOrder.add(iusToEncode.next());
}
@@ -176,7 +177,7 @@ public class Projector {
result.merge(Status.CANCEL_STATUS);
throw new OperationCanceledException();
}
- IInstallableUnit iuToEncode = (IInstallableUnit) iusToEncode.next();
+ IInstallableUnit iuToEncode = iusToEncode.next();
if (iuToEncode != entryPointIU) {
processIU(iuToEncode, false);
}
@@ -203,24 +204,24 @@ public class Projector {
//Create an optimization function favoring the highest version of each IU
private void createOptimizationFunction(IInstallableUnit metaIu) {
- List weightedObjects = new ArrayList();
+ List<WeightedObject<? extends Object>> weightedObjects = new ArrayList<WeightedObject<? extends Object>>();
- Set s = slice.entrySet();
+ Set<Entry<String, Map<Version, IInstallableUnit>>> s = slice.entrySet();
final BigInteger POWER = BigInteger.valueOf(2);
BigInteger maxWeight = POWER;
- for (Iterator iterator = s.iterator(); iterator.hasNext();) {
- Map.Entry entry = (Map.Entry) iterator.next();
- HashMap conflictingEntries = (HashMap) entry.getValue();
+ for (Iterator<Entry<String, Map<Version, IInstallableUnit>>> iterator = s.iterator(); iterator.hasNext();) {
+ Entry<String, Map<Version, IInstallableUnit>> entry = iterator.next();
+ Map<Version, IInstallableUnit> conflictingEntries = entry.getValue();
if (conflictingEntries.size() == 1) {
continue;
}
- List toSort = new ArrayList(conflictingEntries.values());
+ List<IInstallableUnit> toSort = new ArrayList<IInstallableUnit>(conflictingEntries.values());
Collections.sort(toSort, Collections.reverseOrder());
BigInteger weight = POWER;
int count = toSort.size();
for (int i = 0; i < count; i++) {
- IInstallableUnit iu = (IInstallableUnit) toSort.get(i);
+ IInstallableUnit iu = toSort.get(i);
weightedObjects.add(WeightedObject.newWO(iu, isInstalled(iu) ? BigInteger.ONE : weight));
weight = weight.multiply(POWER);
}
@@ -231,7 +232,7 @@ public class Projector {
maxWeight = maxWeight.multiply(POWER);
// Weight the no-op variables beneath the abstract variables
- for (Iterator iterator = noopVariables.values().iterator(); iterator.hasNext();) {
+ for (Iterator<AbstractVariable> iterator = noopVariables.values().iterator(); iterator.hasNext();) {
weightedObjects.add(WeightedObject.newWO(iterator.next(), maxWeight));
}
@@ -239,7 +240,7 @@ public class Projector {
// Add the abstract variables
BigInteger abstractWeight = maxWeight.negate();
- for (Iterator iterator = abstractVariables.iterator(); iterator.hasNext();) {
+ for (Iterator<AbstractVariable> iterator = abstractVariables.iterator(); iterator.hasNext();) {
weightedObjects.add(WeightedObject.newWO(iterator.next(), abstractWeight));
}
@@ -247,14 +248,16 @@ public class Projector {
BigInteger optionalWeight = maxWeight.negate();
long countOptional = 1;
- List requestedPatches = new ArrayList();
- IRequirement[] reqs = metaIu.getRequiredCapabilities();
- for (int j = 0; j < reqs.length; j++) {
- if (reqs[j].getMin() > 0)
+ List<IInstallableUnit> requestedPatches = new ArrayList<IInstallableUnit>();
+ List<IRequirement> reqs = metaIu.getRequiredCapabilities();
+ int top = reqs.size();
+ for (int j = 0; j < top; j++) {
+ IRequirement req = reqs.get(j);
+ if (req.getMin() > 0)
continue;
- IQueryResult matches = picker.query(reqs[j].getMatches(), null);
- for (Iterator iterator = matches.iterator(); iterator.hasNext();) {
- IInstallableUnit match = (IInstallableUnit) iterator.next();
+ IQueryResult<IInstallableUnit> matches = picker.query(req.getMatches(), null);
+ for (Iterator<IInstallableUnit> iterator = matches.iterator(); iterator.hasNext();) {
+ IInstallableUnit match = iterator.next();
if (match instanceof IInstallableUnitPatch) {
requestedPatches.add(match);
countOptional = countOptional + 1;
@@ -265,7 +268,7 @@ public class Projector {
}
BigInteger patchWeight = maxWeight.multiply(POWER).multiply(BigInteger.valueOf(countOptional)).negate();
- for (Iterator iterator = requestedPatches.iterator(); iterator.hasNext();) {
+ for (Iterator<IInstallableUnit> iterator = requestedPatches.iterator(); iterator.hasNext();) {
weightedObjects.add(WeightedObject.newWO(iterator.next(), patchWeight));
}
if (!weightedObjects.isEmpty()) {
@@ -273,11 +276,11 @@ public class Projector {
}
}
- private void createObjectiveFunction(List weightedObjects) {
+ private void createObjectiveFunction(List<WeightedObject<? extends Object>> weightedObjects) {
if (DEBUG) {
StringBuffer b = new StringBuffer();
- for (Iterator i = weightedObjects.iterator(); i.hasNext();) {
- WeightedObject object = (WeightedObject) i.next();
+ for (Iterator<WeightedObject<? extends Object>> i = weightedObjects.iterator(); i.hasNext();) {
+ WeightedObject<? extends Object> object = i.next();
if (b.length() > 0)
b.append(", "); //$NON-NLS-1$
b.append(object.getWeight());
@@ -286,7 +289,9 @@ public class Projector {
}
Tracing.debug("objective function: " + b); //$NON-NLS-1$
}
- dependencyHelper.setObjectiveFunction((WeightedObject[]) weightedObjects.toArray(new WeightedObject[weightedObjects.size()]));
+ @SuppressWarnings("unchecked")
+ WeightedObject<Object>[] array = (WeightedObject<Object>[]) weightedObjects.toArray(new WeightedObject<?>[weightedObjects.size()]);
+ dependencyHelper.setObjectiveFunction(array);
}
private void createMustHave(IInstallableUnit iu, IInstallableUnit[] alreadyExistingRoots, IInstallableUnit[] newRoots) throws ContradictionException {
@@ -307,7 +312,7 @@ public class Projector {
// Check whether the requirement is applicable
private boolean isApplicable(IRequirement req) {
- IQuery filter = req.getFilter();
+ IQuery<Boolean> filter = req.getFilter();
if (filter == null)
return true;
if (filter instanceof LDAPQuery)
@@ -330,16 +335,16 @@ public class Projector {
}
}
- private void expandNegatedRequirement(IRequirement req, IInstallableUnit iu, List optionalAbstractRequirements, boolean isRootIu) throws ContradictionException {
+ private void expandNegatedRequirement(IRequirement req, IInstallableUnit iu, List<AbstractVariable> optionalAbstractRequirements, boolean isRootIu) throws ContradictionException {
if (!isApplicable(req))
return;
- List matches = getApplicableMatches(req);
+ List<IInstallableUnit> matches = getApplicableMatches(req);
if (matches.isEmpty()) {
return;
}
Explanation explanation;
if (isRootIu) {
- IInstallableUnit reqIu = (IInstallableUnit) matches.get(0);
+ IInstallableUnit reqIu = matches.get(0);
if (alreadyInstalledIUs.contains(reqIu)) {
explanation = new Explanation.IUInstalled(reqIu);
} else {
@@ -351,22 +356,22 @@ public class Projector {
createNegationImplication(iu, matches, explanation);
}
- private void expandRequirement(IRequirement req, IInstallableUnit iu, List optionalAbstractRequirements, boolean isRootIu) throws ContradictionException {
+ private void expandRequirement(IRequirement req, IInstallableUnit iu, List<AbstractVariable> optionalAbstractRequirements, boolean isRootIu) throws ContradictionException {
if (req.getMax() == 0) {
expandNegatedRequirement(req, iu, optionalAbstractRequirements, isRootIu);
return;
}
if (!isApplicable(req))
return;
- List matches = getApplicableMatches(req);
+ List<IInstallableUnit> matches = getApplicableMatches(req);
if (isHostRequirement(iu, req)) {
- rememberHostMatches(iu, matches);
+ rememberHostMatches((IInstallableUnitFragment) iu, matches);
}
if (req.getMin() > 0) {
if (matches.isEmpty()) {
missingRequirement(iu, req);
} else {
- IInstallableUnit reqIu = (IInstallableUnit) matches.get(0);
+ IInstallableUnit reqIu = matches.get(0);
Explanation explanation;
if (isRootIu) {
if (alreadyInstalledIUs.contains(reqIu)) {
@@ -388,13 +393,14 @@ public class Projector {
}
}
- private void expandRequirements(IRequirement[] reqs, IInstallableUnit iu, boolean isRootIu) throws ContradictionException {
- if (reqs.length == 0) {
+ private void expandRequirements(List<IRequirement> reqs, IInstallableUnit iu, boolean isRootIu) throws ContradictionException {
+ int top = reqs.size();
+ if (top == 0) {
return;
}
- List optionalAbstractRequirements = new ArrayList();
- for (int i = 0; i < reqs.length; i++) {
- expandRequirement(reqs[i], iu, optionalAbstractRequirements, isRootIu);
+ List<AbstractVariable> optionalAbstractRequirements = new ArrayList<AbstractVariable>();
+ for (int i = 0; i < top; i++) {
+ expandRequirement(reqs.get(i), iu, optionalAbstractRequirements, isRootIu);
}
createOptionalityExpression(iu, optionalAbstractRequirements);
}
@@ -402,13 +408,18 @@ public class Projector {
public void processIU(IInstallableUnit iu, boolean isRootIU) throws ContradictionException {
iu = iu.unresolved();
- slice.put(iu.getId(), iu.getVersion(), iu);
+ Map<Version, IInstallableUnit> iuSlice = slice.get(iu.getId());
+ if (iuSlice == null) {
+ iuSlice = new HashMap<Version, IInstallableUnit>();
+ slice.put(iu.getId(), iuSlice);
+ }
+ iuSlice.put(iu.getVersion(), iu);
if (!isApplicable(iu)) {
createNegation(iu, null);
return;
}
- IQueryResult applicablePatches = getApplicablePatches(iu);
+ IQueryResult<IInstallableUnit> applicablePatches = getApplicablePatches(iu);
expandLifeCycle(iu, isRootIU);
//No patches apply, normal code path
if (applicablePatches.isEmpty()) {
@@ -419,26 +430,33 @@ public class Projector {
}
}
- private IRequirement[] getRequiredCapabilities(IInstallableUnit iu) {
- if (considerMetaRequirements == false || iu.getMetaRequiredCapabilities().length == 0)
- return iu.getRequiredCapabilities();
- IRequirement[] aggregatedCapabilities = new IRequirement[iu.getRequiredCapabilities().length + iu.getMetaRequiredCapabilities().length];
- System.arraycopy(iu.getRequiredCapabilities(), 0, aggregatedCapabilities, 0, iu.getRequiredCapabilities().length);
- System.arraycopy(iu.getMetaRequiredCapabilities(), 0, aggregatedCapabilities, iu.getRequiredCapabilities().length, iu.getMetaRequiredCapabilities().length);
- return aggregatedCapabilities;
+ private List<IRequirement> getRequiredCapabilities(IInstallableUnit iu) {
+ List<IRequirement> rqs = iu.getRequiredCapabilities();
+ if (!considerMetaRequirements)
+ return rqs;
+
+ List<IRequirement> metaRqs = iu.getMetaRequiredCapabilities();
+ if (metaRqs.isEmpty())
+ return rqs;
+
+ ArrayList<IRequirement> aggregatedRqs = new ArrayList<IRequirement>(rqs.size() + metaRqs.size());
+ aggregatedRqs.addAll(rqs);
+ aggregatedRqs.addAll(metaRqs);
+ return aggregatedRqs;
}
static final class Pending {
- List matches;
+ List<IInstallableUnit> matches;
Explanation explanation;
Object left;
}
- private void expandRequirementsWithPatches(IInstallableUnit iu, IQueryResult applicablePatches, boolean isRootIu) throws ContradictionException {
+ private void expandRequirementsWithPatches(IInstallableUnit iu, IQueryResult<IInstallableUnit> applicablePatches, boolean isRootIu) throws ContradictionException {
//Unmodified dependencies
- Map unchangedRequirements = new HashMap(getRequiredCapabilities(iu).length);
- Map nonPatchedRequirements = new HashMap(getRequiredCapabilities(iu).length);
- for (Iterator iterator = applicablePatches.iterator(); iterator.hasNext();) {
+ List<IRequirement> iuRequirements = getRequiredCapabilities(iu);
+ Map<IRequirement, List<IInstallableUnitPatch>> unchangedRequirements = new HashMap<IRequirement, List<IInstallableUnitPatch>>(iuRequirements.size());
+ Map<IRequirement, Pending> nonPatchedRequirements = new HashMap<IRequirement, Pending>(iuRequirements.size());
+ for (Iterator<IInstallableUnit> iterator = applicablePatches.iterator(); iterator.hasNext();) {
IInstallableUnitPatch patch = (IInstallableUnitPatch) iterator.next();
IRequirement[][] reqs = mergeRequirements(iu, patch);
if (reqs.length == 0)
@@ -449,16 +467,16 @@ public class Projector {
// noop(IU)-> ~ABS
// IU -> (noop(IU) or ABS)
// Therefore we only need one optional requirement statement per IU
- List optionalAbstractRequirements = new ArrayList();
+ List<AbstractVariable> optionalAbstractRequirements = new ArrayList<AbstractVariable>();
for (int i = 0; i < reqs.length; i++) {
//The requirement is unchanged
if (reqs[i][0] == reqs[i][1]) {
if (!isApplicable(reqs[i][0]))
continue;
- List patchesAppliedElseWhere = (List) unchangedRequirements.get(reqs[i][0]);
+ List<IInstallableUnitPatch> patchesAppliedElseWhere = unchangedRequirements.get(reqs[i][0]);
if (patchesAppliedElseWhere == null) {
- patchesAppliedElseWhere = new ArrayList();
+ patchesAppliedElseWhere = new ArrayList<IInstallableUnitPatch>();
unchangedRequirements.put(reqs[i][0], patchesAppliedElseWhere);
}
patchesAppliedElseWhere.add(patch);
@@ -469,15 +487,15 @@ public class Projector {
//P1 -> (A -> D) equiv. (P1 & A) -> D
if (isApplicable(reqs[i][1])) {
IRequirement req = reqs[i][1];
- List matches = getApplicableMatches(req);
+ List<IInstallableUnit> matches = getApplicableMatches(req);
if (isHostRequirement(iu, req)) {
- rememberHostMatches(iu, matches);
+ rememberHostMatches((IInstallableUnitFragment) iu, matches);
}
if (req.getMin() > 0) {
if (matches.isEmpty()) {
missingRequirement(patch, req);
} else {
- IInstallableUnit reqIu = (IInstallableUnit) matches.get(0);
+ IInstallableUnit reqIu = matches.get(0);
Explanation explanation;
if (isRootIu) {
if (alreadyInstalledIUs.contains(reqIu)) {
@@ -505,22 +523,22 @@ public class Projector {
// Fix: if multiple patches apply to the same IU-req, we need to make sure we list each
// patch as an optional match
- Pending pending = (Pending) nonPatchedRequirements.get(req);
+ Pending pending = nonPatchedRequirements.get(req);
if (pending != null) {
pending.matches.add(patch);
continue;
}
- List matches = getApplicableMatches(req);
+ List<IInstallableUnit> matches = getApplicableMatches(req);
if (isHostRequirement(iu, req)) {
- rememberHostMatches(iu, matches);
+ rememberHostMatches((IInstallableUnitFragment) iu, matches);
}
if (req.getMin() > 0) {
if (matches.isEmpty()) {
dependencyHelper.implication(new Object[] {iu}).implies(patch).named(new Explanation.HardRequirement(iu, null));
} else {
matches.add(patch);
- IInstallableUnit reqIu = (IInstallableUnit) matches.get(0);///(IInstallableUnit) picker.query(new CapabilityQuery(req), new Collector(), null).iterator().next();
+ IInstallableUnit reqIu = matches.get(0);///(IInstallableUnit) picker.query(new CapabilityQuery(req), new Collector(), null).iterator().next();
Explanation explanation;
if (isRootIu) {
@@ -561,26 +579,26 @@ public class Projector {
}
// Fix: now create the pending non-patch requirements based on the full set of patches
- for (Iterator iterator = nonPatchedRequirements.values().iterator(); iterator.hasNext();) {
- Pending pending = (Pending) iterator.next();
+ for (Iterator<Pending> iterator = nonPatchedRequirements.values().iterator(); iterator.hasNext();) {
+ Pending pending = iterator.next();
createImplication(pending.left, pending.matches, pending.explanation);
}
- List optionalAbstractRequirements = new ArrayList();
- for (Iterator iterator = unchangedRequirements.entrySet().iterator(); iterator.hasNext();) {
- Entry entry = (Entry) iterator.next();
- List patchesApplied = (List) entry.getValue();
- Iterator allPatches = applicablePatches.iterator();
- List requiredPatches = new ArrayList();
+ List<AbstractVariable> optionalAbstractRequirements = new ArrayList<AbstractVariable>();
+ for (Iterator<Entry<IRequirement, List<IInstallableUnitPatch>>> iterator = unchangedRequirements.entrySet().iterator(); iterator.hasNext();) {
+ Entry<IRequirement, List<IInstallableUnitPatch>> entry = iterator.next();
+ List<IInstallableUnitPatch> patchesApplied = entry.getValue();
+ Iterator<IInstallableUnit> allPatches = applicablePatches.iterator();
+ List<IInstallableUnitPatch> requiredPatches = new ArrayList<IInstallableUnitPatch>();
while (allPatches.hasNext()) {
IInstallableUnitPatch patch = (IInstallableUnitPatch) allPatches.next();
if (!patchesApplied.contains(patch))
requiredPatches.add(patch);
}
- IRequirement req = (IRequirement) entry.getKey();
- List matches = getApplicableMatches(req);
+ IRequirement req = entry.getKey();
+ List<IInstallableUnit> matches = getApplicableMatches(req);
if (isHostRequirement(iu, req)) {
- rememberHostMatches(iu, matches);
+ rememberHostMatches((IInstallableUnitFragment) iu, matches);
}
if (req.getMin() > 0) {
if (matches.isEmpty()) {
@@ -592,7 +610,7 @@ public class Projector {
} else {
if (!requiredPatches.isEmpty())
matches.addAll(requiredPatches);
- IInstallableUnit reqIu = (IInstallableUnit) matches.get(0);//(IInstallableUnit) picker.query(new CapabilityQuery(req), new Collector(), null).iterator().next();
+ IInstallableUnit reqIu = matches.get(0);//(IInstallableUnit) picker.query(new CapabilityQuery(req), new Collector(), null).iterator().next();
Explanation explanation;
if (isRootIu) {
if (alreadyInstalledIUs.contains(reqIu)) {
@@ -625,7 +643,7 @@ public class Projector {
IRequirement req = patch.getLifeCycle();
if (req == null)
return;
- expandRequirement(req, iu, Collections.EMPTY_LIST, isRootIu);
+ expandRequirement(req, iu, CollectionUtils.<AbstractVariable> emptyList(), isRootIu);
}
private void missingRequirement(IInstallableUnit iu, IRequirement req) throws ContradictionException {
@@ -637,11 +655,11 @@ public class Projector {
* @param req
* @return a list of mandatory requirements if any, an empty list if req.isOptional().
*/
- private List getApplicableMatches(IRequirement req) {
- List target = new ArrayList();
- IQueryResult matches = picker.query(req.getMatches(), null);
- for (Iterator iterator = matches.iterator(); iterator.hasNext();) {
- IInstallableUnit match = (IInstallableUnit) iterator.next();
+ private List<IInstallableUnit> getApplicableMatches(IRequirement req) {
+ List<IInstallableUnit> target = new ArrayList<IInstallableUnit>();
+ IQueryResult<IInstallableUnit> matches = picker.query(req.getMatches(), null);
+ for (Iterator<IInstallableUnit> iterator = matches.iterator(); iterator.hasNext();) {
+ IInstallableUnit match = iterator.next();
if (isApplicable(match)) {
target.add(match);
}
@@ -653,17 +671,18 @@ public class Projector {
private IRequirement[][] mergeRequirements(IInstallableUnit iu, IInstallableUnitPatch patch) {
if (patch == null)
return null;
- IRequirementChange[] changes = patch.getRequirementsChange();
- IRequirement[] originalRequirements = new IRequirement[iu.getRequiredCapabilities().length];
- System.arraycopy(iu.getRequiredCapabilities(), 0, originalRequirements, 0, originalRequirements.length);
- List rrr = new ArrayList();
+ List<IRequirementChange> changes = patch.getRequirementsChange();
+ List<IRequirement> iuRequirements = iu.getRequiredCapabilities();
+ IRequirement[] originalRequirements = iuRequirements.toArray(new IRequirement[iuRequirements.size()]);
+ List<IRequirement[]> rrr = new ArrayList<IRequirement[]>();
boolean found = false;
- for (int i = 0; i < changes.length; i++) {
+ for (int i = 0; i < changes.size(); i++) {
+ IRequirementChange change = changes.get(i);
for (int j = 0; j < originalRequirements.length; j++) {
- if (originalRequirements[j] != null && changes[i].matches((IRequiredCapability) originalRequirements[j])) {
+ if (originalRequirements[j] != null && change.matches((IRequiredCapability) originalRequirements[j])) {
found = true;
- if (changes[i].newValue() != null)
- rrr.add(new IRequirement[] {originalRequirements[j], changes[i].newValue()});
+ if (change.newValue() != null)
+ rrr.add(new IRequirement[] {originalRequirements[j], change.newValue()});
else
// case where a requirement is removed
rrr.add(new IRequirement[] {originalRequirements[j], null});
@@ -671,15 +690,15 @@ public class Projector {
}
// break;
}
- if (!found && changes[i].applyOn() == null && changes[i].newValue() != null) //Case where a new requirement is added
- rrr.add(new IRequirement[] {null, changes[i].newValue()});
+ if (!found && change.applyOn() == null && change.newValue() != null) //Case where a new requirement is added
+ rrr.add(new IRequirement[] {null, change.newValue()});
}
//Add all the unmodified requirements to the result
for (int i = 0; i < originalRequirements.length; i++) {
if (originalRequirements[i] != null)
rrr.add(new IRequirement[] {originalRequirements[i], originalRequirements[i]});
}
- return (IRequirement[][]) rrr.toArray(new IRequirement[rrr.size()][]);
+ return rrr.toArray(new IRequirement[rrr.size()][]);
}
/**
@@ -691,12 +710,12 @@ public class Projector {
* @param optionalRequirements
* @throws ContradictionException
*/
- private void createOptionalityExpression(IInstallableUnit iu, List optionalRequirements) throws ContradictionException {
+ private void createOptionalityExpression(IInstallableUnit iu, List<AbstractVariable> optionalRequirements) throws ContradictionException {
if (optionalRequirements.isEmpty())
return;
AbstractVariable noop = getNoOperationVariable(iu);
- for (Iterator i = optionalRequirements.iterator(); i.hasNext();) {
- AbstractVariable abs = (AbstractVariable) i.next();
+ for (Iterator<AbstractVariable> i = optionalRequirements.iterator(); i.hasNext();) {
+ AbstractVariable abs = i.next();
createIncompatibleValues(abs, noop);
}
optionalRequirements.add(noop);
@@ -704,24 +723,24 @@ public class Projector {
}
//This will create as many implication as there is element in the right argument
- private void createNegationImplication(Object left, List right, Explanation name) throws ContradictionException {
+ private void createNegationImplication(Object left, List<?> right, Explanation name) throws ContradictionException {
if (DEBUG) {
Tracing.debug(name + ": " + left + "->" + right); //$NON-NLS-1$ //$NON-NLS-2$
}
- for (Iterator iterator = right.iterator(); iterator.hasNext();) {
+ for (Iterator<?> iterator = right.iterator(); iterator.hasNext();) {
dependencyHelper.implication(new Object[] {left}).impliesNot(iterator.next()).named(name);
}
}
- private void createImplication(Object left, List right, Explanation name) throws ContradictionException {
+ private void createImplication(Object left, List<?> right, Explanation name) throws ContradictionException {
if (DEBUG) {
Tracing.debug(name + ": " + left + "->" + right); //$NON-NLS-1$ //$NON-NLS-2$
}
dependencyHelper.implication(new Object[] {left}).implies(right.toArray()).named(name);
}
- private void createImplication(Object[] left, List right, Explanation name) throws ContradictionException {
+ private void createImplication(Object[] left, List<?> right, Explanation name) throws ContradictionException {
if (DEBUG) {
Tracing.debug(name + ": " + Arrays.asList(left) + "->" + right); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -729,9 +748,9 @@ public class Projector {
}
//Return IUPatches that are applicable for the given iu
- private IQueryResult getApplicablePatches(IInstallableUnit iu) {
+ private IQueryResult<IInstallableUnit> getApplicablePatches(IInstallableUnit iu) {
if (patches == null)
- patches = new QueryableArray((IInstallableUnit[]) picker.query(new PatchQuery(), null).toArray(IInstallableUnit.class));
+ patches = new QueryableArray(picker.query(new PatchQuery(), null).toArray(IInstallableUnit.class));
return patches.query(new ApplicablePatchQuery(iu), null);
}
@@ -739,18 +758,18 @@ public class Projector {
//Create constraints to deal with singleton
//When there is a mix of singleton and non singleton, several constraints are generated
private void createConstraintsForSingleton() throws ContradictionException {
- Set s = slice.entrySet();
- for (Iterator iterator = s.iterator(); iterator.hasNext();) {
- Map.Entry entry = (Map.Entry) iterator.next();
- HashMap conflictingEntries = (HashMap) entry.getValue();
+ Set<Entry<String, Map<Version, IInstallableUnit>>> s = slice.entrySet();
+ for (Iterator<Entry<String, Map<Version, IInstallableUnit>>> iterator = s.iterator(); iterator.hasNext();) {
+ Entry<String, Map<Version, IInstallableUnit>> entry = iterator.next();
+ Map<Version, IInstallableUnit> conflictingEntries = entry.getValue();
if (conflictingEntries.size() < 2)
continue;
- Collection conflictingVersions = conflictingEntries.values();
- List singletons = new ArrayList();
- List nonSingletons = new ArrayList();
- for (Iterator conflictIterator = conflictingVersions.iterator(); conflictIterator.hasNext();) {
- IInstallableUnit iu = (IInstallableUnit) conflictIterator.next();
+ Collection<IInstallableUnit> conflictingVersions = conflictingEntries.values();
+ List<IInstallableUnit> singletons = new ArrayList<IInstallableUnit>();
+ List<IInstallableUnit> nonSingletons = new ArrayList<IInstallableUnit>();
+ for (Iterator<IInstallableUnit> conflictIterator = conflictingVersions.iterator(); conflictIterator.hasNext();) {
+ IInstallableUnit iu = conflictIterator.next();
if (iu.isSingleton()) {
singletons.add(iu);
} else {
@@ -762,12 +781,12 @@ public class Projector {
IInstallableUnit[] singletonArray;
if (nonSingletons.isEmpty()) {
- singletonArray = (IInstallableUnit[]) singletons.toArray(new IInstallableUnit[singletons.size()]);
+ singletonArray = singletons.toArray(new IInstallableUnit[singletons.size()]);
createAtMostOne(singletonArray);
} else {
- singletonArray = (IInstallableUnit[]) singletons.toArray(new IInstallableUnit[singletons.size() + 1]);
- for (Iterator iterator2 = nonSingletons.iterator(); iterator2.hasNext();) {
- singletonArray[singletonArray.length - 1] = (IInstallableUnit) iterator2.next();
+ singletonArray = singletons.toArray(new IInstallableUnit[singletons.size() + 1]);
+ for (Iterator<IInstallableUnit> iterator2 = nonSingletons.iterator(); iterator2.hasNext();) {
+ singletonArray[singletonArray.length - 1] = iterator2.next();
createAtMostOne(singletonArray);
}
}
@@ -782,7 +801,7 @@ public class Projector {
}
Tracing.debug("At most 1 of " + b); //$NON-NLS-1$
}
- dependencyHelper.atMost(1, ius).named(new Explanation.Singleton(ius));
+ dependencyHelper.atMost(1, (Object[]) ius).named(new Explanation.Singleton(ius));
}
private void createIncompatibleValues(AbstractVariable v1, AbstractVariable v2) throws ContradictionException {
@@ -794,7 +813,7 @@ public class Projector {
}
Tracing.debug("At most 1 of " + b); //$NON-NLS-1$
}
- dependencyHelper.atMost(1, vars).named(Explanation.OPTIONAL_REQUIREMENT);
+ dependencyHelper.atMost(1, (Object[]) vars).named(Explanation.OPTIONAL_REQUIREMENT);
}
private AbstractVariable getAbstractVariable() {
@@ -804,7 +823,7 @@ public class Projector {
}
private AbstractVariable getNoOperationVariable(IInstallableUnit iu) {
- AbstractVariable v = (AbstractVariable) noopVariables.get(iu);
+ AbstractVariable v = noopVariables.get(iu);
if (v == null) {
v = new AbstractVariable();
noopVariables.put(iu, v);
@@ -849,9 +868,9 @@ public class Projector {
}
private void backToIU() {
- solution = new ArrayList();
- IVec sat4jSolution = dependencyHelper.getSolution();
- for (Iterator i = sat4jSolution.iterator(); i.hasNext();) {
+ solution = new ArrayList<IInstallableUnit>();
+ IVec<Object> sat4jSolution = dependencyHelper.getSolution();
+ for (Iterator<Object> i = sat4jSolution.iterator(); i.hasNext();) {
Object var = i.next();
if (var instanceof IInstallableUnit) {
IInstallableUnit iu = (IInstallableUnit) var;
@@ -862,23 +881,23 @@ public class Projector {
}
}
- private void printSolution(Collection state) {
- ArrayList l = new ArrayList(state);
+ private void printSolution(Collection<IInstallableUnit> state) {
+ ArrayList<IInstallableUnit> l = new ArrayList<IInstallableUnit>(state);
Collections.sort(l);
Tracing.debug("Solution:"); //$NON-NLS-1$
Tracing.debug("Numbers of IUs selected: " + l.size()); //$NON-NLS-1$
- for (Iterator iterator = l.iterator(); iterator.hasNext();) {
+ for (Iterator<IInstallableUnit> iterator = l.iterator(); iterator.hasNext();) {
Tracing.debug(iterator.next().toString());
}
}
- public Collection extractSolution() {
+ public Collection<IInstallableUnit> extractSolution() {
if (DEBUG)
printSolution(solution);
return solution;
}
- public Set getExplanation(IProgressMonitor monitor) {
+ public Set<Explanation> getExplanation(IProgressMonitor monitor) {
ExplanationJob job = new ExplanationJob();
job.schedule();
monitor.setTaskName(Messages.Planner_NoSolution);
@@ -906,16 +925,16 @@ public class Projector {
return job.getExplanationResult();
}
- public Map getFragmentAssociation() {
- Map resolvedFragments = new HashMap(fragments.size());
- for (Iterator iterator = fragments.entrySet().iterator(); iterator.hasNext();) {
- Entry fragment = (Entry) iterator.next();
+ public Map<IInstallableUnitFragment, List<IInstallableUnit>> getFragmentAssociation() {
+ Map<IInstallableUnitFragment, List<IInstallableUnit>> resolvedFragments = new HashMap<IInstallableUnitFragment, List<IInstallableUnit>>(fragments.size());
+ for (Iterator<Entry<IInstallableUnitFragment, Set<IInstallableUnit>>> iterator = fragments.entrySet().iterator(); iterator.hasNext();) {
+ Entry<IInstallableUnitFragment, Set<IInstallableUnit>> fragment = iterator.next();
if (!dependencyHelper.getBooleanValueFor(fragment.getKey()))
continue;
- Set potentialHosts = (Set) fragment.getValue();
- List resolvedHost = new ArrayList(potentialHosts.size());
- for (Iterator iterator2 = potentialHosts.iterator(); iterator2.hasNext();) {
- Object host = iterator2.next();
+ Set<IInstallableUnit> potentialHosts = fragment.getValue();
+ List<IInstallableUnit> resolvedHost = new ArrayList<IInstallableUnit>(potentialHosts.size());
+ for (Iterator<IInstallableUnit> iterator2 = potentialHosts.iterator(); iterator2.hasNext();) {
+ IInstallableUnit host = iterator2.next();
if (dependencyHelper.getBooleanValueFor(host))
resolvedHost.add(host);
}
@@ -925,10 +944,10 @@ public class Projector {
return resolvedFragments;
}
- private void rememberHostMatches(IInstallableUnit fragment, List matches) {
- Set existingMatches = (Set) fragments.get(fragment);
+ private void rememberHostMatches(IInstallableUnitFragment fragment, List<IInstallableUnit> matches) {
+ Set<IInstallableUnit> existingMatches = fragments.get(fragment);
if (existingMatches == null) {
- existingMatches = new HashSet();
+ existingMatches = new HashSet<IInstallableUnit>();
fragments.put(fragment, existingMatches);
existingMatches.addAll(matches);
}
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/QueryableArray.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/QueryableArray.java
index a0ce70368..eade59c72 100644
--- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/QueryableArray.java
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/QueryableArray.java
@@ -20,7 +20,7 @@ import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.query.IQuery;
import org.eclipse.equinox.p2.metadata.query.IQueryResult;
-public class QueryableArray implements IQueryable {
+public class QueryableArray implements IQueryable<IInstallableUnit> {
static class IUCapability {
final IInstallableUnit iu;
final IProvidedCapability capability;
@@ -31,24 +31,24 @@ public class QueryableArray implements IQueryable {
}
}
- private final List dataSet;
- private Map namedCapabilityIndex;
+ private final List<IInstallableUnit> dataSet;
+ private Map<String, List<IUCapability>> namedCapabilityIndex;
public QueryableArray(IInstallableUnit[] ius) {
dataSet = Arrays.asList(ius);
}
- public IQueryResult query(IQuery query, IProgressMonitor monitor) {
+ public IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor) {
if (query instanceof IRequiredCapability)
- return queryCapability((IRequiredCapability) query, new Collector(), monitor);
+ return queryCapability((IRequiredCapability) query, new Collector<IInstallableUnit>(), monitor);
return query.perform(dataSet.iterator());
}
- private Collector queryCapability(IRequiredCapability query, Collector collector, IProgressMonitor monitor) {
+ private Collector<IInstallableUnit> queryCapability(IRequiredCapability query, Collector<IInstallableUnit> collector, IProgressMonitor monitor) {
generateNamedCapabilityIndex();
- Collection resultIUs = null;
- Collection matchingIUs = findMatchingIUs(query);
+ Collection<IInstallableUnit> resultIUs = null;
+ Collection<IInstallableUnit> matchingIUs = findMatchingIUs(query);
if (matchingIUs == null)
return collector;
if (resultIUs == null)
@@ -57,20 +57,20 @@ public class QueryableArray implements IQueryable {
resultIUs.retainAll(matchingIUs);
if (resultIUs != null)
- for (Iterator iterator = resultIUs.iterator(); iterator.hasNext();)
+ for (Iterator<IInstallableUnit> iterator = resultIUs.iterator(); iterator.hasNext();)
collector.accept(iterator.next());
return collector;
}
- private Collection findMatchingIUs(IRequiredCapability requiredCapability) {
- List iuCapabilities = (List) namedCapabilityIndex.get(requiredCapability.getName());
+ private Collection<IInstallableUnit> findMatchingIUs(IRequiredCapability requiredCapability) {
+ List<IUCapability> iuCapabilities = namedCapabilityIndex.get(requiredCapability.getName());
if (iuCapabilities == null)
return null;
- Set matchingIUs = new HashSet();
- for (Iterator iterator = iuCapabilities.iterator(); iterator.hasNext();) {
- IUCapability iuCapability = (IUCapability) iterator.next();
+ Set<IInstallableUnit> matchingIUs = new HashSet<IInstallableUnit>();
+ for (Iterator<IUCapability> iterator = iuCapabilities.iterator(); iterator.hasNext();) {
+ IUCapability iuCapability = iterator.next();
if (iuCapability.iu.satisfies(requiredCapability))
matchingIUs.add(iuCapability.iu);
}
@@ -81,19 +81,21 @@ public class QueryableArray implements IQueryable {
if (namedCapabilityIndex != null)
return;
- namedCapabilityIndex = new HashMap();
- for (Iterator iterator = dataSet.iterator(); iterator.hasNext();) {
- IInstallableUnit iu = (IInstallableUnit) iterator.next();
+ namedCapabilityIndex = new HashMap<String, List<IUCapability>>();
+ for (Iterator<IInstallableUnit> iterator = dataSet.iterator(); iterator.hasNext();) {
+ IInstallableUnit iu = iterator.next();
- IProvidedCapability[] providedCapabilities = iu.getProvidedCapabilities();
- for (int i = 0; i < providedCapabilities.length; i++) {
- String name = providedCapabilities[i].getName();
- List iuCapabilities = (List) namedCapabilityIndex.get(name);
+ List<IProvidedCapability> providedCapabilities = iu.getProvidedCapabilities();
+ int top = providedCapabilities.size();
+ for (int i = 0; i < top; i++) {
+ IProvidedCapability pc = providedCapabilities.get(i);
+ String name = pc.getName();
+ List<IUCapability> iuCapabilities = namedCapabilityIndex.get(name);
if (iuCapabilities == null) {
- iuCapabilities = new ArrayList(5);
+ iuCapabilities = new ArrayList<IUCapability>(5);
namedCapabilityIndex.put(name, iuCapabilities);
}
- iuCapabilities.add(new IUCapability(iu, providedCapabilities[i]));
+ iuCapabilities.add(new IUCapability(iu, pc));
}
}
}
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/SimplePlanner.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/SimplePlanner.java
index 24556a20e..59a35f38b 100644
--- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/SimplePlanner.java
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/SimplePlanner.java
@@ -46,39 +46,43 @@ public class SimplePlanner implements IPlanner {
private final IMetadataRepositoryManager repoManager;
private final IProfileRegistry profileRegistry;
- private ProvisioningPlan generateProvisioningPlan(Collection fromState, Collection toState, ProfileChangeRequest changeRequest, IProvisioningPlan installerPlan, ProvisioningContext context) {
- InstallableUnitOperand[] iuOperands = generateOperations(fromState, toState);
+ private ProvisioningPlan generateProvisioningPlan(Collection<IInstallableUnit> fromState, Collection<IInstallableUnit> toState, ProfileChangeRequest changeRequest, IProvisioningPlan installerPlan, ProvisioningContext context) {
+ List<InstallableUnitOperand> iuOperands = generateOperations(fromState, toState);
PropertyOperand[] propertyOperands = generatePropertyOperations(changeRequest);
- Operand[] operands = new Operand[iuOperands.length + propertyOperands.length];
- System.arraycopy(iuOperands, 0, operands, 0, iuOperands.length);
- System.arraycopy(propertyOperands, 0, operands, iuOperands.length, propertyOperands.length);
+ int iuOpsSize = iuOperands.size();
+ Operand[] operands = new Operand[iuOpsSize + propertyOperands.length];
+ for (int i = 0; i < iuOpsSize; ++i)
+ operands[i] = iuOperands.get(i);
+ System.arraycopy(propertyOperands, 0, operands, iuOpsSize, propertyOperands.length);
if (DEBUG) {
for (int i = 0; i < operands.length; i++) {
Tracing.debug(operands[i].toString());
}
}
- return new ProvisioningPlan(Status.OK_STATUS, operands, computeActualChangeRequest(toState, changeRequest), null, installerPlan, changeRequest.getProfile(), new QueryableArray((IInstallableUnit[]) toState.toArray(new IInstallableUnit[toState.size()])), context);
+ return new ProvisioningPlan(Status.OK_STATUS, operands, computeActualChangeRequest(toState, changeRequest), null, installerPlan, changeRequest.getProfile(), new QueryableArray(toState.toArray(new IInstallableUnit[toState.size()])), context);
}
- private Map[] buildDetailedErrors(ProfileChangeRequest changeRequest) {
+ private Map<IInstallableUnit, IStatus>[] buildDetailedErrors(ProfileChangeRequest changeRequest) {
IInstallableUnit[] added = changeRequest.getAddedInstallableUnits();
IInstallableUnit[] removed = changeRequest.getRemovedInstallableUnits();
- Map requestStatus = new HashMap(added.length + removed.length);
+ Map<IInstallableUnit, RequestStatus> requestStatus = new HashMap<IInstallableUnit, RequestStatus>(added.length + removed.length);
for (int i = 0; i < added.length; i++) {
requestStatus.put(added[i], new RequestStatus(added[i], RequestStatus.ADDED, IStatus.ERROR, null));
}
for (int i = 0; i < removed.length; i++) {
requestStatus.put(removed[i], new RequestStatus(removed[i], RequestStatus.REMOVED, IStatus.ERROR, null));
}
- return new Map[] {requestStatus, null};
+ @SuppressWarnings("unchecked")
+ Map<IInstallableUnit, IStatus>[] maps = new Map[] {requestStatus, null};
+ return maps;
}
- private Map[] computeActualChangeRequest(Collection toState, ProfileChangeRequest changeRequest) {
+ private Map<IInstallableUnit, IStatus>[] computeActualChangeRequest(Collection<IInstallableUnit> toState, ProfileChangeRequest changeRequest) {
IInstallableUnit[] added = changeRequest.getAddedInstallableUnits();
IInstallableUnit[] removed = changeRequest.getRemovedInstallableUnits();
- Map requestStatus = new HashMap(added.length + removed.length);
+ Map<IInstallableUnit, RequestStatus> requestStatus = new HashMap<IInstallableUnit, RequestStatus>(added.length + removed.length);
for (int i = 0; i < added.length; i++) {
if (toState.contains(added[i]))
requestStatus.put(added[i], new RequestStatus(added[i], RequestStatus.ADDED, IStatus.OK, null));
@@ -94,37 +98,35 @@ public class SimplePlanner implements IPlanner {
}
//Compute the side effect changes (e.g. things installed optionally going away)
- Iterator includedIUs = changeRequest.getProfile().query(new IUProfilePropertyQuery(INCLUSION_RULES, null), null).iterator();
- Map sideEffectStatus = new HashMap();
+ Iterator<IInstallableUnit> includedIUs = changeRequest.getProfile().query(new IUProfilePropertyQuery(INCLUSION_RULES, null), null).iterator();
+ Map<IInstallableUnit, RequestStatus> sideEffectStatus = new HashMap<IInstallableUnit, RequestStatus>();
while (includedIUs.hasNext()) {
- IInstallableUnit removal = (IInstallableUnit) includedIUs.next();
+ IInstallableUnit removal = includedIUs.next();
if (!toState.contains(removal) && !requestStatus.containsKey(removal)) {
sideEffectStatus.put(removal, new RequestStatus(removal, RequestStatus.REMOVED, IStatus.INFO, null));
}
}
- return new Map[] {requestStatus, sideEffectStatus};
+ @SuppressWarnings("unchecked")
+ Map<IInstallableUnit, IStatus>[] maps = new Map[] {requestStatus, sideEffectStatus};
+ return maps;
}
/**
* Converts a set containing a list of resolver explanations into a human-readable status object.
*/
- private IStatus convertExplanationToStatus(Set explanations) {
+ private IStatus convertExplanationToStatus(Set<Explanation> explanations) {
if (explanations == null)
return new Status(IStatus.ERROR, DirectorActivator.PI_DIRECTOR, Messages.Director_Unsatisfied_Dependencies);
MultiStatus root = new MultiStatus(DirectorActivator.PI_DIRECTOR, 1, Messages.Director_Unsatisfied_Dependencies, null);
//try to find a more specific root message if possible
String specificMessage = null;
- for (Iterator it = explanations.iterator(); it.hasNext();) {
- final Object next = it.next();
- if (next instanceof Explanation) {
- root.add(((Explanation) next).toStatus());
- if (specificMessage == null && next instanceof Explanation.MissingIU)
- specificMessage = Messages.Explanation_rootMissing;
- else if (specificMessage == null && next instanceof Explanation.Singleton) {
- specificMessage = Messages.Explanation_rootSingleton;
- }
- } else
- root.add(new Status(IStatus.ERROR, DirectorActivator.PI_DIRECTOR, next.toString()));
+ for (Iterator<Explanation> it = explanations.iterator(); it.hasNext();) {
+ final Explanation next = it.next();
+ root.add(next.toStatus());
+ if (specificMessage == null && next instanceof Explanation.MissingIU)
+ specificMessage = Messages.Explanation_rootMissing;
+ else if (specificMessage == null && next instanceof Explanation.Singleton)
+ specificMessage = Messages.Explanation_rootSingleton;
}
//use a more specific root message if available
if (specificMessage != null) {
@@ -137,56 +139,56 @@ public class SimplePlanner implements IPlanner {
private PropertyOperand[] generatePropertyOperations(ProfileChangeRequest profileChangeRequest) {
IProfile profile = profileChangeRequest.getProfile();
- List operands = new ArrayList();
+ List<PropertyOperand> operands = new ArrayList<PropertyOperand>();
// First deal with profile properties to remove. Only generate an operand if the property was there in the first place
String[] toRemove = profileChangeRequest.getPropertiesToRemove();
- Map existingProperties = profile.getProperties();
+ Map<String, String> existingProperties = profile.getProperties();
for (int i = 0; i < toRemove.length; i++) {
if (existingProperties.containsKey(toRemove[i]))
operands.add(new PropertyOperand(toRemove[i], existingProperties.get(toRemove[i]), null));
}
// Now deal with profile property changes/additions
- Map propertyChanges = profileChangeRequest.getPropertiesToAdd();
- Iterator iter = propertyChanges.entrySet().iterator();
+ Map<String, String> propertyChanges = profileChangeRequest.getPropertiesToAdd();
+ Iterator<Entry<String, String>> iter = propertyChanges.entrySet().iterator();
while (iter.hasNext()) {
- Map.Entry entry = (Map.Entry) iter.next();
- operands.add(new PropertyOperand((String) entry.getKey(), existingProperties.get(entry.getKey()), entry.getValue()));
+ Entry<String, String> entry = iter.next();
+ operands.add(new PropertyOperand(entry.getKey(), existingProperties.get(entry.getKey()), entry.getValue()));
}
// Now deal with iu property changes/additions.
// TODO we aren't yet checking that the IU will exist in the final profile, will the engine do this?
- Map allIUPropertyChanges = profileChangeRequest.getInstallableUnitProfilePropertiesToAdd();
- iter = allIUPropertyChanges.entrySet().iterator();
- while (iter.hasNext()) {
- Map.Entry entry = (Map.Entry) iter.next();
- IInstallableUnit iu = (IInstallableUnit) entry.getKey();
- Map iuPropertyChanges = (Map) entry.getValue();
- Iterator iuPropIter = iuPropertyChanges.entrySet().iterator();
+ Map<IInstallableUnit, Map<String, String>> allIUPropertyChanges = profileChangeRequest.getInstallableUnitProfilePropertiesToAdd();
+ Iterator<Entry<IInstallableUnit, Map<String, String>>> allIter = allIUPropertyChanges.entrySet().iterator();
+ while (allIter.hasNext()) {
+ Entry<IInstallableUnit, Map<String, String>> entry = allIter.next();
+ IInstallableUnit iu = entry.getKey();
+ Map<String, String> iuPropertyChanges = entry.getValue();
+ Iterator<Entry<String, String>> iuPropIter = iuPropertyChanges.entrySet().iterator();
while (iuPropIter.hasNext()) {
- Map.Entry entry2 = (Map.Entry) iuPropIter.next();
- Object oldValue = profile.getInstallableUnitProperty(iu, (String) entry2.getKey());
- operands.add(new InstallableUnitPropertyOperand(iu, (String) entry2.getKey(), oldValue, entry2.getValue()));
+ Entry<String, String> entry2 = iuPropIter.next();
+ Object oldValue = profile.getInstallableUnitProperty(iu, entry2.getKey());
+ operands.add(new InstallableUnitPropertyOperand(iu, entry2.getKey(), oldValue, entry2.getValue()));
}
}
// Now deal with iu property removals.
// TODO we could optimize by not generating property removals for IU's that aren't there or won't be there.
- Map allIUPropertyDeletions = profileChangeRequest.getInstallableUnitProfilePropertiesToRemove();
- iter = allIUPropertyDeletions.entrySet().iterator();
- while (iter.hasNext()) {
- Map.Entry entry = (Map.Entry) iter.next();
- IInstallableUnit iu = (IInstallableUnit) entry.getKey();
- Map existingIUProperties = profile.getInstallableUnitProperties(iu);
- List iuPropertyRemovals = (List) entry.getValue();
- for (Iterator it = iuPropertyRemovals.iterator(); it.hasNext();) {
- String key = (String) it.next();
+ Map<IInstallableUnit, List<String>> allIUPropertyDeletions = profileChangeRequest.getInstallableUnitProfilePropertiesToRemove();
+ Iterator<Entry<IInstallableUnit, List<String>>> delItor = allIUPropertyDeletions.entrySet().iterator();
+ while (delItor.hasNext()) {
+ Entry<IInstallableUnit, List<String>> entry = delItor.next();
+ IInstallableUnit iu = entry.getKey();
+ Map<String, String> existingIUProperties = profile.getInstallableUnitProperties(iu);
+ List<String> iuPropertyRemovals = entry.getValue();
+ for (Iterator<String> it = iuPropertyRemovals.iterator(); it.hasNext();) {
+ String key = it.next();
if (existingIUProperties.containsKey(key))
operands.add(new InstallableUnitPropertyOperand(iu, key, existingIUProperties.get(key), null));
}
}
- return (PropertyOperand[]) operands.toArray(new PropertyOperand[operands.size()]);
+ return operands.toArray(new PropertyOperand[operands.size()]);
}
- private InstallableUnitOperand[] generateOperations(Collection fromState, Collection toState) {
+ private List<InstallableUnitOperand> generateOperations(Collection<IInstallableUnit> fromState, Collection<IInstallableUnit> toState) {
return new OperationGenerator().generateOperation(fromState, toState);
}
@@ -206,13 +208,13 @@ public class SimplePlanner implements IPlanner {
}
public static IInstallableUnit[] findPlannerMarkedIUs(final IProfile profile) {
- IQuery markerQuery = new IUProfilePropertyQuery(INCLUSION_RULES, null);
- return (IInstallableUnit[]) profile.query(markerQuery, null).toArray(IInstallableUnit.class);
+ IQuery<IInstallableUnit> markerQuery = new IUProfilePropertyQuery(INCLUSION_RULES, null);
+ return profile.query(markerQuery, null).toArray(IInstallableUnit.class);
}
- public static Dictionary createSelectionContext(Map properties) {
- Hashtable result = new Hashtable(properties);
- String environments = (String) properties.get(IProfile.PROP_ENVIRONMENTS);
+ public static Dictionary<String, String> createSelectionContext(Map<String, String> properties) {
+ Hashtable<String, String> result = new Hashtable<String, String>(properties);
+ String environments = properties.get(IProfile.PROP_ENVIRONMENTS);
if (environments == null)
return result;
for (StringTokenizer tokenizer = new StringTokenizer(environments, ","); tokenizer.hasMoreElements();) { //$NON-NLS-1$
@@ -226,7 +228,7 @@ public class SimplePlanner implements IPlanner {
}
private IInstallableUnit[] gatherAvailableInstallableUnits(IInstallableUnit[] additionalSource, URI[] repositories, ProvisioningContext context, IProgressMonitor monitor) {
- Map resultsMap = new HashMap();
+ Map<String, IInstallableUnit> resultsMap = new HashMap<String, IInstallableUnit>();
if (additionalSource != null) {
for (int i = 0; i < additionalSource.length; i++) {
String key = additionalSource[i].getId() + "_" + additionalSource[i].getVersion().toString(); //$NON-NLS-1$
@@ -234,8 +236,8 @@ public class SimplePlanner implements IPlanner {
}
}
if (context != null) {
- for (Iterator iter = context.getExtraIUs().iterator(); iter.hasNext();) {
- IInstallableUnit iu = (IInstallableUnit) iter.next();
+ for (Iterator<IInstallableUnit> iter = context.getExtraIUs().iterator(); iter.hasNext();) {
+ IInstallableUnit iu = iter.next();
String key = iu.getId() + '_' + iu.getVersion().toString();
resultsMap.put(key, iu);
}
@@ -251,11 +253,11 @@ public class SimplePlanner implements IPlanner {
throw new OperationCanceledException();
IMetadataRepository repository = repoManager.loadRepository(repositories[i], sub.newChild(100));
- IQueryResult matches = repository.query(new InstallableUnitQuery(null, VersionRange.emptyRange), sub.newChild(100));
- for (Iterator it = matches.iterator(); it.hasNext();) {
- IInstallableUnit iu = (IInstallableUnit) it.next();
+ IQueryResult<IInstallableUnit> matches = repository.query(new InstallableUnitQuery(null, VersionRange.emptyRange), sub.newChild(100));
+ for (Iterator<IInstallableUnit> it = matches.iterator(); it.hasNext();) {
+ IInstallableUnit iu = it.next();
String key = iu.getId() + "_" + iu.getVersion().toString(); //$NON-NLS-1$
- IInstallableUnit currentIU = (IInstallableUnit) resultsMap.get(key);
+ IInstallableUnit currentIU = resultsMap.get(key);
if (currentIU == null || hasHigherFidelity(iu, currentIU))
resultsMap.put(key, iu);
}
@@ -264,8 +266,8 @@ public class SimplePlanner implements IPlanner {
}
}
sub.done();
- Collection results = resultsMap.values();
- return (IInstallableUnit[]) results.toArray(new IInstallableUnit[results.size()]);
+ Collection<IInstallableUnit> results = resultsMap.values();
+ return results.toArray(new IInstallableUnit[results.size()]);
}
private static boolean hasHigherFidelity(IInstallableUnit iu, IInstallableUnit currentIU) {
@@ -281,10 +283,10 @@ public class SimplePlanner implements IPlanner {
this.repoManager = repoManager;
}
- private boolean satisfyMetaRequirements(Map props) {
+ private boolean satisfyMetaRequirements(Map<String, String> props) {
if (props == null)
return true;
- if (props.get(CONSIDER_METAREQUIREMENTS) == null || "true".equalsIgnoreCase((String) props.get(CONSIDER_METAREQUIREMENTS))) //$NON-NLS-1$
+ if (props.get(CONSIDER_METAREQUIREMENTS) == null || "true".equalsIgnoreCase(props.get(CONSIDER_METAREQUIREMENTS))) //$NON-NLS-1$
return true;
return false;
}
@@ -303,20 +305,20 @@ public class SimplePlanner implements IPlanner {
Object[] updatedPlan = updatePlannerInfo(profileChangeRequest, context);
URI[] metadataRepositories = (context != null) ? context.getMetadataRepositories() : null;
- Dictionary newSelectionContext = createSelectionContext(profileChangeRequest.getProfileProperties());
+ Dictionary<String, String> newSelectionContext = createSelectionContext(profileChangeRequest.getProfileProperties());
- List extraIUs = new ArrayList(Arrays.asList(profileChangeRequest.getAddedInstallableUnits()));
+ List<IInstallableUnit> extraIUs = new ArrayList<IInstallableUnit>(Arrays.asList(profileChangeRequest.getAddedInstallableUnits()));
extraIUs.addAll(Arrays.asList(profileChangeRequest.getRemovedInstallableUnits()));
if (context == null || context.getProperty(INCLUDE_PROFILE_IUS) == null || context.getProperty(INCLUDE_PROFILE_IUS).equalsIgnoreCase(Boolean.TRUE.toString())) {
- Iterator itor = profile.available(InstallableUnitQuery.ANY, null).iterator();
+ Iterator<IInstallableUnit> itor = profile.available(InstallableUnitQuery.ANY, null).iterator();
while (itor.hasNext())
extraIUs.add(itor.next());
}
- IInstallableUnit[] availableIUs = gatherAvailableInstallableUnits((IInstallableUnit[]) extraIUs.toArray(new IInstallableUnit[extraIUs.size()]), metadataRepositories, context, sub.newChild(ExpandWork / 4));
+ IInstallableUnit[] availableIUs = gatherAvailableInstallableUnits(extraIUs.toArray(new IInstallableUnit[extraIUs.size()]), metadataRepositories, context, sub.newChild(ExpandWork / 4));
Slicer slicer = new Slicer(new QueryableArray(availableIUs), newSelectionContext, satisfyMetaRequirements(profileChangeRequest.getProfileProperties()));
- IQueryable slice = slicer.slice(new IInstallableUnit[] {(IInstallableUnit) updatedPlan[0]}, sub.newChild(ExpandWork / 4));
+ IQueryable<IInstallableUnit> slice = slicer.slice(new IInstallableUnit[] {(IInstallableUnit) updatedPlan[0]}, sub.newChild(ExpandWork / 4));
if (slice == null)
return new ProvisioningPlan(slicer.getStatus(), profile, null, context);
Projector projector = new Projector(slice, newSelectionContext, satisfyMetaRequirements(profileChangeRequest.getProfileProperties()));
@@ -330,7 +332,7 @@ public class SimplePlanner implements IPlanner {
return new ProvisioningPlan(s, profile, null, context);
//Extract the explanation
- Set explanation = projector.getExplanation(sub.newChild(ExpandWork / 4));
+ Set<Explanation> explanation = projector.getExplanation(sub.newChild(ExpandWork / 4));
IStatus explanationStatus = convertExplanationToStatus(explanation);
return new ProvisioningPlan(explanationStatus, new Operand[0], buildDetailedErrors(profileChangeRequest), new RequestStatus(null, RequestStatus.REMOVED, IStatus.ERROR, explanation), null, profile, null, context);
}
@@ -356,8 +358,8 @@ public class SimplePlanner implements IPlanner {
if (resolutionResult instanceof IProvisioningPlan)
return (ProvisioningPlan) resolutionResult;
- Collection newState = ((Projector) resolutionResult).extractSolution();
- Collection fullState = new ArrayList();
+ Collection<IInstallableUnit> newState = ((Projector) resolutionResult).extractSolution();
+ Collection<IInstallableUnit> fullState = new ArrayList<IInstallableUnit>();
fullState.addAll(newState);
newState = AttachmentHelper.attachFragments(newState.iterator(), ((Projector) resolutionResult).getFragmentAssociation());
@@ -373,60 +375,56 @@ public class SimplePlanner implements IPlanner {
}
private IProvisioningPlan generateAbsoluteProvisioningPlan(ProfileChangeRequest profileChangeRequest, ProvisioningContext context, IProgressMonitor monitor) {
- Set toState = profileChangeRequest.getProfile().query(InstallableUnitQuery.ANY, null).toSet();
- HashSet fromState = new HashSet(toState);
+ Set<IInstallableUnit> toState = profileChangeRequest.getProfile().query(InstallableUnitQuery.ANY, null).toSet();
+ HashSet<IInstallableUnit> fromState = new HashSet<IInstallableUnit>(toState);
toState.removeAll(Arrays.asList(profileChangeRequest.getRemovedInstallableUnits()));
toState.addAll(Arrays.asList(profileChangeRequest.getAddedInstallableUnits()));
- InstallableUnitOperand[] iuOperands = generateOperations(fromState, toState);
+ List<InstallableUnitOperand> iuOperands = generateOperations(fromState, toState);
PropertyOperand[] propertyOperands = generatePropertyOperations(profileChangeRequest);
- Operand[] operands = new Operand[iuOperands.length + propertyOperands.length];
- System.arraycopy(iuOperands, 0, operands, 0, iuOperands.length);
- System.arraycopy(propertyOperands, 0, operands, iuOperands.length, propertyOperands.length);
+ int iuOpsSize = iuOperands.size();
+ Operand[] operands = new Operand[iuOpsSize + propertyOperands.length];
+ for (int i = 0; i < iuOpsSize; ++i)
+ operands[i] = iuOperands.get(i);
+ System.arraycopy(propertyOperands, 0, operands, iuOpsSize, propertyOperands.length);
if (DEBUG) {
for (int i = 0; i < operands.length; i++) {
Tracing.debug(operands[i].toString());
}
}
- return new ProvisioningPlan(Status.OK_STATUS, operands, computeActualChangeRequest(toState, profileChangeRequest), null, null, profileChangeRequest.getProfile(), new QueryableArray((IInstallableUnit[]) toState.toArray(new IInstallableUnit[toState.size()])), context);
+ return new ProvisioningPlan(Status.OK_STATUS, operands, computeActualChangeRequest(toState, profileChangeRequest), null, null, profileChangeRequest.getProfile(), new QueryableArray(toState.toArray(new IInstallableUnit[toState.size()])), context);
}
//Verify that all the meta requirements necessary to perform the uninstallation (if necessary) and all t
- private Collection areMetaRequirementsSatisfied(IProfile oldProfile, Collection newProfile, IProvisioningPlan initialPlan) {
- Collection allMetaRequirements = extractMetaRequirements(newProfile, initialPlan);
- for (Iterator iterator = allMetaRequirements.iterator(); iterator.hasNext();) {
- IRequirement requirement = (IRequirement) iterator.next();
- if (oldProfile.query(new LimitQuery(requirement.getMatches(), 1), null).isEmpty())
+ private Collection<IRequirement> areMetaRequirementsSatisfied(IProfile oldProfile, Collection<IInstallableUnit> newProfile, IProvisioningPlan initialPlan) {
+ Collection<IRequirement> allMetaRequirements = extractMetaRequirements(newProfile, initialPlan);
+ for (Iterator<IRequirement> iterator = allMetaRequirements.iterator(); iterator.hasNext();) {
+ IRequirement requirement = iterator.next();
+ if (oldProfile.query(new LimitQuery<IInstallableUnit>(requirement.getMatches(), 1), null).isEmpty())
return allMetaRequirements;
}
return null;
}
//Return all the meta requirements for the list of IU specified and all the meta requirements listed necessary to satisfy the uninstallation
- private Collection extractMetaRequirements(Collection ius, IProvisioningPlan plan) {
- Set allMetaRequirements = new HashSet();
- for (Iterator iterator = ius.iterator(); iterator.hasNext();) {
- IInstallableUnit iu = (IInstallableUnit) iterator.next();
- IRequirement[] reqs = iu.getMetaRequiredCapabilities();
- for (int i = 0; i < reqs.length; i++) {
- allMetaRequirements.add(reqs[i]);
- }
+ private Collection<IRequirement> extractMetaRequirements(Collection<IInstallableUnit> ius, IProvisioningPlan plan) {
+ Set<IRequirement> allMetaRequirements = new HashSet<IRequirement>();
+ for (Iterator<IInstallableUnit> iterator = ius.iterator(); iterator.hasNext();) {
+ IInstallableUnit iu = iterator.next();
+ allMetaRequirements.addAll(iu.getMetaRequiredCapabilities());
}
- IQueryResult queryResult = plan.getRemovals().query(InstallableUnitQuery.ANY, null);
- for (Iterator iterator = queryResult.iterator(); iterator.hasNext();) {
- IInstallableUnit iu = (IInstallableUnit) iterator.next();
- IRequirement[] reqs = iu.getMetaRequiredCapabilities();
- for (int i = 0; i < reqs.length; i++) {
- allMetaRequirements.add(reqs[i]);
- }
+ IQueryResult<IInstallableUnit> queryResult = plan.getRemovals().query(InstallableUnitQuery.ANY, null);
+ for (Iterator<IInstallableUnit> iterator = queryResult.iterator(); iterator.hasNext();) {
+ IInstallableUnit iu = iterator.next();
+ allMetaRequirements.addAll(iu.getMetaRequiredCapabilities());
}
return allMetaRequirements;
}
- private ProvisioningPlan createInstallerPlan(IProfile profile, ProfileChangeRequest initialRequest, Collection unattachedState, Collection expectedState, ProvisioningPlan initialPlan, ProvisioningContext initialContext, IProgressMonitor monitor) {
+ private ProvisioningPlan createInstallerPlan(IProfile profile, ProfileChangeRequest initialRequest, Collection<IInstallableUnit> unattachedState, Collection<IInstallableUnit> expectedState, ProvisioningPlan initialPlan, ProvisioningContext initialContext, IProgressMonitor monitor) {
SubMonitor sub = SubMonitor.convert(monitor, ExpandWork);
try {
@@ -453,14 +451,14 @@ public class SimplePlanner implements IPlanner {
}
}
- private ProvisioningPlan createInstallerPlanForCohostedCaseFromExternalInstaller(IProfile profile, ProfileChangeRequest initialRequest, IProvisioningPlan initialPlan, Collection newState, ProvisioningContext initialContext, IProfile agentProfile, SubMonitor sub) {
+ private ProvisioningPlan createInstallerPlanForCohostedCaseFromExternalInstaller(IProfile profile, ProfileChangeRequest initialRequest, IProvisioningPlan initialPlan, Collection<IInstallableUnit> newState, ProvisioningContext initialContext, IProfile agentProfile, SubMonitor sub) {
ProvisioningPlan planForProfile = generatePlan(null, newState, initialRequest, initialContext);
return createInstallerPlanForExternalInstaller(profile, initialRequest, planForProfile, newState, initialContext, agentProfile, sub);
}
//Deal with the case where the agent profile is different than the one being provisioned
- private ProvisioningPlan createInstallerPlanForExternalInstaller(IProfile targetedProfile, ProfileChangeRequest initialRequest, ProvisioningPlan initialPlan, Collection expectedState, ProvisioningContext initialContext, IProfile agentProfile, SubMonitor sub) {
- Collection metaRequirements = areMetaRequirementsSatisfied(agentProfile, expectedState, initialPlan);
+ private ProvisioningPlan createInstallerPlanForExternalInstaller(IProfile targetedProfile, ProfileChangeRequest initialRequest, ProvisioningPlan initialPlan, Collection<IInstallableUnit> expectedState, ProvisioningContext initialContext, IProfile agentProfile, SubMonitor sub) {
+ Collection<IRequirement> metaRequirements = areMetaRequirementsSatisfied(agentProfile, expectedState, initialPlan);
if (metaRequirements == null)
return initialPlan;
@@ -484,8 +482,8 @@ public class SimplePlanner implements IPlanner {
//Deal with the case where the actions needs to be installed in the same profile than the one we are performing the initial request
//The expectedState represents the result of the initialRequest where the metaRequirements have been satisfied.
- private ProvisioningPlan createInstallerPlanForCohostedCase(IProfile profile, ProfileChangeRequest initialRequest, ProvisioningPlan initialPlan, Collection unattachedState, Collection expectedState, ProvisioningContext initialContext, SubMonitor monitor) {
- Collection metaRequirements = initialRequest.getRemovedInstallableUnits().length == 0 ? areMetaRequirementsSatisfied(profile, expectedState, initialPlan) : extractMetaRequirements(expectedState, initialPlan);
+ private ProvisioningPlan createInstallerPlanForCohostedCase(IProfile profile, ProfileChangeRequest initialRequest, ProvisioningPlan initialPlan, Collection<IInstallableUnit> unattachedState, Collection<IInstallableUnit> expectedState, ProvisioningContext initialContext, SubMonitor monitor) {
+ Collection<IRequirement> metaRequirements = initialRequest.getRemovedInstallableUnits().length == 0 ? areMetaRequirementsSatisfied(profile, expectedState, initialPlan) : extractMetaRequirements(expectedState, initialPlan);
if (metaRequirements == null || metaRequirements.isEmpty())
return initialPlan;
@@ -495,20 +493,20 @@ public class SimplePlanner implements IPlanner {
//Create an agent request from the initial request
ProfileChangeRequest agentRequest = new ProfileChangeRequest(profile);
- for (Iterator it = initialRequest.getPropertiesToAdd().entrySet().iterator(); it.hasNext();) {
- Entry entry = (Entry) it.next();
- agentRequest.setProfileProperty((String) entry.getKey(), entry.getValue());
+ for (Iterator<Entry<String, String>> it = initialRequest.getPropertiesToAdd().entrySet().iterator(); it.hasNext();) {
+ Entry<String, String> entry = it.next();
+ agentRequest.setProfileProperty(entry.getKey(), entry.getValue());
}
String[] removedProperties = initialRequest.getPropertiesToRemove();
for (int i = 0; i < removedProperties.length; i++) {
agentRequest.removeProfileProperty(removedProperties[i]);
}
- Map removedIUProperties = initialRequest.getInstallableUnitProfilePropertiesToRemove();
- for (Iterator iterator = removedIUProperties.entrySet().iterator(); iterator.hasNext();) {
- Entry entry = (Entry) iterator.next();
- ArrayList value = (ArrayList) entry.getValue();
- for (Iterator iterator2 = value.iterator(); iterator2.hasNext();) {
- agentRequest.removeInstallableUnitProfileProperty((IInstallableUnit) entry.getKey(), (String) iterator2.next());
+ Map<IInstallableUnit, List<String>> removedIUProperties = initialRequest.getInstallableUnitProfilePropertiesToRemove();
+ for (Iterator<Entry<IInstallableUnit, List<String>>> iterator = removedIUProperties.entrySet().iterator(); iterator.hasNext();) {
+ Entry<IInstallableUnit, List<String>> entry = iterator.next();
+ List<String> value = entry.getValue();
+ for (Iterator<String> iterator2 = value.iterator(); iterator2.hasNext();) {
+ agentRequest.removeInstallableUnitProfileProperty(entry.getKey(), iterator2.next());
}
}
@@ -517,7 +515,7 @@ public class SimplePlanner implements IPlanner {
agentRequest.addInstallableUnit(metaRequirementIU);
ProvisioningContext agentCtx = new ProvisioningContext(new URI[0]);
- ArrayList extraIUs = new ArrayList(unattachedState);
+ ArrayList<IInstallableUnit> extraIUs = new ArrayList<IInstallableUnit>(unattachedState);
agentCtx.setExtraIUs(extraIUs);
Object agentSolution = getSolutionFor(agentRequest, agentCtx, monitor.newChild(3));
if (agentSolution instanceof IProvisioningPlan && ((IProvisioningPlan) agentSolution).getStatus().getSeverity() == IStatus.ERROR) {
@@ -527,7 +525,7 @@ public class SimplePlanner implements IPlanner {
}
//Compute the installer plan. It is the difference between what is currently in the profile and the solution we just computed
- Collection agentState = ((Projector) agentSolution).extractSolution();
+ Collection<IInstallableUnit> agentState = ((Projector) agentSolution).extractSolution();
agentState.remove(metaRequirementIU); //Remove the fake IU
agentState = AttachmentHelper.attachFragments(agentState.iterator(), ((Projector) agentSolution).getFragmentAssociation());
@@ -538,8 +536,8 @@ public class SimplePlanner implements IPlanner {
LogHelper.log(new Status(IStatus.ERROR, DirectorActivator.PI_DIRECTOR, "The resolution of the previous state contained in profile " + initialRequest.getProfile().getProfileId() + " version " + initialRequest.getProfile().getTimestamp() + " failed.")); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
return (ProvisioningPlan) initialSolution;
}
- Iterator profileState = initialRequest.getProfile().query(InstallableUnitQuery.ANY, null).iterator();
- Collection initialState = AttachmentHelper.attachFragments(profileState, ((Projector) initialSolution).getFragmentAssociation());
+ Iterator<IInstallableUnit> profileState = initialRequest.getProfile().query(InstallableUnitQuery.ANY, null).iterator();
+ Collection<IInstallableUnit> initialState = AttachmentHelper.attachFragments(profileState, ((Projector) initialSolution).getFragmentAssociation());
IProvisioningPlan agentPlan = generateProvisioningPlan(initialState, agentState, initialRequest, null, initialContext);
@@ -548,7 +546,7 @@ public class SimplePlanner implements IPlanner {
}
//Compute the set of operands based on the solution obtained previously
- private ProvisioningPlan generatePlan(Projector newSolution, Collection newState, ProfileChangeRequest request, ProvisioningContext context) {
+ private ProvisioningPlan generatePlan(Projector newSolution, Collection<IInstallableUnit> newState, ProfileChangeRequest request, ProvisioningContext context) {
//Compute the attachment of the new state if not provided
if (newState == null) {
newState = newSolution.extractSolution();
@@ -562,8 +560,8 @@ public class SimplePlanner implements IPlanner {
LogHelper.log(new Status(IStatus.ERROR, DirectorActivator.PI_DIRECTOR, "The resolution of the previous state contained in profile " + request.getProfile().getProfileId() + " version " + request.getProfile().getTimestamp() + " failed.")); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
return (ProvisioningPlan) initialSolution;
}
- Iterator profileState = request.getProfile().query(InstallableUnitQuery.ANY, null).iterator();
- Collection initialState = AttachmentHelper.attachFragments(profileState, ((Projector) initialSolution).getFragmentAssociation());
+ Iterator<IInstallableUnit> profileState = request.getProfile().query(InstallableUnitQuery.ANY, null).iterator();
+ Collection<IInstallableUnit> initialState = AttachmentHelper.attachFragments(profileState, ((Projector) initialSolution).getFragmentAssociation());
//Generate the plan
return generateProvisioningPlan(initialState, newState, request, null, context);
@@ -573,22 +571,22 @@ public class SimplePlanner implements IPlanner {
ProvisioningContext noRepoContext = new ProvisioningContext(new URI[0]);
noRepoContext.setArtifactRepositories(new URI[0]);
noRepoContext.setProperty(INCLUDE_PROFILE_IUS, Boolean.FALSE.toString());
- noRepoContext.setExtraIUs(new ArrayList(request.getProfile().query(InstallableUnitQuery.ANY, new NullProgressMonitor()).unmodifiableSet()));
+ noRepoContext.setExtraIUs(new ArrayList<IInstallableUnit>(request.getProfile().query(InstallableUnitQuery.ANY, new NullProgressMonitor()).unmodifiableSet()));
return noRepoContext;
}
private IInstallableUnit getPreviousIUForMetaRequirements(IProfile profile, String iuId, IProgressMonitor monitor) {
- IQueryResult c = profile.query(new InstallableUnitQuery(iuId), monitor);
+ IQueryResult<IInstallableUnit> c = profile.query(new InstallableUnitQuery(iuId), monitor);
if (c.isEmpty())
return null;
- return (IInstallableUnit) c.iterator().next();
+ return c.iterator().next();
}
private String getActionGatheringIUId(IProfile profile) {
return ID_IU_FOR_ACTIONS + '.' + profile.getProfileId();
}
- private IInstallableUnit createIUForMetaRequirements(IProfile profile, Collection metaRequirements) {
+ private IInstallableUnit createIUForMetaRequirements(IProfile profile, Collection<IRequirement> metaRequirements) {
InstallableUnitDescription description = new InstallableUnitDescription();
String id = getActionGatheringIUId(profile);
description.setId(id);
@@ -596,7 +594,7 @@ public class SimplePlanner implements IPlanner {
description.setVersion(version);
description.addRequiredCapabilities(metaRequirements);
- ArrayList providedCapabilities = new ArrayList();
+ ArrayList<IProvidedCapability> providedCapabilities = new ArrayList<IProvidedCapability>();
IProvidedCapability providedCapability = MetadataFactory.createProvidedCapability(IInstallableUnit.NAMESPACE_IU_ID, id, version);
providedCapabilities.add(providedCapability);
description.addProvidedCapabilities(providedCapabilities);
@@ -605,12 +603,12 @@ public class SimplePlanner implements IPlanner {
return actionsIU;
}
- private IInstallableUnit createIURepresentingTheProfile(ArrayList allRequirements) {
+ private IInstallableUnit createIURepresentingTheProfile(ArrayList<IRequirement> allRequirements) {
InstallableUnitDescription iud = new MetadataFactory.InstallableUnitDescription();
String time = Long.toString(System.currentTimeMillis());
iud.setId(time);
iud.setVersion(Version.createOSGi(0, 0, 0, time));
- iud.setRequiredCapabilities((IRequirement[]) allRequirements.toArray(new IRequirement[allRequirements.size()]));
+ iud.setRequiredCapabilities(allRequirements.toArray(new IRequirement[allRequirements.size()]));
return MetadataFactory.createInstallableUnit(iud);
}
@@ -618,20 +616,20 @@ public class SimplePlanner implements IPlanner {
//It returns at index 0 a meta IU representing everything that needs to be installed
//It returns at index 1 all the IUs that are in the profile after the removal have been done, but before the addition have been done
private Object[] updatePlannerInfo(ProfileChangeRequest profileChangeRequest, ProvisioningContext context) {
- IQueryResult alreadyInstalled = profileChangeRequest.getProfile().query(new IUProfilePropertyQuery(INCLUSION_RULES, null), null);
+ IQueryResult<IInstallableUnit> alreadyInstalled = profileChangeRequest.getProfile().query(new IUProfilePropertyQuery(INCLUSION_RULES, null), null);
IInstallableUnit[] added = profileChangeRequest.getAddedInstallableUnits();
IInstallableUnit[] removed = profileChangeRequest.getRemovedInstallableUnits();
- for (Iterator iterator = profileChangeRequest.getInstallableUnitProfilePropertiesToRemove().entrySet().iterator(); iterator.hasNext();) {
- Map.Entry object = (Map.Entry) iterator.next();
- if (((List) object.getValue()).contains(INCLUSION_RULES))
- profileChangeRequest.setInstallableUnitProfileProperty((IInstallableUnit) object.getKey(), INCLUSION_RULES, PlannerHelper.createStrictInclusionRule((IInstallableUnit) object.getKey()));
+ for (Iterator<Entry<IInstallableUnit, List<String>>> iterator = profileChangeRequest.getInstallableUnitProfilePropertiesToRemove().entrySet().iterator(); iterator.hasNext();) {
+ Entry<IInstallableUnit, List<String>> object = iterator.next();
+ if (object.getValue().contains(INCLUSION_RULES))
+ profileChangeRequest.setInstallableUnitProfileProperty(object.getKey(), INCLUSION_RULES, PlannerHelper.createStrictInclusionRule(object.getKey()));
}
//Remove the iu properties associated to the ius removed and the iu properties being removed as well
if (removed.length != 0) {
- for (Iterator iterator = alreadyInstalled.iterator(); iterator.hasNext();) {
- IInstallableUnit iu = (IInstallableUnit) iterator.next();
+ for (Iterator<IInstallableUnit> iterator = alreadyInstalled.iterator(); iterator.hasNext();) {
+ IInstallableUnit iu = iterator.next();
for (int i = 0; i < removed.length; i++) {
if (iu.equals(removed[i])) {
profileChangeRequest.removeInstallableUnitProfileProperty(removed[i], INCLUSION_RULES);
@@ -641,15 +639,15 @@ public class SimplePlanner implements IPlanner {
}
}
}
- ArrayList gatheredRequirements = new ArrayList();
+ ArrayList<IRequirement> gatheredRequirements = new ArrayList<IRequirement>();
//Process all the IUs being added
- Map iuPropertiesToAdd = profileChangeRequest.getInstallableUnitProfilePropertiesToAdd();
+ Map<IInstallableUnit, Map<String, String>> iuPropertiesToAdd = profileChangeRequest.getInstallableUnitProfilePropertiesToAdd();
for (int i = 0; i < added.length; i++) {
- Map propertiesForIU = (Map) iuPropertiesToAdd.get(added[i]);
+ Map<String, String> propertiesForIU = iuPropertiesToAdd.get(added[i]);
IRequirement profileRequirement = null;
if (propertiesForIU != null) {
- profileRequirement = createRequirement(added[i], (String) propertiesForIU.get(INCLUSION_RULES));
+ profileRequirement = createRequirement(added[i], propertiesForIU.get(INCLUSION_RULES));
}
if (profileRequirement == null) {
profileChangeRequest.setInstallableUnitProfileProperty(added[i], INCLUSION_RULES, PlannerHelper.createStrictInclusionRule(added[i]));
@@ -659,13 +657,13 @@ public class SimplePlanner implements IPlanner {
}
//Process the IUs that were already there
- for (Iterator iterator = alreadyInstalled.iterator(); iterator.hasNext();) {
- IInstallableUnit iu = (IInstallableUnit) iterator.next();
- Map propertiesForIU = (Map) iuPropertiesToAdd.get(iu);
+ for (Iterator<IInstallableUnit> iterator = alreadyInstalled.iterator(); iterator.hasNext();) {
+ IInstallableUnit iu = iterator.next();
+ Map<String, String> propertiesForIU = iuPropertiesToAdd.get(iu);
IRequirement profileRequirement = null;
//Test if the value has changed
if (propertiesForIU != null) {
- profileRequirement = createRequirement(iu, (String) propertiesForIU.get(INCLUSION_RULES));
+ profileRequirement = createRequirement(iu, propertiesForIU.get(INCLUSION_RULES));
}
if (profileRequirement == null) {
profileRequirement = createRequirement(iu, profileChangeRequest.getProfile().getInstallableUnitProperty(iu, INCLUSION_RULES));
@@ -676,7 +674,7 @@ public class SimplePlanner implements IPlanner {
//Now add any other requirement that we need to see satisfied
if (context != null && context.getAdditionalRequirements() != null)
gatheredRequirements.addAll(context.getAdditionalRequirements());
- return new Object[] {createIURepresentingTheProfile(gatheredRequirements), (IInstallableUnit[]) alreadyInstalled.toArray(IInstallableUnit.class)};
+ return new Object[] {createIURepresentingTheProfile(gatheredRequirements), alreadyInstalled.toArray(IInstallableUnit.class)};
}
private IRequirement createRequirement(IInstallableUnit iu, String rule) {
@@ -700,7 +698,7 @@ public class SimplePlanner implements IPlanner {
}
public IInstallableUnit[] updatesFor(IInstallableUnit toUpdate, ProvisioningContext context, IProgressMonitor monitor) {
- Map resultsMap = new HashMap();
+ Map<String, IInstallableUnit> resultsMap = new HashMap<String, IInstallableUnit>();
URI[] repositories = context.getMetadataRepositories();
if (repositories == null)
@@ -712,11 +710,11 @@ public class SimplePlanner implements IPlanner {
if (sub.isCanceled())
throw new OperationCanceledException();
IMetadataRepository repository = repoManager.loadRepository(repositories[i], sub.newChild(100));
- IQueryResult matches = repository.query(new UpdateQuery(toUpdate), sub.newChild(100));
- for (Iterator it = matches.iterator(); it.hasNext();) {
- IInstallableUnit iu = (IInstallableUnit) it.next();
+ IQueryResult<IInstallableUnit> matches = repository.query(new UpdateQuery(toUpdate), sub.newChild(100));
+ for (Iterator<IInstallableUnit> it = matches.iterator(); it.hasNext();) {
+ IInstallableUnit iu = it.next();
String key = iu.getId() + "_" + iu.getVersion().toString(); //$NON-NLS-1$
- IInstallableUnit currentIU = (IInstallableUnit) resultsMap.get(key);
+ IInstallableUnit currentIU = resultsMap.get(key);
if (currentIU == null || hasHigherFidelity(iu, currentIU))
resultsMap.put(key, iu);
}
@@ -725,8 +723,8 @@ public class SimplePlanner implements IPlanner {
}
}
sub.done();
- Collection results = resultsMap.values();
- return (IInstallableUnit[]) results.toArray(new IInstallableUnit[results.size()]);
+ Collection<IInstallableUnit> results = resultsMap.values();
+ return results.toArray(new IInstallableUnit[results.size()]);
}
//helper class to trick the resolver to believe that everything is optional
@@ -737,11 +735,11 @@ public class SimplePlanner implements IPlanner {
profile = p;
}
- public IQueryResult available(IQuery query, IProgressMonitor monitor) {
+ public IQueryResult<IInstallableUnit> available(IQuery<IInstallableUnit> query, IProgressMonitor monitor) {
return profile.available(query, monitor);
}
- public Map getInstallableUnitProperties(IInstallableUnit iu) {
+ public Map<String, String> getInstallableUnitProperties(IInstallableUnit iu) {
return profile.getInstallableUnitProperties(iu);
}
@@ -755,7 +753,7 @@ public class SimplePlanner implements IPlanner {
return profile.getProfileId();
}
- public Map getProperties() {
+ public Map<String, String> getProperties() {
return profile.getProperties();
}
@@ -767,7 +765,7 @@ public class SimplePlanner implements IPlanner {
return profile.getTimestamp();
}
- public IQueryResult query(IQuery query, IProgressMonitor monitor) {
+ public IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor) {
return profile.query(query, monitor);
}
}
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Slicer.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Slicer.java
index e22e2535d..f70141e4e 100644
--- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Slicer.java
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Slicer.java
@@ -15,8 +15,7 @@ import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
import org.eclipse.equinox.internal.p2.core.helpers.Tracing;
import org.eclipse.equinox.internal.p2.metadata.LDAPQuery;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnitPatch;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IRequirementChange;
+import org.eclipse.equinox.internal.provisional.p2.metadata.*;
import org.eclipse.equinox.internal.provisional.p2.metadata.query.IQueryable;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.IRequirement;
@@ -27,26 +26,26 @@ import org.osgi.framework.InvalidSyntaxException;
public class Slicer {
private static boolean DEBUG = false;
- private IQueryable possibilites;
+ private IQueryable<IInstallableUnit> possibilites;
- private LinkedList toProcess;
- private Set considered; //IUs to add to the slice
- private TwoTierMap slice; //The IUs that have been considered to be part of the problem
+ private LinkedList<IInstallableUnit> toProcess;
+ private Set<IInstallableUnit> considered; //IUs to add to the slice
+ private Map<String, Map<Version, IInstallableUnit>> slice; //The IUs that have been considered to be part of the problem
- protected Dictionary selectionContext;
+ protected Dictionary<? extends Object, ? extends Object> selectionContext;
private MultiStatus result;
private boolean considerMetaRequirements = false;
- public Slicer(IQueryable input, Dictionary context, boolean considerMetaRequirements) {
+ public Slicer(IQueryable<IInstallableUnit> input, Dictionary<? extends Object, ? extends Object> context, boolean considerMetaRequirements) {
possibilites = input;
- slice = new TwoTierMap();
+ slice = new HashMap<String, Map<Version, IInstallableUnit>>();
selectionContext = context;
result = new MultiStatus(DirectorActivator.PI_DIRECTOR, IStatus.OK, Messages.Planner_Problems_resolving_plan, null);
this.considerMetaRequirements = considerMetaRequirements;
}
- public IQueryable slice(IInstallableUnit[] ius, IProgressMonitor monitor) {
+ public IQueryable<IInstallableUnit> slice(IInstallableUnit[] ius, IProgressMonitor monitor) {
try {
long start = 0;
if (DEBUG) {
@@ -55,14 +54,14 @@ public class Slicer {
}
validateInput(ius);
- considered = new HashSet(Arrays.asList(ius));
- toProcess = new LinkedList(considered);
+ considered = new HashSet<IInstallableUnit>(Arrays.asList(ius));
+ toProcess = new LinkedList<IInstallableUnit>(considered);
while (!toProcess.isEmpty()) {
if (monitor.isCanceled()) {
result.merge(Status.CANCEL_STATUS);
throw new OperationCanceledException();
}
- processIU((IInstallableUnit) toProcess.removeFirst());
+ processIU(toProcess.removeFirst());
}
if (DEBUG) {
long stop = System.currentTimeMillis();
@@ -75,7 +74,7 @@ public class Slicer {
LogHelper.log(result);
if (result.getSeverity() == IStatus.ERROR)
return null;
- return new QueryableArray((IInstallableUnit[]) considered.toArray(new IInstallableUnit[considered.size()]));
+ return new QueryableArray(considered.toArray(new IInstallableUnit[considered.size()]));
}
public MultiStatus getStatus() {
@@ -92,7 +91,7 @@ public class Slicer {
// Check whether the requirement is applicable
protected boolean isApplicable(IRequirement req) {
- IQuery filter = req.getFilter();
+ IQuery<Boolean> filter = req.getFilter();
if (filter == null)
return true;
if (filter instanceof LDAPQuery)
@@ -118,24 +117,31 @@ public class Slicer {
protected void processIU(IInstallableUnit iu) {
iu = iu.unresolved();
- slice.put(iu.getId(), iu.getVersion(), iu);
+ Map<Version, IInstallableUnit> iuSlice = slice.get(iu.getId());
+ if (iuSlice == null) {
+ iuSlice = new HashMap<Version, IInstallableUnit>();
+ slice.put(iu.getId(), iuSlice);
+ }
+ iuSlice.put(iu.getVersion(), iu);
if (!isApplicable(iu)) {
return;
}
- IRequirement[] reqs = getRequiredCapabilities(iu);
- if (reqs.length == 0) {
+ List<IRequirement> reqs = getRequiredCapabilities(iu);
+ int reqsCount = reqs.size();
+ if (reqsCount == 0) {
return;
}
- for (int i = 0; i < reqs.length; i++) {
- if (!isApplicable(reqs[i]))
+ for (int i = 0; i < reqsCount; i++) {
+ IRequirement req = reqs.get(i);
+ if (!isApplicable(req))
continue;
- if (!isGreedy(reqs[i])) {
+ if (!isGreedy(req)) {
continue;
}
- expandRequirement(iu, reqs[i]);
+ expandRequirement(iu, req);
}
}
@@ -143,38 +149,45 @@ public class Slicer {
return req.isGreedy();
}
- private IRequirement[] getRequiredCapabilities(IInstallableUnit iu) {
+ private List<IRequirement> getRequiredCapabilities(IInstallableUnit iu) {
+ List<IRequirement> iuRequirements = iu.getRequiredCapabilities();
+ int initialRequirementCount = iuRequirements.size();
if (!(iu instanceof IInstallableUnitPatch)) {
- if (iu.getMetaRequiredCapabilities().length == 0 || considerMetaRequirements == false)
- return iu.getRequiredCapabilities();
- IRequirement[] aggregatedCapabilities = new IRequirement[iu.getRequiredCapabilities().length + iu.getMetaRequiredCapabilities().length];
- System.arraycopy(iu.getRequiredCapabilities(), 0, aggregatedCapabilities, 0, iu.getRequiredCapabilities().length);
- System.arraycopy(iu.getMetaRequiredCapabilities(), 0, aggregatedCapabilities, iu.getRequiredCapabilities().length, iu.getMetaRequiredCapabilities().length);
+ if (!considerMetaRequirements)
+ return iuRequirements;
+
+ List<IRequirement> iuMetaRequirements = iu.getMetaRequiredCapabilities();
+ int metaSize = iuMetaRequirements.size();
+ if (metaSize == 0)
+ return iuRequirements;
+
+ ArrayList<IRequirement> aggregatedCapabilities = new ArrayList<IRequirement>(initialRequirementCount + metaSize);
+ aggregatedCapabilities.addAll(iuRequirements);
+ aggregatedCapabilities.addAll(iuMetaRequirements);
return aggregatedCapabilities;
}
- IRequirement[] aggregatedCapabilities;
+
IInstallableUnitPatch patchIU = (IInstallableUnitPatch) iu;
- IRequirementChange[] changes = patchIU.getRequirementsChange();
- int initialRequirementCount = iu.getRequiredCapabilities().length;
- aggregatedCapabilities = new IRequirement[initialRequirementCount + changes.length];
- System.arraycopy(iu.getRequiredCapabilities(), 0, aggregatedCapabilities, 0, initialRequirementCount);
- for (int i = 0; i < changes.length; i++) {
- aggregatedCapabilities[initialRequirementCount++] = changes[i].newValue();
- }
+ List<IRequirementChange> changes = patchIU.getRequirementsChange();
+ ArrayList<IRequirement> aggregatedCapabilities = new ArrayList<IRequirement>(initialRequirementCount + changes.size());
+ aggregatedCapabilities.addAll(iuRequirements);
+ for (int i = 0; i < changes.size(); i++)
+ aggregatedCapabilities.add(changes.get(i).newValue());
return aggregatedCapabilities;
}
private void expandRequirement(IInstallableUnit iu, IRequirement req) {
if (req.getMax() == 0)
return;
- IQueryResult matches = possibilites.query(req.getMatches(), null);
+ IQueryResult<IInstallableUnit> matches = possibilites.query(req.getMatches(), null);
int validMatches = 0;
- for (Iterator iterator = matches.iterator(); iterator.hasNext();) {
- IInstallableUnit match = (IInstallableUnit) iterator.next();
+ for (Iterator<IInstallableUnit> iterator = matches.iterator(); iterator.hasNext();) {
+ IInstallableUnit match = iterator.next();
if (!isApplicable(match))
continue;
validMatches++;
- if (!slice.containsKey(match.getId(), match.getVersion()))
+ Map<Version, IInstallableUnit> iuSlice = slice.get(match.getId());
+ if (iuSlice == null || !iuSlice.containsKey(match.getVersion()))
consider(match);
}
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/TwoTierMap.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/TwoTierMap.java
deleted file mode 100644
index 84ba95c06..000000000
--- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/TwoTierMap.java
+++ /dev/null
@@ -1,354 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this 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.p2.director;
-
-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.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.director/src/org/eclipse/equinox/internal/p2/rollback/FormerState.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/rollback/FormerState.java
index c348551d5..c6f9cc4cc 100644
--- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/rollback/FormerState.java
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/rollback/FormerState.java
@@ -31,12 +31,12 @@ public class FormerState {
}
private static void synchronizeAllIUProperties(ProfileChangeRequest request, IProfile current, IProfile target) {
- Set currentIUset = current.query(InstallableUnitQuery.ANY, null).unmodifiableSet();
- Iterator targetIUs = target.query(InstallableUnitQuery.ANY, null).iterator();
- List iusToAdd = new ArrayList();
- List iusToUpdate = new ArrayList();
+ Set<IInstallableUnit> currentIUset = current.query(InstallableUnitQuery.ANY, null).unmodifiableSet();
+ Iterator<IInstallableUnit> targetIUs = target.query(InstallableUnitQuery.ANY, null).iterator();
+ List<IInstallableUnit> iusToAdd = new ArrayList<IInstallableUnit>();
+ List<IInstallableUnit> iusToUpdate = new ArrayList<IInstallableUnit>();
while (targetIUs.hasNext()) {
- Object nxt = targetIUs.next();
+ IInstallableUnit nxt = targetIUs.next();
if (currentIUset.contains(nxt))
iusToUpdate.add(nxt);
else
@@ -44,35 +44,31 @@ public class FormerState {
}
//additions
- for (Iterator iterator = iusToAdd.iterator(); iterator.hasNext();) {
- IInstallableUnit iu = (IInstallableUnit) iterator.next();
- for (Iterator it = target.getInstallableUnitProperties(iu).entrySet().iterator(); it.hasNext();) {
- Entry entry = (Entry) it.next();
- String key = (String) entry.getKey();
- String value = (String) entry.getValue();
- request.setInstallableUnitProfileProperty(iu, key, value);
+ for (Iterator<IInstallableUnit> iterator = iusToAdd.iterator(); iterator.hasNext();) {
+ IInstallableUnit iu = iterator.next();
+ for (Iterator<Entry<String, String>> it = target.getInstallableUnitProperties(iu).entrySet().iterator(); it.hasNext();) {
+ Entry<String, String> entry = it.next();
+ request.setInstallableUnitProfileProperty(iu, entry.getKey(), entry.getValue());
}
}
// updates
- for (Iterator iterator = iusToUpdate.iterator(); iterator.hasNext();) {
- IInstallableUnit iu = (IInstallableUnit) iterator.next();
- Map propertiesToSet = new HashMap(target.getInstallableUnitProperties(iu));
- for (Iterator it = current.getInstallableUnitProperties(iu).entrySet().iterator(); it.hasNext();) {
- Entry entry = (Entry) it.next();
- String key = (String) entry.getKey();
- String newValue = (String) propertiesToSet.get(key);
+ for (Iterator<IInstallableUnit> iterator = iusToUpdate.iterator(); iterator.hasNext();) {
+ IInstallableUnit iu = iterator.next();
+ Map<String, String> propertiesToSet = new HashMap<String, String>(target.getInstallableUnitProperties(iu));
+ for (Iterator<Entry<String, String>> it = current.getInstallableUnitProperties(iu).entrySet().iterator(); it.hasNext();) {
+ Entry<String, String> entry = it.next();
+ String key = entry.getKey();
+ String newValue = propertiesToSet.get(key);
if (newValue == null) {
request.removeInstallableUnitProfileProperty(iu, key);
} else if (newValue.equals(entry.getValue()))
propertiesToSet.remove(key);
}
- for (Iterator it = propertiesToSet.entrySet().iterator(); it.hasNext();) {
- Entry entry = (Entry) it.next();
- String key = (String) entry.getKey();
- String value = (String) entry.getValue();
- request.setInstallableUnitProfileProperty(iu, key, value);
+ for (Iterator<Entry<String, String>> it = propertiesToSet.entrySet().iterator(); it.hasNext();) {
+ Entry<String, String> entry = it.next();
+ request.setInstallableUnitProfileProperty(iu, entry.getKey(), entry.getValue());
}
}
}
@@ -82,34 +78,32 @@ public class FormerState {
IInstallableUnit[] targetPlannerMarkedIUs = SimplePlanner.findPlannerMarkedIUs(target);
//additions
- List markedIUsToAdd = new ArrayList(Arrays.asList(targetPlannerMarkedIUs));
+ List<IInstallableUnit> markedIUsToAdd = new ArrayList<IInstallableUnit>(Arrays.asList(targetPlannerMarkedIUs));
markedIUsToAdd.removeAll(Arrays.asList(currentPlannerMarkedIUs));
- request.addInstallableUnits((IInstallableUnit[]) markedIUsToAdd.toArray(new IInstallableUnit[markedIUsToAdd.size()]));
+ request.addInstallableUnits(markedIUsToAdd);
// removes
- List markedIUsToRemove = new ArrayList(Arrays.asList(currentPlannerMarkedIUs));
+ List<IInstallableUnit> markedIUsToRemove = new ArrayList<IInstallableUnit>(Arrays.asList(currentPlannerMarkedIUs));
markedIUsToRemove.removeAll(Arrays.asList(targetPlannerMarkedIUs));
- request.removeInstallableUnits((IInstallableUnit[]) markedIUsToRemove.toArray(new IInstallableUnit[markedIUsToRemove.size()]));
+ request.removeInstallableUnits(markedIUsToRemove);
}
private static void synchronizeProfileProperties(ProfileChangeRequest request, IProfile current, IProfile target) {
- Map profilePropertiesToSet = new HashMap(target.getProperties());
- for (Iterator it = current.getProperties().entrySet().iterator(); it.hasNext();) {
- Entry entry = (Entry) it.next();
- String key = (String) entry.getKey();
+ Map<String, String> profilePropertiesToSet = new HashMap<String, String>(target.getProperties());
+ for (Iterator<Entry<String, String>> it = current.getProperties().entrySet().iterator(); it.hasNext();) {
+ Entry<String, String> entry = it.next();
+ String key = entry.getKey();
- String newValue = (String) profilePropertiesToSet.get(key);
+ String newValue = profilePropertiesToSet.get(key);
if (newValue == null) {
request.removeProfileProperty(key);
} else if (newValue.equals(entry.getValue()))
profilePropertiesToSet.remove(key);
}
- for (Iterator it = profilePropertiesToSet.entrySet().iterator(); it.hasNext();) {
- Entry entry = (Entry) it.next();
- String key = (String) entry.getKey();
- String value = (String) entry.getValue();
- request.setProfileProperty(key, value);
+ for (Iterator<Entry<String, String>> it = profilePropertiesToSet.entrySet().iterator(); it.hasNext();) {
+ Entry<String, String> entry = it.next();
+ request.setProfileProperty(entry.getKey(), entry.getValue());
}
}
}
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/provisional/p2/director/ProfileChangeRequest.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/provisional/p2/director/ProfileChangeRequest.java
index 59e22ee61..326ac1f51 100644
--- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/provisional/p2/director/ProfileChangeRequest.java
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/provisional/p2/director/ProfileChangeRequest.java
@@ -11,6 +11,7 @@
package org.eclipse.equinox.internal.provisional.p2.director;
import java.util.*;
+import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils;
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
import org.eclipse.equinox.internal.p2.director.*;
import org.eclipse.equinox.p2.engine.IProfile;
@@ -21,12 +22,12 @@ import org.eclipse.equinox.p2.metadata.query.IQueryResult;
public class ProfileChangeRequest implements Cloneable {
private final IProfile profile;
- private ArrayList iusToRemove = null; // list of ius to remove
- private ArrayList iusToAdd = null; // list of ius to add
- private ArrayList propertiesToRemove = null; // list of keys for properties to be removed
- private HashMap propertiesToAdd = null; // map of key->value for properties to be added
- private HashMap iuPropertiesToAdd = null; // map iu->map of key->value pairs for properties to be added for an iu
- private HashMap iuPropertiesToRemove = null; // map of iu->list of property keys to be removed for an iu
+ private ArrayList<IInstallableUnit> iusToRemove = null; // list of ius to remove
+ private ArrayList<IInstallableUnit> iusToAdd = null; // list of ius to add
+ private ArrayList<String> propertiesToRemove = null; // list of keys for properties to be removed
+ private HashMap<String, String> propertiesToAdd = null; // map of key->value for properties to be added
+ private HashMap<IInstallableUnit, Map<String, String>> iuPropertiesToAdd = null; // map iu->map of key->value pairs for properties to be added for an iu
+ private HashMap<IInstallableUnit, List<String>> iuPropertiesToRemove = null; // map of iu->list of property keys to be removed for an iu
private boolean isAbsolute = false; //Indicate whether or not the request is an absolute one
public static ProfileChangeRequest createByProfileId(String profileId) {
@@ -49,10 +50,10 @@ public class ProfileChangeRequest implements Cloneable {
return profile;
}
- public Map getProfileProperties() {
- Map result = new HashMap(profile.getProperties());
+ public Map<String, String> getProfileProperties() {
+ Map<String, String> result = new HashMap<String, String>(profile.getProperties());
if (propertiesToRemove != null) {
- for (Iterator it = propertiesToRemove.iterator(); it.hasNext();) {
+ for (Iterator<String> it = propertiesToRemove.iterator(); it.hasNext();) {
result.remove(it.next());
}
}
@@ -64,13 +65,18 @@ public class ProfileChangeRequest implements Cloneable {
public void addInstallableUnit(IInstallableUnit toInstall) {
if (iusToAdd == null)
- iusToAdd = new ArrayList();
+ iusToAdd = new ArrayList<IInstallableUnit>();
iusToAdd.add(toInstall);
}
- public void addInstallableUnits(IQueryResult toInstall) {
- for (Iterator itor = toInstall.iterator(); itor.hasNext();)
- addInstallableUnit((IInstallableUnit) itor.next());
+ public void addInstallableUnits(Collection<IInstallableUnit> toInstall) {
+ for (Iterator<IInstallableUnit> itor = toInstall.iterator(); itor.hasNext();)
+ addInstallableUnit(itor.next());
+ }
+
+ public void addInstallableUnits(IQueryResult<IInstallableUnit> toInstall) {
+ for (Iterator<IInstallableUnit> itor = toInstall.iterator(); itor.hasNext();)
+ addInstallableUnit(itor.next());
}
public void addInstallableUnits(IInstallableUnit[] toInstall) {
@@ -80,7 +86,7 @@ public class ProfileChangeRequest implements Cloneable {
public void removeInstallableUnit(IInstallableUnit toUninstall) {
if (iusToRemove == null)
- iusToRemove = new ArrayList();
+ iusToRemove = new ArrayList<IInstallableUnit>();
iusToRemove.add(toUninstall);
}
@@ -89,29 +95,34 @@ public class ProfileChangeRequest implements Cloneable {
removeInstallableUnit(toUninstall[i]);
}
- public void removeInstallableUnits(IQueryResult toUninstall) {
- for (Iterator itor = toUninstall.iterator(); itor.hasNext();)
- removeInstallableUnit((IInstallableUnit) itor.next());
+ public void removeInstallableUnits(Collection<IInstallableUnit> toUninstall) {
+ for (Iterator<IInstallableUnit> itor = toUninstall.iterator(); itor.hasNext();)
+ removeInstallableUnit(itor.next());
+ }
+
+ public void removeInstallableUnits(IQueryResult<IInstallableUnit> toUninstall) {
+ for (Iterator<IInstallableUnit> itor = toUninstall.iterator(); itor.hasNext();)
+ removeInstallableUnit(itor.next());
}
- public void setProfileProperty(String key, Object value) {
+ public void setProfileProperty(String key, String value) {
if (propertiesToAdd == null)
- propertiesToAdd = new HashMap();
+ propertiesToAdd = new HashMap<String, String>();
propertiesToAdd.put(key, value);
}
public void removeProfileProperty(String key) {
if (propertiesToRemove == null)
- propertiesToRemove = new ArrayList(1);
+ propertiesToRemove = new ArrayList<String>(1);
propertiesToRemove.add(key);
}
- public void setInstallableUnitProfileProperty(IInstallableUnit iu, String key, Object value) {
+ public void setInstallableUnitProfileProperty(IInstallableUnit iu, String key, String value) {
if (iuPropertiesToAdd == null)
- iuPropertiesToAdd = new HashMap();
- Map properties = (Map) iuPropertiesToAdd.get(iu);
+ iuPropertiesToAdd = new HashMap<IInstallableUnit, Map<String, String>>();
+ Map<String, String> properties = iuPropertiesToAdd.get(iu);
if (properties == null) {
- properties = new HashMap();
+ properties = new HashMap<String, String>();
iuPropertiesToAdd.put(iu, properties);
}
properties.put(key, value);
@@ -119,10 +130,10 @@ public class ProfileChangeRequest implements Cloneable {
public void removeInstallableUnitProfileProperty(IInstallableUnit iu, String key) {
if (iuPropertiesToRemove == null)
- iuPropertiesToRemove = new HashMap();
- List keys = (List) iuPropertiesToRemove.get(iu);
+ iuPropertiesToRemove = new HashMap<IInstallableUnit, List<String>>();
+ List<String> keys = iuPropertiesToRemove.get(iu);
if (keys == null) {
- keys = new ArrayList();
+ keys = new ArrayList<String>();
iuPropertiesToRemove.put(iu, keys);
}
keys.add(key);
@@ -131,64 +142,50 @@ public class ProfileChangeRequest implements Cloneable {
public IInstallableUnit[] getRemovedInstallableUnits() {
if (iusToRemove == null)
return new IInstallableUnit[0];
- return (IInstallableUnit[]) iusToRemove.toArray(new IInstallableUnit[iusToRemove.size()]);
+ return iusToRemove.toArray(new IInstallableUnit[iusToRemove.size()]);
}
public IInstallableUnit[] getAddedInstallableUnits() {
if (iusToAdd == null)
return new IInstallableUnit[0];
- return (IInstallableUnit[]) iusToAdd.toArray(new IInstallableUnit[iusToAdd.size()]);
+ return iusToAdd.toArray(new IInstallableUnit[iusToAdd.size()]);
}
// String [key, key, key] names of properties to remove
public String[] getPropertiesToRemove() {
if (propertiesToRemove == null)
return new String[0];
- return (String[]) propertiesToRemove.toArray(new String[propertiesToRemove.size()]);
+ return propertiesToRemove.toArray(new String[propertiesToRemove.size()]);
}
// map of key value pairs
- public Map getPropertiesToAdd() {
+ public Map<String, String> getPropertiesToAdd() {
if (propertiesToAdd == null)
- return Collections.EMPTY_MAP;
+ return CollectionUtils.emptyMap();
return propertiesToAdd;
}
// map of iu->list of property keys to be removed for an iu
- public Map getInstallableUnitProfilePropertiesToRemove() {
+ public Map<IInstallableUnit, List<String>> getInstallableUnitProfilePropertiesToRemove() {
if (iuPropertiesToRemove == null)
- return Collections.EMPTY_MAP;
+ return CollectionUtils.emptyMap();
return iuPropertiesToRemove;
}
// TODO This can be represented and returned in whatever way makes most sense for planner/engine
// map iu->map of key->value pairs for properties to be added for an iu
- public Map getInstallableUnitProfilePropertiesToAdd() {
+ public Map<IInstallableUnit, Map<String, String>> getInstallableUnitProfilePropertiesToAdd() {
if (iuPropertiesToAdd == null)
- return Collections.EMPTY_MAP;
+ return CollectionUtils.emptyMap();
return iuPropertiesToAdd;
}
public void setInstallableUnitInclusionRules(IInstallableUnit iu, String value) {
- if (iuPropertiesToAdd == null)
- iuPropertiesToAdd = new HashMap();
- Map properties = (Map) iuPropertiesToAdd.get(iu);
- if (properties == null) {
- properties = new HashMap();
- iuPropertiesToAdd.put(iu, properties);
- }
- properties.put(SimplePlanner.INCLUSION_RULES, value);
+ setInstallableUnitProfileProperty(iu, SimplePlanner.INCLUSION_RULES, value);
}
public void removeInstallableUnitInclusionRules(IInstallableUnit iu) {
- if (iuPropertiesToRemove == null)
- iuPropertiesToRemove = new HashMap();
- List keys = (List) iuPropertiesToRemove.get(iu);
- if (keys == null) {
- keys = new ArrayList();
- iuPropertiesToRemove.put(iu, keys);
- }
- keys.add(SimplePlanner.INCLUSION_RULES);
+ removeInstallableUnitProfileProperty(iu, SimplePlanner.INCLUSION_RULES);
}
public void setAbsoluteMode(boolean absolute) {
@@ -199,32 +196,33 @@ public class ProfileChangeRequest implements Cloneable {
return isAbsolute;
}
+ @SuppressWarnings("unchecked")
public Object clone() {
ProfileChangeRequest result = new ProfileChangeRequest(profile);
- result.iusToRemove = iusToRemove == null ? null : (ArrayList) iusToRemove.clone();
- result.iusToAdd = iusToAdd == null ? null : (ArrayList) iusToAdd.clone();
- result.propertiesToRemove = propertiesToRemove == null ? null : (ArrayList) propertiesToRemove.clone();
- result.propertiesToAdd = propertiesToAdd == null ? null : (HashMap) propertiesToAdd.clone();
- result.iuPropertiesToAdd = iuPropertiesToAdd == null ? null : (HashMap) iuPropertiesToAdd.clone();
- result.iuPropertiesToRemove = iuPropertiesToRemove == null ? null : (HashMap) iuPropertiesToRemove.clone();
+ result.iusToRemove = iusToRemove == null ? null : (ArrayList<IInstallableUnit>) iusToRemove.clone();
+ result.iusToAdd = iusToAdd == null ? null : (ArrayList<IInstallableUnit>) iusToAdd.clone();
+ result.propertiesToRemove = propertiesToRemove == null ? null : (ArrayList<String>) propertiesToRemove.clone();
+ result.propertiesToAdd = propertiesToAdd == null ? null : (HashMap<String, String>) propertiesToAdd.clone();
+ result.iuPropertiesToAdd = iuPropertiesToAdd == null ? null : (HashMap<IInstallableUnit, Map<String, String>>) iuPropertiesToAdd.clone();
+ result.iuPropertiesToRemove = iuPropertiesToRemove == null ? null : (HashMap<IInstallableUnit, List<String>>) iuPropertiesToRemove.clone();
return result;
}
public String toString() {
StringBuffer result = new StringBuffer(1000);
- result.append("==Profile change request for ");
+ result.append("==Profile change request for "); //$NON-NLS-1$
result.append(profile.getProfileId());
result.append('\n');
- result.append("==Additions==");
+ result.append("==Additions=="); //$NON-NLS-1$
result.append('\n');
- for (Iterator iterator = iusToAdd.iterator(); iterator.hasNext();) {
+ for (Iterator<IInstallableUnit> iterator = iusToAdd.iterator(); iterator.hasNext();) {
result.append('\t');
result.append(iterator.next());
result.append('\n');
}
- result.append("==Removals==");
+ result.append("==Removals=="); //$NON-NLS-1$
result.append('\n');
- for (Iterator iterator = iusToRemove.iterator(); iterator.hasNext();) {
+ for (Iterator<IInstallableUnit> iterator = iusToRemove.iterator(); iterator.hasNext();) {
result.append('\t');
result.append(iterator.next());
result.append('\n');
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/provisional/p2/director/RequestStatus.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/provisional/p2/director/RequestStatus.java
index aae66f0e1..b1f6796b7 100644
--- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/provisional/p2/director/RequestStatus.java
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/provisional/p2/director/RequestStatus.java
@@ -23,21 +23,21 @@ public class RequestStatus extends Status {
private byte initialRequestType;
private IInstallableUnit iu;
- private Set explanation;
+ private Set<Explanation> explanation;
private Explanation detailedExplanation;
- private Set conflictingRootIUs;
- private Set conflictingInstalledIUs;
+ private Set<IInstallableUnit> conflictingRootIUs;
+ private Set<IInstallableUnit> conflictingInstalledIUs;
- public RequestStatus(IInstallableUnit iu, byte initialRequesType, int severity, Set explanation) {
+ public RequestStatus(IInstallableUnit iu, byte initialRequesType, int severity, Set<Explanation> explanation) {
super(severity, DirectorActivator.PI_DIRECTOR, NLS.bind(Messages.RequestStatus_message, iu));
this.iu = iu;
this.initialRequestType = initialRequesType;
this.explanation = explanation;
- conflictingRootIUs = new HashSet();
- conflictingInstalledIUs = new HashSet();
+ conflictingRootIUs = new HashSet<IInstallableUnit>();
+ conflictingInstalledIUs = new HashSet<IInstallableUnit>();
if (explanation != null) {
- Iterator iterator = explanation.iterator();
- Object o = null;
+ Iterator<Explanation> iterator = explanation.iterator();
+ Explanation o = null;
while (iterator.hasNext() && ((o = iterator.next()) instanceof Explanation.IUToInstall)) {
conflictingRootIUs.add(((IUToInstall) o).iu);
}
@@ -47,7 +47,7 @@ public class RequestStatus extends Status {
conflictingInstalledIUs.add(((IUInstalled) o).iu);
}
}
- detailedExplanation = (Explanation) o;
+ detailedExplanation = o;
}
}
@@ -61,18 +61,18 @@ public class RequestStatus extends Status {
//Return the already installed roots with which this IU is in conflict
//Return an empty set if there is no conflict
- public Set getConflictsWithInstalledRoots() {
+ public Set<IInstallableUnit> getConflictsWithInstalledRoots() {
return conflictingRootIUs;
}
//Return the already installed roots with which this IU is in conflict
//Return an empty set if there is no conflict
- public Set getConflictsWithAnyRoots() {
+ public Set<IInstallableUnit> getConflictsWithAnyRoots() {
return conflictingInstalledIUs;
}
//Return an explanation as to why this IU can not be resolved.
- public Set getExplanations() {
+ public Set<Explanation> getExplanations() {
//To start with, this does not have to return the most specific explanation. If it simply returns an global explanation it is good enough.
return explanation;
}
diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/.classpath b/bundles/org.eclipse.equinox.p2.directorywatcher/.classpath
index 6f3b481ac..64c5e31b7 100644
--- a/bundles/org.eclipse.equinox.p2.directorywatcher/.classpath
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <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.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.directorywatcher/.settings/org.eclipse.jdt.core.prefs
index b94ca9b4f..40e23ea57 100644
--- a/bundles/org.eclipse.equinox.p2.directorywatcher/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/.settings/org.eclipse.jdt.core.prefs
@@ -1,329 +1,329 @@
-#Thu Oct 09 08:15:15 EDT 2008
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
-org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
-org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
-org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
-org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+#Wed Dec 23 00:33:28 CET 2009
+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=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+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=error
+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.missingJavadocTagsVisibility=public
-org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=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_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
-org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+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.formatter.comment.format_source_code=true
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
-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_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
-org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+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.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
-org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
-org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
+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.5
+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.number_of_empty_lines_to_preserve=1
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
-org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.formatter.comment.format_header=false
-org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+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.insert_space_after_colon_in_case=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.comment.line_length=80
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
-org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
-org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
-org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.builder.cleanOutputFolder=clean
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
-org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false
-org.eclipse.jdt.core.formatter.continuation_indentation=2
-org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
-org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
-org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+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.compiler.problem.missingJavadocTagsOverriding=enabled
-org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+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.builder.resourceCopyExclusionFilter=*.launch
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+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.insert_new_line_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.incompleteClasspath=error
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+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.insert_space_before_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert
+org.eclipse.jdt.core.formatter.comment.format_header=false
org.eclipse.jdt.core.formatter.comment.format_html=true
-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_closing_paren_in_enum_constant=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_closing_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
-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_closing_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
-org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
-org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
-org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=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_comma_in_enum_constant_arguments=do not insert
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=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_between_empty_braces_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=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.alignment_for_throws_clause_in_method_declaration=16
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
-org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=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_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_space_before_colon_in_labeled_statement=do not insert
-org.eclipse.jdt.core.circularClasspath=error
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=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.alignment_for_arguments_in_enum_constant=16
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+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.compiler.problem.incompleteEnumSwitch=ignore
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=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.alignment_for_enum_constants=0
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
-org.eclipse.jdt.core.formatter.tabulation.char=tab
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
-org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+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_before_comma_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.compact_else_if=true
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
-org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=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_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.compiler.problem.finalParameterBound=ignore
-org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=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_comma_in_enum_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=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.indent_body_declarations_compare_to_enum_declaration_header=true
-org.eclipse.jdt.core.compiler.problem.discouragedReference=error
-org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
-org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
-org.eclipse.jdt.core.formatter.comment.format_line_comments=false
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
-org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.indentation.size=4
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not 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.compiler.debug.sourceFile=generate
+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_after_colon_in_for=insert
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=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.comment.indent_root_tags=false
-org.eclipse.jdt.core.compiler.problem.deprecation=warning
+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.compiler.problem.invalidJavadocTagsVisibility=private
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
-org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
-org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
-org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
-org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.blank_lines_before_package=0
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
-org.eclipse.jdt.core.formatter.indent_empty_lines=false
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+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_comma_in_constructor_declaration_throws=do not insert
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
-org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
-org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
-org.eclipse.jdt.core.compiler.problem.unusedImport=error
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
-org.eclipse.jdt.core.builder.invalidClasspath=abort
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=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_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.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.incompatibleJDKLevel=ignore
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=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_opening_paren_in_while=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.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
-org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=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_after_closing_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+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.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
-org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
-org.eclipse.jdt.core.compiler.source=1.3
-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_method_body=insert
+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.compiler.problem.assertIdentifier=warning
-org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
-org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
-org.eclipse.jdt.core.builder.duplicateResourceTask=warning
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert
-org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.compiler.doc.comment.support=enabled
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=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_closing_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.compiler.compliance=1.4
-org.eclipse.jdt.core.formatter.blank_lines_after_package=1
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
-org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
-org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+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.directorywatcher/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.directorywatcher/META-INF/MANIFEST.MF
index caa1ac7be..3c59fea54 100644
--- a/bundles/org.eclipse.equinox.p2.directorywatcher/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/META-INF/MANIFEST.MF
@@ -26,8 +26,9 @@ Import-Package: org.eclipse.equinox.internal.p2.artifact.repository.simple,
org.eclipse.osgi.util,
org.osgi.framework;version="1.4.0",
org.osgi.service.packageadmin;version="1.2.0"
-Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
- J2SE-1.4
+Bundle-RequiredExecutionEnvironment: J2SE-1.5,
+ J2SE-1.4,
+ CDC-1.1/Foundation-1.1
Export-Package: org.eclipse.equinox.internal.provisional.p2.directorywatcher;x-friends:="org.eclipse.equinox.p2.reconciler.dropins,org.eclipse.equinox.p2.extensionlocation"
Require-Bundle: org.eclipse.equinox.common;bundle-version="[3.3.0,4.0)"
Bundle-Activator: org.eclipse.equinox.internal.provisional.p2.directorywatcher.Activator
diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/build.properties b/bundles/org.eclipse.equinox.p2.directorywatcher/build.properties
index dc77b9c16..ca5030900 100644
--- a/bundles/org.eclipse.equinox.p2.directorywatcher/build.properties
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/build.properties
@@ -15,3 +15,5 @@ bin.includes = META-INF/,\
about.html,\
plugin.properties
src.includes = about.html
+javacTarget=jsr14
+javacSource=1.5
diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/CachingArtifactRepository.java b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/CachingArtifactRepository.java
index 962404da7..f5ee63a7c 100644
--- a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/CachingArtifactRepository.java
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/CachingArtifactRepository.java
@@ -14,8 +14,9 @@ import java.io.OutputStream;
import java.net.URI;
import java.util.*;
import org.eclipse.core.runtime.*;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.*;
-import org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.MappedCollectionIterator;
+import org.eclipse.equinox.internal.provisional.p2.metadata.query.CompoundQueryable;
+import org.eclipse.equinox.internal.provisional.p2.metadata.query.IQueryable;
+import org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.FlatteningIterator;
import org.eclipse.equinox.p2.metadata.IArtifactKey;
import org.eclipse.equinox.p2.metadata.query.IQuery;
import org.eclipse.equinox.p2.metadata.query.IQueryResult;
@@ -26,10 +27,10 @@ public class CachingArtifactRepository implements IArtifactRepository, IFileArti
private static final String NULL = ""; //$NON-NLS-1$
private IArtifactRepository innerRepo;
- private Set descriptorsToAdd = new HashSet();
- private Map artifactMap = new HashMap();
- private Set descriptorsToRemove = new HashSet();
- private Map propertyChanges = new HashMap();
+ private Set<IArtifactDescriptor> descriptorsToAdd = new HashSet<IArtifactDescriptor>();
+ private Map<IArtifactKey, List<IArtifactDescriptor>> artifactMap = new HashMap<IArtifactKey, List<IArtifactDescriptor>>();
+ private Set<IArtifactDescriptor> descriptorsToRemove = new HashSet<IArtifactDescriptor>();
+ private Map<String, String> propertyChanges = new HashMap<String, String>();
protected CachingArtifactRepository(IArtifactRepository innerRepo) {
this.innerRepo = innerRepo;
@@ -42,23 +43,23 @@ public class CachingArtifactRepository implements IArtifactRepository, IFileArti
}
private void saveRemovals() {
- for (Iterator i = descriptorsToRemove.iterator(); i.hasNext();)
- innerRepo.removeDescriptor((IArtifactDescriptor) i.next());
+ for (Iterator<IArtifactDescriptor> i = descriptorsToRemove.iterator(); i.hasNext();)
+ innerRepo.removeDescriptor(i.next());
descriptorsToRemove.clear();
}
private void saveAdditions() {
if (descriptorsToAdd.isEmpty())
return;
- innerRepo.addDescriptors((IArtifactDescriptor[]) descriptorsToAdd.toArray(new IArtifactDescriptor[descriptorsToAdd.size()]));
+ innerRepo.addDescriptors(descriptorsToAdd.toArray(new IArtifactDescriptor[descriptorsToAdd.size()]));
descriptorsToAdd.clear();
artifactMap.clear();
}
private void savePropertyChanges() {
- for (Iterator i = propertyChanges.keySet().iterator(); i.hasNext();) {
- String key = (String) i.next();
- String value = (String) propertyChanges.get(key);
+ for (Iterator<String> i = propertyChanges.keySet().iterator(); i.hasNext();) {
+ String key = i.next();
+ String value = propertyChanges.get(key);
innerRepo.setProperty(key, value == NULL ? null : value);
}
propertyChanges.clear();
@@ -66,9 +67,9 @@ public class CachingArtifactRepository implements IArtifactRepository, IFileArti
private void mapDescriptor(IArtifactDescriptor descriptor) {
IArtifactKey key = descriptor.getArtifactKey();
- Collection descriptors = (Collection) artifactMap.get(key);
+ List<IArtifactDescriptor> descriptors = artifactMap.get(key);
if (descriptors == null) {
- descriptors = new ArrayList();
+ descriptors = new ArrayList<IArtifactDescriptor>();
artifactMap.put(key, descriptors);
}
descriptors.add(descriptor);
@@ -76,7 +77,7 @@ public class CachingArtifactRepository implements IArtifactRepository, IFileArti
private void unmapDescriptor(IArtifactDescriptor descriptor) {
IArtifactKey key = descriptor.getArtifactKey();
- Collection descriptors = (Collection) artifactMap.get(key);
+ List<IArtifactDescriptor> descriptors = artifactMap.get(key);
if (descriptors == null) {
// we do not have the descriptor locally so remember it to be removed from
// the inner repo on save.
@@ -104,11 +105,12 @@ public class CachingArtifactRepository implements IArtifactRepository, IFileArti
}
public synchronized IArtifactDescriptor[] getArtifactDescriptors(IArtifactKey key) {
- Collection result = (Collection) artifactMap.get(key);
+ List<IArtifactDescriptor> result = artifactMap.get(key);
if (result == null)
return innerRepo.getArtifactDescriptors(key);
+ result = new ArrayList<IArtifactDescriptor>(result);
result.addAll(Arrays.asList(innerRepo.getArtifactDescriptors(key)));
- return (IArtifactDescriptor[]) result.toArray(new IArtifactDescriptor[result.size()]);
+ return result.toArray(new IArtifactDescriptor[result.size()]);
}
public synchronized boolean contains(IArtifactDescriptor descriptor) {
@@ -136,7 +138,7 @@ public class CachingArtifactRepository implements IArtifactRepository, IFileArti
}
public synchronized void removeAll() {
- IArtifactDescriptor[] toRemove = (IArtifactDescriptor[]) descriptorsToAdd.toArray(new IArtifactDescriptor[descriptorsToAdd.size()]);
+ IArtifactDescriptor[] toRemove = descriptorsToAdd.toArray(new IArtifactDescriptor[descriptorsToAdd.size()]);
for (int i = 0; i < toRemove.length; i++)
doRemoveArtifact(toRemove[i]);
}
@@ -177,7 +179,7 @@ public class CachingArtifactRepository implements IArtifactRepository, IFileArti
return innerRepo.getName();
}
- public Map getProperties() {
+ public Map<String, String> getProperties() {
// TODO need to combine the local and inner properties
return innerRepo.getProperties();
}
@@ -207,7 +209,7 @@ public class CachingArtifactRepository implements IArtifactRepository, IFileArti
}
public String setProperty(String key, String value) {
- String result = (String) getProperties().get(key);
+ String result = getProperties().get(key);
propertyChanges.put(key, value == null ? NULL : value);
return result;
}
@@ -216,6 +218,7 @@ public class CachingArtifactRepository implements IArtifactRepository, IFileArti
innerRepo.setProvider(provider);
}
+ @SuppressWarnings("rawtypes")
public Object getAdapter(Class adapter) {
return innerRepo.getAdapter(adapter);
}
@@ -236,23 +239,29 @@ public class CachingArtifactRepository implements IArtifactRepository, IFileArti
return innerRepo.createArtifactDescriptor(key);
}
- public synchronized IQueryResult query(IQuery query, IProgressMonitor monitor) {
- if (monitor != null && monitor.isCanceled())
- return Collector.EMPTY_COLLECTOR;
+ public IQueryable<IArtifactDescriptor> descriptorQueryable() {
+ final Collection<List<IArtifactDescriptor>> descs = artifactMap.values();
+ IQueryable<IArtifactDescriptor> cached = new IQueryable<IArtifactDescriptor>() {
+ public IQueryResult<IArtifactDescriptor> query(IQuery<IArtifactDescriptor> query, IProgressMonitor monitor) {
+ return query.perform(new FlatteningIterator<IArtifactDescriptor>(descs.iterator()));
+ }
+ };
- final boolean excludeKeys = Boolean.TRUE.equals(query.getProperty(IArtifactRepository.QUERY_EXCLUDE_KEYS));
- final boolean excludeDescriptors = Boolean.TRUE.equals(query.getProperty(IArtifactRepository.QUERY_EXCLUDE_DESCRIPTORS));
- if (excludeKeys && excludeDescriptors)
- return Collector.EMPTY_COLLECTOR;
+ @SuppressWarnings("unchecked")
+ CompoundQueryable<IArtifactDescriptor> compound = new CompoundQueryable<IArtifactDescriptor>(new IQueryable[] {cached, innerRepo.descriptorQueryable()});
+ return compound;
+ }
- IQueryable cached = new IQueryable() {
- public IQueryResult query(IQuery query, IProgressMonitor monitor) {
- Iterator i = !excludeDescriptors ? new MappedCollectionIterator(artifactMap, !excludeKeys) : artifactMap.keySet().iterator();
- return query.perform(i);
+ public IQueryResult<IArtifactKey> query(IQuery<IArtifactKey> query, IProgressMonitor monitor) {
+ final Iterator<IArtifactKey> keyIterator = artifactMap.keySet().iterator();
+ IQueryable<IArtifactKey> cached = new IQueryable<IArtifactKey>() {
+ public IQueryResult<IArtifactKey> query(IQuery<IArtifactKey> q, IProgressMonitor mon) {
+ return q.perform(keyIterator);
}
};
- CompoundQueryable compound = new CompoundQueryable(new IQueryable[] {cached, innerRepo});
+ @SuppressWarnings("unchecked")
+ CompoundQueryable<IArtifactKey> compound = new CompoundQueryable<IArtifactKey>(new IQueryable[] {cached, innerRepo});
return compound.query(query, monitor);
}
}
diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/DirectoryWatcher.java b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/DirectoryWatcher.java
index dea2d358d..11ed47fd6 100644
--- a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/DirectoryWatcher.java
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/DirectoryWatcher.java
@@ -62,14 +62,14 @@ public class DirectoryWatcher {
final File[] directories;
long poll = 2000;
- private Set listeners = new HashSet();
- private HashSet scannedFiles = new HashSet();
- private HashSet removals;
- private Set pendingDeletions;
+ private Set<DirectoryChangeListener> listeners = new HashSet<DirectoryChangeListener>();
+ private HashSet<File> scannedFiles = new HashSet<File>();
+ private HashSet<File> removals;
+ private Set<File> pendingDeletions;
private WatcherThread watcher;
- public DirectoryWatcher(Dictionary properties, BundleContext context) {
- String dir = (String) properties.get(DIR);
+ public DirectoryWatcher(Map<String, String> properties, BundleContext context) {
+ String dir = properties.get(DIR);
if (dir == null)
dir = "./load"; //$NON-NLS-1$
@@ -131,10 +131,10 @@ public class DirectoryWatcher {
private void startPoll() {
removals = scannedFiles;
- scannedFiles = new HashSet();
- pendingDeletions = new HashSet();
- for (Iterator i = listeners.iterator(); i.hasNext();)
- ((DirectoryChangeListener) i.next()).startPoll();
+ scannedFiles = new HashSet<File>();
+ pendingDeletions = new HashSet<File>();
+ for (Iterator<DirectoryChangeListener> i = listeners.iterator(); i.hasNext();)
+ i.next().startPoll();
}
private void scanDirectories() {
@@ -155,8 +155,8 @@ public class DirectoryWatcher {
// removed at the end. Then notify all the listeners as needed.
scannedFiles.add(file);
removals.remove(file);
- for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
- DirectoryChangeListener listener = (DirectoryChangeListener) iterator.next();
+ for (Iterator<DirectoryChangeListener> iterator = listeners.iterator(); iterator.hasNext();) {
+ DirectoryChangeListener listener = iterator.next();
if (isInterested(listener, file))
processFile(file, listener);
}
@@ -168,8 +168,8 @@ public class DirectoryWatcher {
private void stopPoll() {
notifyRemovals();
removals = scannedFiles;
- for (Iterator i = listeners.iterator(); i.hasNext();)
- ((DirectoryChangeListener) i.next()).stopPoll();
+ for (Iterator<DirectoryChangeListener> i = listeners.iterator(); i.hasNext();)
+ i.next().stopPoll();
processPendingDeletions();
}
@@ -181,11 +181,11 @@ public class DirectoryWatcher {
* Notify the listeners of the files that have been deleted or marked for deletion.
*/
private void notifyRemovals() {
- Set removed = removals;
- for (Iterator i = listeners.iterator(); i.hasNext();) {
- DirectoryChangeListener listener = (DirectoryChangeListener) i.next();
- for (Iterator j = removed.iterator(); j.hasNext();) {
- File file = (File) j.next();
+ Set<File> removed = removals;
+ for (Iterator<DirectoryChangeListener> i = listeners.iterator(); i.hasNext();) {
+ DirectoryChangeListener listener = i.next();
+ for (Iterator<File> j = removed.iterator(); j.hasNext();) {
+ File file = j.next();
if (isInterested(listener, file))
listener.removed(file);
}
@@ -213,8 +213,8 @@ public class DirectoryWatcher {
* Try to remove the files that have been marked for deletion.
*/
private void processPendingDeletions() {
- for (Iterator iterator = pendingDeletions.iterator(); iterator.hasNext();) {
- File file = (File) iterator.next();
+ for (Iterator<File> iterator = pendingDeletions.iterator(); iterator.hasNext();) {
+ File file = iterator.next();
if (!file.exists() || file.delete())
iterator.remove();
new File(file.getPath() + DEL_EXT).delete();
diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/EntryAdvice.java b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/EntryAdvice.java
index 05a6bf948..8e1fba54c 100644
--- a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/EntryAdvice.java
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/EntryAdvice.java
@@ -12,8 +12,8 @@ package org.eclipse.equinox.internal.provisional.p2.directorywatcher;
import java.io.File;
import java.net.URI;
+import java.util.HashMap;
import java.util.Map;
-import java.util.Properties;
import org.eclipse.equinox.internal.p2.update.Site;
import org.eclipse.equinox.internal.provisional.p2.metadata.Version;
import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory.InstallableUnitDescription;
@@ -27,8 +27,8 @@ import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor;
* only one entry at a time and that entry is the the only entry being published.
*/
public class EntryAdvice implements IPropertyAdvice {
- private Properties metadataProps = new Properties();
- private Properties artifactProps = new Properties();
+ private Map<String, String> metadataProps = new HashMap<String, String>();
+ private Map<String, String> artifactProps = new HashMap<String, String>();
public boolean isApplicable(String configSpec, boolean includeDefault, String id, Version version) {
return true;
@@ -42,27 +42,23 @@ public class EntryAdvice implements IPropertyAdvice {
if (reference == null)
artifactProps.remove(RepositoryListener.ARTIFACT_REFERENCE);
else
- artifactProps.setProperty(RepositoryListener.ARTIFACT_REFERENCE, reference.toString());
+ artifactProps.put(RepositoryListener.ARTIFACT_REFERENCE, reference.toString());
if (location.isDirectory())
- artifactProps.setProperty(RepositoryListener.ARTIFACT_FOLDER, Boolean.TRUE.toString());
+ artifactProps.put(RepositoryListener.ARTIFACT_FOLDER, Boolean.TRUE.toString());
else
artifactProps.remove(RepositoryListener.ARTIFACT_FOLDER);
- artifactProps.setProperty(RepositoryListener.FILE_NAME, location.getAbsolutePath());
- metadataProps.setProperty(RepositoryListener.FILE_NAME, location.getAbsolutePath());
- metadataProps.setProperty(RepositoryListener.FILE_LAST_MODIFIED, Long.toString(timestamp));
+ artifactProps.put(RepositoryListener.FILE_NAME, location.getAbsolutePath());
+ metadataProps.put(RepositoryListener.FILE_NAME, location.getAbsolutePath());
+ metadataProps.put(RepositoryListener.FILE_LAST_MODIFIED, Long.toString(timestamp));
if (linkFile != null)
- metadataProps.setProperty(Site.PROP_LINK_FILE, linkFile);
+ metadataProps.put(Site.PROP_LINK_FILE, linkFile);
}
- public Map getInstructions(File location) {
- return null;
- }
-
- public Properties getArtifactProperties(IInstallableUnit iu, IArtifactDescriptor descriptor) {
+ public Map<String, String> getArtifactProperties(IInstallableUnit iu, IArtifactDescriptor descriptor) {
return artifactProps;
}
- public Properties getInstallableUnitProperties(InstallableUnitDescription iu) {
+ public Map<String, String> getInstallableUnitProperties(InstallableUnitDescription iu) {
return metadataProps;
}
}
diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.java b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.java
index 2c7bc4a7c..c657c45b0 100644
--- a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.java
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.java
@@ -41,8 +41,8 @@ public class RepositoryListener extends DirectoryChangeListener {
private final CachingArtifactRepository artifactRepository;
// at any point in time currentFiles is the list of files/dirs that the watcher has seen and
// believes to be on disk.
- private final Map currentFiles = new HashMap();
- private final Collection polledSeenFiles = new HashSet();
+ private final Map<File, Long> currentFiles = new HashMap<File, Long>();
+ private final Collection<File> polledSeenFiles = new HashSet<File>();
private EntryAdvice advice = new EntryAdvice();
private PublisherInfo info;
@@ -89,7 +89,7 @@ public class RepositoryListener extends DirectoryChangeListener {
}
try {
String name = repositoryName;
- Map properties = new HashMap(1);
+ Map<String, String> properties = new HashMap<String, String>(1);
if (hidden) {
properties.put(IRepository.PROP_SYSTEM, Boolean.TRUE.toString());
name = "artifact listener " + repositoryName; //$NON-NLS-1$
@@ -114,7 +114,7 @@ public class RepositoryListener extends DirectoryChangeListener {
}
try {
String name = repositoryName;
- Map properties = new HashMap(1);
+ Map<String, String> properties = new HashMap<String, String>(1);
if (hidden) {
properties.put(IRepository.PROP_SYSTEM, Boolean.TRUE.toString());
name = "metadata listener " + repositoryName; //$NON-NLS-1$
@@ -163,7 +163,7 @@ public class RepositoryListener extends DirectoryChangeListener {
}
private boolean processFeature(File file, boolean isAddition) {
- String link = (String) metadataRepository.getProperties().get(Site.PROP_LINK_FILE);
+ String link = metadataRepository.getProperties().get(Site.PROP_LINK_FILE);
advice.setProperties(file, file.lastModified(), file.toURI(), link);
return publish(new FeaturesAction(new File[] {file}), isAddition);
}
@@ -178,7 +178,7 @@ public class RepositoryListener extends DirectoryChangeListener {
}
public Long getSeenFile(File file) {
- Long lastSeen = (Long) currentFiles.get(file);
+ Long lastSeen = currentFiles.get(file);
if (lastSeen != null)
polledSeenFiles.add(file);
return lastSeen;
@@ -191,7 +191,7 @@ public class RepositoryListener extends DirectoryChangeListener {
}
public void stopPoll() {
- final Set filesToRemove = new HashSet(currentFiles.keySet());
+ final Set<File> filesToRemove = new HashSet<File>(currentFiles.keySet());
filesToRemove.removeAll(polledSeenFiles);
polledSeenFiles.clear();
@@ -204,20 +204,17 @@ public class RepositoryListener extends DirectoryChangeListener {
/**
* Flush all the pending changes to the metadata repository.
*/
- private void synchronizeMetadataRepository(final Collection removedFiles) {
+ private void synchronizeMetadataRepository(final Collection<File> removedFiles) {
if (metadataRepository == null)
return;
- final Collection changes = iusToChange.getIUs(null, null);
+ final Collection<IInstallableUnit> changes = iusToChange.getIUs(null, null);
// first remove any IUs that have changed or that are associated with removed files
if (!removedFiles.isEmpty() || !changes.isEmpty()) {
- metadataRepository.removeInstallableUnits((IInstallableUnit[]) changes.toArray(new IInstallableUnit[changes.size()]), null);
+ metadataRepository.removeInstallableUnits(changes.toArray(new IInstallableUnit[changes.size()]), null);
// create a query that will identify all ius related to removed files
- IMatchQuery removeQuery = new MatchQuery() {
- public boolean isMatch(Object candidate) {
- if (!(candidate instanceof IInstallableUnit))
- return false;
- IInstallableUnit iu = (IInstallableUnit) candidate;
+ IMatchQuery<IInstallableUnit> removeQuery = new MatchQuery<IInstallableUnit>() {
+ public boolean isMatch(IInstallableUnit iu) {
String filename = iu.getProperty(FILE_NAME);
if (filename == null) {
String message = NLS.bind(Messages.filename_missing, "installable unit", iu.getId()); //$NON-NLS-1$
@@ -228,14 +225,14 @@ public class RepositoryListener extends DirectoryChangeListener {
return removedFiles.contains(iuFile);
}
};
- IQueryResult toRemove = metadataRepository.query(removeQuery, null);
- metadataRepository.removeInstallableUnits((IInstallableUnit[]) toRemove.toArray(IInstallableUnit.class), null);
+ IQueryResult<IInstallableUnit> toRemove = metadataRepository.query(removeQuery, null);
+ metadataRepository.removeInstallableUnits(toRemove.toArray(IInstallableUnit.class), null);
}
// Then add all the new IUs as well as the new copies of the ones that have changed
- Collection additions = iusToAdd.getIUs(null, null);
+ Collection<IInstallableUnit> additions = iusToAdd.getIUs(null, null);
additions.addAll(changes);
if (!additions.isEmpty())
- metadataRepository.addInstallableUnits((IInstallableUnit[]) additions.toArray(new IInstallableUnit[additions.size()]));
+ metadataRepository.addInstallableUnits(additions.toArray(new IInstallableUnit[additions.size()]));
}
/**
@@ -243,12 +240,12 @@ public class RepositoryListener extends DirectoryChangeListener {
* descriptors related to any file that has been removed and flush the repo
* to ensure that all the additions and removals have been completed.
*/
- private void synchronizeArtifactRepository(final Collection removedFiles) {
+ private void synchronizeArtifactRepository(final Collection<File> removedFiles) {
if (artifactRepository == null)
return;
if (!removedFiles.isEmpty()) {
- IQueryResult descriptors = artifactRepository.query(ArtifactDescriptorQuery.ALL_DESCRIPTORS, null);
- for (Iterator iterator = descriptors.iterator(); iterator.hasNext();) {
+ IQueryResult<IArtifactDescriptor> descriptors = artifactRepository.descriptorQueryable().query(ArtifactDescriptorQuery.ALL_DESCRIPTORS, null);
+ for (Iterator<IArtifactDescriptor> iterator = descriptors.iterator(); iterator.hasNext();) {
SimpleArtifactDescriptor descriptor = (SimpleArtifactDescriptor) iterator.next();
String filename = descriptor.getRepositoryProperty(FILE_NAME);
if (filename == null) {
@@ -271,9 +268,9 @@ public class RepositoryListener extends DirectoryChangeListener {
private void synchronizeCurrentFiles() {
currentFiles.clear();
if (metadataRepository != null) {
- IQueryResult ius = metadataRepository.query(InstallableUnitQuery.ANY, null);
- for (Iterator it = ius.iterator(); it.hasNext();) {
- IInstallableUnit iu = (IInstallableUnit) it.next();
+ IQueryResult<IInstallableUnit> ius = metadataRepository.query(InstallableUnitQuery.ANY, null);
+ for (Iterator<IInstallableUnit> it = ius.iterator(); it.hasNext();) {
+ IInstallableUnit iu = it.next();
String filename = iu.getProperty(FILE_NAME);
if (filename == null) {
String message = NLS.bind(Messages.filename_missing, "installable unit", iu.getId()); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.equinox.p2.engine/.classpath b/bundles/org.eclipse.equinox.p2.engine/.classpath
index 2fbb7a23e..64c5e31b7 100644
--- a/bundles/org.eclipse.equinox.p2.engine/.classpath
+++ b/bundles/org.eclipse.equinox.p2.engine/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <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.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
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
index c98c987a2..3bc330a7d 100644
--- 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
@@ -1,4 +1,4 @@
-#Fri Feb 22 09:19:01 EST 2008
+#Mon Dec 21 23:51:30 CET 2009
eclipse.preferences.version=1
instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
@@ -8,24 +8,24 @@ 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.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.compliance=1.5
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.assertIdentifier=error
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.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
@@ -72,7 +72,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=en
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.compiler.source=1.5
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
diff --git a/bundles/org.eclipse.equinox.p2.engine/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.engine/META-INF/MANIFEST.MF
index 7e7dcba8b..3920af54a 100644
--- a/bundles/org.eclipse.equinox.p2.engine/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.engine/META-INF/MANIFEST.MF
@@ -56,7 +56,8 @@ Import-Package: javax.xml.parsers,
Bundle-Activator: org.eclipse.equinox.internal.p2.engine.EngineActivator
Bundle-ActivationPolicy: lazy
Eclipse-RegisterBuddy: org.eclipse.equinox.p2.metadata.repository
-Bundle-RequiredExecutionEnvironment: J2SE-1.4,
+Bundle-RequiredExecutionEnvironment: J2SE-1.5,
+ J2SE-1.4,
CDC-1.1/Foundation-1.1
Require-Bundle: org.eclipse.equinox.common,
org.eclipse.equinox.registry,
diff --git a/bundles/org.eclipse.equinox.p2.engine/build.properties b/bundles/org.eclipse.equinox.p2.engine/build.properties
index f55cc8399..c83017ced 100644
--- a/bundles/org.eclipse.equinox.p2.engine/build.properties
+++ b/bundles/org.eclipse.equinox.p2.engine/build.properties
@@ -19,3 +19,5 @@ bin.includes = META-INF/,\
src.includes = about.html,\
schema/
source.. = src/
+javacTarget=jsr14
+javacSource=1.5
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ActionManager.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ActionManager.java
index 7235ef15a..fdc23b04d 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ActionManager.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ActionManager.java
@@ -34,7 +34,7 @@ public class ActionManager implements IRegistryChangeListener {
*/
public static final String SERVICE_NAME = ActionManager.class.getName();
- private HashMap actionMap;
+ private HashMap<String, IConfigurationElement> actionMap;
private TouchpointManager touchpointManager;
public ActionManager() {
@@ -62,7 +62,7 @@ public class ActionManager implements IRegistryChangeListener {
}
public ProvisioningAction getAction(String actionId, VersionRange versionRange) {
- IConfigurationElement actionElement = (IConfigurationElement) getActionMap().get(actionId);
+ IConfigurationElement actionElement = getActionMap().get(actionId);
if (actionElement != null && actionElement.isValid()) {
try {
ProvisioningAction action = (ProvisioningAction) actionElement.createExecutableExtension(ATTRIBUTE_CLASS);
@@ -85,12 +85,12 @@ public class ActionManager implements IRegistryChangeListener {
return null;
}
- private synchronized Map getActionMap() {
+ private synchronized Map<String, IConfigurationElement> getActionMap() {
if (actionMap != null)
return actionMap;
IExtensionPoint point = RegistryFactory.getRegistry().getExtensionPoint(EngineActivator.ID, PT_ACTIONS);
IExtension[] extensions = point.getExtensions();
- actionMap = new HashMap(extensions.length);
+ actionMap = new HashMap<String, IConfigurationElement>(extensions.length);
for (int i = 0; i < extensions.length; i++) {
try {
IConfigurationElement[] elements = extensions[i].getConfigurationElements();
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/DebugHelper.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/DebugHelper.java
index 2eccc8150..ec9ebd502 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/DebugHelper.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/DebugHelper.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.engine;
-
import java.io.File;
import java.util.*;
import java.util.Map.Entry;
@@ -54,8 +53,8 @@ public class DebugHelper {
System.out.println(buffer.toString());
}
- public static String formatArray(Object[] array, boolean toString, boolean newLines) {
- if (array == null || array.length == 0)
+ public static String formatArray(List<? extends Object> array, boolean toString, boolean newLines) {
+ if (array == null || array.size() == 0)
return "[]"; //$NON-NLS-1$
StringBuffer buffer = new StringBuffer();
@@ -63,11 +62,11 @@ public class DebugHelper {
int i = 0;
for (;;) {
if (toString)
- buffer.append(array[i].toString());
+ buffer.append(array.get(i).toString());
else
- buffer.append(array[i].getClass().getName());
+ buffer.append(array.get(i).getClass().getName());
i++;
- if (i == array.length)
+ if (i == array.size())
break;
buffer.append(',');
if (newLines)
@@ -101,7 +100,7 @@ public class DebugHelper {
operandStrings[i] = operands[i].toString();
}
}
- return DebugHelper.formatArray(operandStrings, true, true);
+ return DebugHelper.formatArray(Arrays.asList(operandStrings), true, true);
}
public static String formatInstallableUnitOperand(InstallableUnitOperand iuOperand) {
@@ -118,19 +117,19 @@ public class DebugHelper {
public static String formatPhaseSet(PhaseSet phaseSet) {
StringBuffer buffer = new StringBuffer(phaseSet.getClass().getName());
- buffer.append(DebugHelper.formatArray(phaseSet.getPhases(), false, false));
+ buffer.append(DebugHelper.formatArray(Arrays.asList(phaseSet.getPhases()), false, false));
return buffer.toString();
}
public static String formatContext(ProvisioningContext context) {
StringBuffer buffer = new StringBuffer();
- buffer.append("{artifactRepos=" + DebugHelper.formatArray(context.getArtifactRepositories(), true, false)); //$NON-NLS-1$
- buffer.append(", metadataRepos=" + DebugHelper.formatArray(context.getMetadataRepositories(), true, false)); //$NON-NLS-1$
+ buffer.append("{artifactRepos=" + DebugHelper.formatArray(Arrays.asList(context.getArtifactRepositories()), true, false)); //$NON-NLS-1$
+ buffer.append(", metadataRepos=" + DebugHelper.formatArray(Arrays.asList(context.getMetadataRepositories()), true, false)); //$NON-NLS-1$
buffer.append(", properties=" + context.getProperties() + "}"); //$NON-NLS-1$ //$NON-NLS-2$
return buffer.toString();
}
- public static String formatAction(ProvisioningAction action, Map parameters) {
+ public static String formatAction(ProvisioningAction action, Map<String, Object> parameters) {
StringBuffer buffer = new StringBuffer();
buffer.append(action.getClass().getName());
if (action instanceof ParameterizedProvisioningAction) {
@@ -143,16 +142,16 @@ public class DebugHelper {
return buffer.toString();
}
- public static String formatParameters(Map parameters) {
- Iterator it = parameters.entrySet().iterator();
+ public static String formatParameters(Map<String, ? extends Object> parameters) {
+ Iterator<? extends Entry<String, ? extends Object>> it = parameters.entrySet().iterator();
if (!it.hasNext())
return "{}"; //$NON-NLS-1$
StringBuffer buffer = new StringBuffer();
buffer.append('{');
for (;;) {
- Entry e = (Entry) it.next();
- String key = (String) e.getKey();
+ Entry<String, ? extends Object> e = it.next();
+ String key = e.getKey();
buffer.append(key);
buffer.append('=');
Object value = e.getValue();
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/DownloadManager.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/DownloadManager.java
index 98b2cb6ba..ddecadf63 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/DownloadManager.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/DownloadManager.java
@@ -21,21 +21,18 @@ import org.eclipse.equinox.p2.repository.artifact.*;
public class DownloadManager {
private ProvisioningContext provContext = null;
- ArrayList requestsToProcess = new ArrayList();
+ ArrayList<IArtifactRequest> requestsToProcess = new ArrayList<IArtifactRequest>();
private static final String FILE_PROTOCOL = "file"; //$NON-NLS-1$
/**
- * This Comparator sorts the repositories such that ´local´ repositories are first
+ * This Comparator sorts the repositories such that �local� repositories are first
*/
- private static final Comparator LOCAL_FIRST_COMPARATOR = new Comparator() {
+ private static final Comparator<URI> LOCAL_FIRST_COMPARATOR = new Comparator<URI>() {
- public int compare(Object arg0, Object arg1) {
- Assert.isTrue(arg0 instanceof URI);
- Assert.isTrue(arg1 instanceof URI);
-
- String protocol0 = ((URI) arg0).getScheme();
- String protocol1 = ((URI) arg1).getScheme();
+ public int compare(URI arg0, URI arg1) {
+ String protocol0 = arg0.getScheme();
+ String protocol1 = arg1.getScheme();
if (FILE_PROTOCOL.equals(protocol0) && !FILE_PROTOCOL.equals(protocol1))
return -1;
@@ -68,8 +65,8 @@ public class DownloadManager {
}
private void filterUnfetched() {
- for (Iterator iterator = requestsToProcess.iterator(); iterator.hasNext();) {
- IArtifactRequest request = (IArtifactRequest) iterator.next();
+ for (Iterator<IArtifactRequest> iterator = requestsToProcess.iterator(); iterator.hasNext();) {
+ IArtifactRequest request = iterator.next();
if (request.getResult() != null && request.getResult().isOK()) {
iterator.remove();
}
@@ -117,13 +114,13 @@ public class DownloadManager {
}
private IArtifactRequest[] getRequestsForRepository(IArtifactRepository repository) {
- ArrayList applicable = new ArrayList();
- for (Iterator it = requestsToProcess.iterator(); it.hasNext();) {
- IArtifactRequest request = (IArtifactRequest) it.next();
+ ArrayList<IArtifactRequest> applicable = new ArrayList<IArtifactRequest>();
+ for (Iterator<IArtifactRequest> it = requestsToProcess.iterator(); it.hasNext();) {
+ IArtifactRequest request = it.next();
if (repository.contains(request.getArtifactKey()))
applicable.add(request);
}
- return (IArtifactRequest[]) applicable.toArray(new IArtifactRequest[applicable.size()]);
+ return applicable.toArray(new IArtifactRequest[applicable.size()]);
}
// private void notifyFetched() {
@@ -139,8 +136,8 @@ public class DownloadManager {
return Status.OK_STATUS;
MultiStatus result = new MultiStatus(EngineActivator.ID, IStatus.OK, null, null);
- for (Iterator iterator = requestsToProcess.iterator(); iterator.hasNext();) {
- IStatus failed = ((IArtifactRequest) iterator.next()).getResult();
+ for (Iterator<IArtifactRequest> iterator = requestsToProcess.iterator(); iterator.hasNext();) {
+ IStatus failed = iterator.next().getResult();
if (failed != null && !failed.isOK())
result.add(failed);
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/EngineSession.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/EngineSession.java
index a67e0e2c4..aad0d1d27 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/EngineSession.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/EngineSession.java
@@ -29,28 +29,28 @@ public class EngineSession {
private static class ActionsRecord {
Operand operand;
- List actions = new ArrayList();
+ List<ProvisioningAction> actions = new ArrayList<ProvisioningAction>();
ActionsRecord(Operand operand) {
this.operand = operand;
}
}
- private List phaseActionRecordsPairs = new ArrayList();
+ private List<Object[]> phaseActionRecordsPairs = new ArrayList<Object[]>();
private Phase currentPhase;
boolean currentPhaseActive;
- private List currentActionRecords;
+ private List<ActionsRecord> currentActionRecords;
private ActionsRecord currentRecord;
private IProfile profile;
private ProvisioningContext context;
- private final HashMap sessionServices = new HashMap();
+ private final HashMap<String, Object> sessionServices = new HashMap<String, Object>();
- private Set touchpoints = new HashSet();
+ private Set<Touchpoint> touchpoints = new HashSet<Touchpoint>();
private final IProvisioningAgent agent;
@@ -93,8 +93,8 @@ public class EngineSession {
IStatus prepare(IProgressMonitor monitor) {
monitor.subTask(Messages.preparing);
MultiStatus status = new MultiStatus(EngineActivator.ID, IStatus.OK, null, null);
- for (Iterator iterator = touchpoints.iterator(); iterator.hasNext();) {
- Touchpoint touchpoint = (Touchpoint) iterator.next();
+ for (Iterator<Touchpoint> iterator = touchpoints.iterator(); iterator.hasNext();) {
+ Touchpoint touchpoint = iterator.next();
try {
status.add(touchpoint.prepare(profile));
} catch (RuntimeException e) {
@@ -119,8 +119,8 @@ public class EngineSession {
monitor.subTask(Messages.committing);
MultiStatus status = new MultiStatus(EngineActivator.ID, IStatus.OK, null, null);
phaseActionRecordsPairs.clear();
- for (Iterator iterator = touchpoints.iterator(); iterator.hasNext();) {
- Touchpoint touchpoint = (Touchpoint) iterator.next();
+ for (Iterator<Touchpoint> iterator = touchpoints.iterator(); iterator.hasNext();) {
+ Touchpoint touchpoint = iterator.next();
try {
IStatus result = touchpoint.commit(profile);
if (!result.isOK())
@@ -171,10 +171,11 @@ public class EngineSession {
}
currentPhase = null;
- for (ListIterator it = phaseActionRecordsPairs.listIterator(phaseActionRecordsPairs.size()); it.hasPrevious();) {
- Object[] pair = (Object[]) it.previous();
+ for (ListIterator<Object[]> it = phaseActionRecordsPairs.listIterator(phaseActionRecordsPairs.size()); it.hasPrevious();) {
+ Object[] pair = it.previous();
Phase phase = (Phase) pair[0];
- List actionRecords = (List) pair[1];
+ @SuppressWarnings("unchecked")
+ List<ActionsRecord> actionRecords = (List<ActionsRecord>) pair[1];
try {
final IStatus result = rollBackPhase(phase, actionRecords);
if (!result.isOK())
@@ -190,8 +191,8 @@ public class EngineSession {
}
phaseActionRecordsPairs.clear();
- for (Iterator iterator = touchpoints.iterator(); iterator.hasNext();) {
- Touchpoint touchpoint = (Touchpoint) iterator.next();
+ for (Iterator<Touchpoint> iterator = touchpoints.iterator(); iterator.hasNext();) {
+ Touchpoint touchpoint = iterator.next();
try {
IStatus result = touchpoint.rollback(profile);
if (!result.isOK())
@@ -214,7 +215,7 @@ public class EngineSession {
return status;
}
- private IStatus rollBackPhase(Phase phase, List actionRecords) {
+ private IStatus rollBackPhase(Phase phase, List<ActionsRecord> actionRecords) {
MultiStatus result = new MultiStatus(EngineActivator.ID, IStatus.OK, null, null);
try {
phase.actionManager = (ActionManager) agent.getService(ActionManager.SERVICE_NAME);
@@ -222,9 +223,9 @@ public class EngineSession {
if (!currentPhaseActive)
phase.prePerform(result, this, new NullProgressMonitor());
- for (ListIterator it = actionRecords.listIterator(actionRecords.size()); it.hasPrevious();) {
- ActionsRecord record = (ActionsRecord) it.previous();
- ProvisioningAction[] actions = (ProvisioningAction[]) record.actions.toArray(new ProvisioningAction[record.actions.size()]);
+ for (ListIterator<ActionsRecord> it = actionRecords.listIterator(actionRecords.size()); it.hasPrevious();) {
+ ActionsRecord record = it.previous();
+ ProvisioningAction[] actions = record.actions.toArray(new ProvisioningAction[record.actions.size()]);
try {
phase.undo(result, this, profile, record.operand, actions, context);
} catch (RuntimeException e) {
@@ -264,7 +265,7 @@ public class EngineSession {
throw new IllegalArgumentException(Messages.not_current_phase);
currentPhaseActive = true;
- currentActionRecords = new ArrayList();
+ currentActionRecords = new ArrayList<ActionsRecord>();
}
void recordPhaseEnd(Phase phase) {
@@ -318,7 +319,7 @@ public class EngineSession {
debugOperandEnd(operand);
}
- void recordActionExecute(ProvisioningAction action, Map parameters) {
+ void recordActionExecute(ProvisioningAction action, Map<String, Object> parameters) {
if (action == null)
throw new IllegalArgumentException(Messages.null_action);
@@ -332,7 +333,7 @@ public class EngineSession {
debugActionExecute(action, parameters);
}
- public void recordActionUndo(ProvisioningAction action, Map parameters) {
+ public void recordActionUndo(ProvisioningAction action, Map<String, Object> parameters) {
if (DebugHelper.DEBUG_ENGINE_SESSION)
debugActionUndo(action, parameters);
}
@@ -391,11 +392,11 @@ public class EngineSession {
DebugHelper.debug(ENGINE_SESSION, "Ending processing of operand: " + operand.toString()); //$NON-NLS-1$
}
- private static void debugActionExecute(ProvisioningAction action, Map parameters) {
+ private static void debugActionExecute(ProvisioningAction action, Map<String, Object> parameters) {
DebugHelper.debug(ENGINE_SESSION, "Executing action: " + DebugHelper.formatAction(action, parameters)); //$NON-NLS-1$
}
- private static void debugActionUndo(ProvisioningAction action, Map parameters) {
+ private static void debugActionUndo(ProvisioningAction action, Map<String, Object> parameters) {
DebugHelper.debug(ENGINE_SESSION, "Undoing action: " + DebugHelper.formatAction(action, parameters)); //$NON-NLS-1$
}
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/InstallableUnitPhase.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/InstallableUnitPhase.java
index 46788b780..d8b5b1bfe 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/InstallableUnitPhase.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/InstallableUnitPhase.java
@@ -13,6 +13,7 @@ package org.eclipse.equinox.internal.p2.engine;
import java.util.*;
import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils;
import org.eclipse.equinox.internal.provisional.p2.metadata.ITouchpointData;
import org.eclipse.equinox.internal.provisional.p2.metadata.ITouchpointInstruction;
import org.eclipse.equinox.p2.engine.*;
@@ -33,12 +34,12 @@ public abstract class InstallableUnitPhase extends Phase {
this(phaseId, weight, false);
}
- protected IStatus initializePhase(IProgressMonitor monitor, IProfile profile, Map parameters) {
+ protected IStatus initializePhase(IProgressMonitor monitor, IProfile profile, Map<String, Object> parameters) {
parameters.put(PARM_INSTALL_FOLDER, profile.getProperty(IProfile.PROP_INSTALL_FOLDER));
return super.initializePhase(monitor, profile, parameters);
}
- protected IStatus initializeOperand(IProfile profile, Operand operand, Map parameters, IProgressMonitor monitor) {
+ protected IStatus initializeOperand(IProfile profile, Operand operand, Map<String, Object> parameters, IProgressMonitor monitor) {
InstallableUnitOperand iuOperand = (InstallableUnitOperand) operand;
MultiStatus status = new MultiStatus(EngineActivator.ID, IStatus.OK, null, null);
mergeStatus(status, initializeOperand(profile, iuOperand, parameters, monitor));
@@ -53,11 +54,11 @@ public abstract class InstallableUnitPhase extends Phase {
return status;
}
- protected IStatus initializeOperand(IProfile profile, InstallableUnitOperand operand, Map parameters, IProgressMonitor monitor) {
+ protected IStatus initializeOperand(IProfile profile, InstallableUnitOperand operand, Map<String, Object> parameters, IProgressMonitor monitor) {
return Status.OK_STATUS;
}
- protected IStatus completeOperand(IProfile profile, Operand operand, Map parameters, IProgressMonitor monitor) {
+ protected IStatus completeOperand(IProfile profile, Operand operand, Map<String, Object> parameters, IProgressMonitor monitor) {
InstallableUnitOperand iuOperand = (InstallableUnitOperand) operand;
MultiStatus status = new MultiStatus(EngineActivator.ID, IStatus.OK, null, null);
@@ -66,11 +67,11 @@ public abstract class InstallableUnitPhase extends Phase {
return status;
}
- protected IStatus completeOperand(IProfile profile, InstallableUnitOperand operand, Map parameters, IProgressMonitor monitor) {
+ protected IStatus completeOperand(IProfile profile, InstallableUnitOperand operand, Map<String, Object> parameters, IProgressMonitor monitor) {
return Status.OK_STATUS;
}
- final protected ProvisioningAction[] getActions(Operand operand) {
+ final protected List<ProvisioningAction> getActions(Operand operand) {
if (!(operand instanceof InstallableUnitOperand))
return null;
@@ -78,7 +79,7 @@ public abstract class InstallableUnitPhase extends Phase {
return getActions(iuOperand);
}
- protected abstract ProvisioningAction[] getActions(InstallableUnitOperand operand);
+ protected abstract List<ProvisioningAction> getActions(InstallableUnitOperand operand);
final public boolean isApplicable(Operand operand) {
if (!(operand instanceof InstallableUnitOperand))
@@ -92,32 +93,32 @@ public abstract class InstallableUnitPhase extends Phase {
return true;
}
- protected final ProvisioningAction[] getActions(IInstallableUnit unit, String key) {
- ITouchpointInstruction[] instructions = getInstructions(unit, key);
- if (instructions == null || instructions.length == 0)
+ protected final List<ProvisioningAction> getActions(IInstallableUnit unit, String key) {
+ List<ITouchpointInstruction> instructions = getInstructions(unit, key);
+ int instrSize = instructions.size();
+ if (instrSize == 0)
return null;
- List actions = new ArrayList();
+ List<ProvisioningAction> actions = new ArrayList<ProvisioningAction>();
InstructionParser instructionParser = new InstructionParser(getActionManager());
- for (int i = 0; i < instructions.length; i++) {
- actions.addAll(Arrays.asList(instructionParser.parseActions(instructions[i], unit.getTouchpointType())));
+ for (int i = 0; i < instrSize; i++) {
+ actions.addAll(instructionParser.parseActions(instructions.get(i), unit.getTouchpointType()));
}
- return (ProvisioningAction[]) actions.toArray(new ProvisioningAction[actions.size()]);
+ return actions;
}
- private final static ITouchpointInstruction[] getInstructions(IInstallableUnit unit, String key) {
- ITouchpointData[] data = unit.getTouchpointData();
- if (data == null)
- return null;
+ private final static List<ITouchpointInstruction> getInstructions(IInstallableUnit unit, String key) {
+ List<ITouchpointData> data = unit.getTouchpointData();
+ int dataSize = data.size();
+ if (dataSize == 0)
+ return CollectionUtils.emptyList();
- ArrayList matches = new ArrayList(data.length);
- for (int i = 0; i < data.length; i++) {
- ITouchpointInstruction instructions = data[i].getInstruction(key);
+ ArrayList<ITouchpointInstruction> matches = new ArrayList<ITouchpointInstruction>(dataSize);
+ for (int i = 0; i < dataSize; i++) {
+ ITouchpointInstruction instructions = data.get(i).getInstruction(key);
if (instructions != null)
matches.add(instructions);
}
-
- ITouchpointInstruction[] result = (ITouchpointInstruction[]) matches.toArray(new ITouchpointInstruction[matches.size()]);
- return result;
+ return matches;
}
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/InstructionParser.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/InstructionParser.java
index e9967b1ca..ed5a93c57 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/InstructionParser.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/InstructionParser.java
@@ -12,6 +12,7 @@ package org.eclipse.equinox.internal.p2.engine;
import java.util.*;
import org.eclipse.core.runtime.Assert;
+import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils;
import org.eclipse.equinox.internal.provisional.p2.metadata.*;
import org.eclipse.equinox.p2.engine.MissingAction;
import org.eclipse.equinox.p2.engine.spi.ProvisioningAction;
@@ -38,22 +39,21 @@ public class InstructionParser {
this.actionManager = actionManager;
}
- public ProvisioningAction[] parseActions(ITouchpointInstruction instruction, ITouchpointType touchpointType) {
- List actions = new ArrayList();
- Map importMap = parseImportAttribute(instruction.getImportAttribute());
+ public List<ProvisioningAction> parseActions(ITouchpointInstruction instruction, ITouchpointType touchpointType) {
+ List<ProvisioningAction> actions = new ArrayList<ProvisioningAction>();
+ Map<String, ActionEntry> importMap = parseImportAttribute(instruction.getImportAttribute());
StringTokenizer tokenizer = new StringTokenizer(instruction.getBody(), ";"); //$NON-NLS-1$
while (tokenizer.hasMoreTokens()) {
actions.add(parseAction(tokenizer.nextToken(), importMap, touchpointType));
}
-
- return (ProvisioningAction[]) actions.toArray(new ProvisioningAction[actions.size()]);
+ return actions;
}
- private Map parseImportAttribute(String importAttribute) {
+ private Map<String, ActionEntry> parseImportAttribute(String importAttribute) {
if (importAttribute == null)
- return Collections.EMPTY_MAP;
+ return CollectionUtils.emptyMap();
- Map result = new HashMap();
+ Map<String, ActionEntry> result = new HashMap<String, ActionEntry>();
StringTokenizer tokenizer = new StringTokenizer(importAttribute, ","); //$NON-NLS-1$
while (tokenizer.hasMoreTokens()) {
StringTokenizer actionTokenizer = new StringTokenizer(tokenizer.nextToken(), ";"); //$NON-NLS-1$
@@ -72,7 +72,7 @@ public class InstructionParser {
return result;
}
- private ProvisioningAction parseAction(String statement, Map qualifier, ITouchpointType touchpointType) {
+ private ProvisioningAction parseAction(String statement, Map<String, ActionEntry> qualifier, ITouchpointType touchpointType) {
int openBracket = statement.indexOf('(');
int closeBracket = statement.lastIndexOf(')');
if (openBracket == -1 || closeBracket == -1 || openBracket > closeBracket)
@@ -84,10 +84,10 @@ public class InstructionParser {
String nameValuePairs = statement.substring(openBracket + 1, closeBracket);
if (nameValuePairs.length() == 0)
- return new ParameterizedProvisioningAction(action, Collections.EMPTY_MAP, statement);
+ return new ParameterizedProvisioningAction(action, CollectionUtils.<String, String> emptyMap(), statement);
StringTokenizer tokenizer = new StringTokenizer(nameValuePairs, ","); //$NON-NLS-1$
- Map parameters = new HashMap();
+ Map<String, String> parameters = new HashMap<String, String>();
while (tokenizer.hasMoreTokens()) {
String nameValuePair = tokenizer.nextToken();
int colonIndex = nameValuePair.indexOf(":"); //$NON-NLS-1$
@@ -100,9 +100,9 @@ public class InstructionParser {
return new ParameterizedProvisioningAction(action, parameters, statement);
}
- private ProvisioningAction lookupAction(String actionId, Map importMap, ITouchpointType touchpointType) {
+ private ProvisioningAction lookupAction(String actionId, Map<String, ActionEntry> importMap, ITouchpointType touchpointType) {
VersionRange versionRange = null;
- ActionEntry actionEntry = (ActionEntry) importMap.get(actionId);
+ ActionEntry actionEntry = importMap.get(actionId);
if (actionEntry != null) {
actionId = actionEntry.actionId;
versionRange = actionEntry.versionRange;
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ParameterizedProvisioningAction.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ParameterizedProvisioningAction.java
index 17c82673d..ce4ff7d44 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ParameterizedProvisioningAction.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ParameterizedProvisioningAction.java
@@ -19,10 +19,10 @@ import org.eclipse.equinox.p2.engine.spi.Touchpoint;
public class ParameterizedProvisioningAction extends ProvisioningAction {
private ProvisioningAction action;
- private Map actionParameters;
+ private Map<String, String> actionParameters;
private String actionText;
- public ParameterizedProvisioningAction(ProvisioningAction action, Map actionParameters, String actionText) {
+ public ParameterizedProvisioningAction(ProvisioningAction action, Map<String, String> actionParameters, String actionText) {
if (action == null || actionParameters == null)
throw new IllegalArgumentException(Messages.ParameterizedProvisioningAction_action_or_parameters_null);
this.action = action;
@@ -30,28 +30,28 @@ public class ParameterizedProvisioningAction extends ProvisioningAction {
this.actionText = actionText;
}
- public IStatus execute(Map parameters) {
+ public IStatus execute(Map<String, Object> parameters) {
parameters = processActionParameters(parameters);
return action.execute(parameters);
}
- public IStatus undo(Map parameters) {
+ public IStatus undo(Map<String, Object> parameters) {
parameters = processActionParameters(parameters);
return action.undo(parameters);
}
- private Map processActionParameters(Map parameters) {
- Map result = new HashMap(parameters);
- for (Iterator it = actionParameters.entrySet().iterator(); it.hasNext();) {
- Entry entry = (Entry) it.next();
- String name = (String) entry.getKey();
- String value = processVariables((String) entry.getValue(), parameters);
+ private Map<String, Object> processActionParameters(Map<String, Object> parameters) {
+ Map<String, Object> result = new HashMap<String, Object>(parameters);
+ for (Iterator<Entry<String, String>> it = actionParameters.entrySet().iterator(); it.hasNext();) {
+ Entry<String, String> entry = it.next();
+ String name = entry.getKey();
+ String value = processVariables(entry.getValue(), parameters);
result.put(name, value);
}
return Collections.unmodifiableMap(result);
}
- private String processVariables(String parameterValue, Map parameters) {
+ private String processVariables(String parameterValue, Map<String, Object> parameters) {
int variableBeginIndex = parameterValue.indexOf("${"); //$NON-NLS-1$
if (variableBeginIndex == -1)
@@ -85,7 +85,7 @@ public class ParameterizedProvisioningAction extends ProvisioningAction {
return action;
}
- public Map getParameters() {
+ public Map<String, String> getParameters() {
return actionParameters;
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Phase.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Phase.java
index 6bc0ead21..ca6f56587 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Phase.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Phase.java
@@ -38,10 +38,10 @@ public abstract class Phase {
protected int prePerformWork = 1000;
protected int mainPerformWork = 10000;
protected int postPerformWork = 1000;
- private Map operandParameters = null;
- private Map phaseParameters = new HashMap();
- private Map touchpointToTouchpointPhaseParameters = new HashMap();
- private Map touchpointToTouchpointOperandParameters = new HashMap();
+ private Map<String, Object> operandParameters = null;
+ private Map<String, Object> phaseParameters = new HashMap<String, Object>();
+ private Map<Touchpoint, Map<String, Object>> touchpointToTouchpointPhaseParameters = new HashMap<Touchpoint, Map<String, Object>>();
+ private Map<Touchpoint, Map<String, Object>> touchpointToTouchpointOperandParameters = new HashMap<Touchpoint, Map<String, Object>>();
ActionManager actionManager; // injected from phaseset
protected Phase(String phaseId, int weight, boolean forced) {
@@ -112,8 +112,8 @@ public abstract class Phase {
continue;
session.recordOperandStart(operand);
- ProvisioningAction[] actions = getActions(operand);
- operandParameters = new HashMap(phaseParameters);
+ List<ProvisioningAction> actions = getActions(operand);
+ operandParameters = new HashMap<String, Object>(phaseParameters);
operandParameters.put(PARM_OPERAND, operand);
mergeStatus(status, initializeOperand(profile, operand, operandParameters, subMonitor));
if (status.matches(IStatus.ERROR | IStatus.CANCEL)) {
@@ -127,21 +127,21 @@ public abstract class Phase {
if (status.matches(IStatus.ERROR | IStatus.CANCEL))
return;
- operandParameters = (Map) touchpointToTouchpointOperandParameters.get(operandTouchpoint);
+ operandParameters = touchpointToTouchpointOperandParameters.get(operandTouchpoint);
}
operandParameters = Collections.unmodifiableMap(operandParameters);
if (actions != null) {
- for (int j = 0; j < actions.length; j++) {
- ProvisioningAction action = actions[j];
- Map parameters = operandParameters;
+ for (int j = 0; j < actions.size(); j++) {
+ ProvisioningAction action = actions.get(j);
+ Map<String, Object> parameters = operandParameters;
Touchpoint touchpoint = action.getTouchpoint();
if (touchpoint != null) {
mergeStatus(status, initializeTouchpointParameters(profile, operand, touchpoint, subMonitor));
if (status.matches(IStatus.ERROR | IStatus.CANCEL))
return;
- parameters = (Map) touchpointToTouchpointOperandParameters.get(touchpoint);
+ parameters = touchpointToTouchpointOperandParameters.get(touchpoint);
}
IStatus actionStatus = null;
try {
@@ -184,16 +184,16 @@ public abstract class Phase {
if (touchpointToTouchpointOperandParameters.containsKey(touchpoint))
return Status.OK_STATUS;
- Map touchpointPhaseParameters = (Map) touchpointToTouchpointPhaseParameters.get(touchpoint);
+ Map<String, Object> touchpointPhaseParameters = touchpointToTouchpointPhaseParameters.get(touchpoint);
if (touchpointPhaseParameters == null) {
- touchpointPhaseParameters = new HashMap(phaseParameters);
+ touchpointPhaseParameters = new HashMap<String, Object>(phaseParameters);
IStatus status = touchpoint.initializePhase(monitor, profile, phaseId, touchpointPhaseParameters);
if (status != null && status.matches(IStatus.ERROR | IStatus.CANCEL))
return status;
touchpointToTouchpointPhaseParameters.put(touchpoint, touchpointPhaseParameters);
}
- Map touchpointOperandParameters = new HashMap(touchpointPhaseParameters);
+ Map<String, Object> touchpointOperandParameters = new HashMap<String, Object>(touchpointPhaseParameters);
touchpointOperandParameters.putAll(operandParameters);
IStatus status = touchpoint.initializeOperand(profile, operand, touchpointOperandParameters);
if (status != null && status.matches(IStatus.ERROR | IStatus.CANCEL))
@@ -218,7 +218,7 @@ public abstract class Phase {
void undo(MultiStatus status, EngineSession session, IProfile profile, Operand operand, ProvisioningAction[] actions, ProvisioningContext context) {
if (operandParameters == null) {
- operandParameters = new HashMap(phaseParameters);
+ operandParameters = new HashMap<String, Object>(phaseParameters);
operandParameters.put(PARM_OPERAND, operand);
mergeStatus(status, initializeOperand(profile, operand, operandParameters, new NullProgressMonitor()));
Touchpoint operandTouchpoint = (Touchpoint) operandParameters.get(PARM_TOUCHPOINT);
@@ -227,20 +227,20 @@ public abstract class Phase {
if (status.matches(IStatus.ERROR | IStatus.CANCEL))
return;
- operandParameters = (Map) touchpointToTouchpointOperandParameters.get(operandTouchpoint);
+ operandParameters = touchpointToTouchpointOperandParameters.get(operandTouchpoint);
}
operandParameters = Collections.unmodifiableMap(operandParameters);
}
for (int j = 0; j < actions.length; j++) {
ProvisioningAction action = actions[j];
- Map parameters = operandParameters;
+ Map<String, Object> parameters = operandParameters;
Touchpoint touchpoint = action.getTouchpoint();
if (touchpoint != null) {
mergeStatus(status, initializeTouchpointParameters(profile, operand, touchpoint, new NullProgressMonitor()));
if (status.matches(IStatus.ERROR))
return;
- parameters = (Map) touchpointToTouchpointOperandParameters.get(touchpoint);
+ parameters = touchpointToTouchpointOperandParameters.get(touchpoint);
}
IStatus actionStatus = null;
try {
@@ -269,53 +269,53 @@ public abstract class Phase {
return true;
}
- protected IStatus initializePhase(IProgressMonitor monitor, IProfile profile, Map parameters) {
+ protected IStatus initializePhase(IProgressMonitor monitor, IProfile profile, Map<String, Object> parameters) {
return Status.OK_STATUS;
}
- protected IStatus completePhase(IProgressMonitor monitor, IProfile profile, Map parameters) {
+ protected IStatus completePhase(IProgressMonitor monitor, IProfile profile, Map<String, Object> parameters) {
return Status.OK_STATUS;
}
- IStatus touchpointCompletePhase(IProgressMonitor monitor, IProfile profile, Map parameters) {
+ IStatus touchpointCompletePhase(IProgressMonitor monitor, IProfile profile, Map<String, Object> parameters) {
if (touchpointToTouchpointPhaseParameters.isEmpty())
return Status.OK_STATUS;
MultiStatus status = new MultiStatus(EngineActivator.ID, IStatus.OK, null, null);
- for (Iterator it = touchpointToTouchpointPhaseParameters.entrySet().iterator(); it.hasNext();) {
- Entry entry = (Entry) it.next();
- Touchpoint touchpoint = (Touchpoint) entry.getKey();
- Map touchpointParameters = (Map) entry.getValue();
+ for (Iterator<Entry<Touchpoint, Map<String, Object>>> it = touchpointToTouchpointPhaseParameters.entrySet().iterator(); it.hasNext();) {
+ Entry<Touchpoint, Map<String, Object>> entry = it.next();
+ Touchpoint touchpoint = entry.getKey();
+ Map<String, Object> touchpointParameters = entry.getValue();
mergeStatus(status, touchpoint.completePhase(monitor, profile, phaseId, touchpointParameters));
}
touchpointToTouchpointPhaseParameters.clear();
return status;
}
- protected IStatus completeOperand(IProfile profile, Operand operand, Map parameters, IProgressMonitor monitor) {
+ protected IStatus completeOperand(IProfile profile, Operand operand, Map<String, Object> parameters, IProgressMonitor monitor) {
return Status.OK_STATUS;
}
- IStatus touchpointCompleteOperand(IProfile profile, Operand operand, Map parameters, IProgressMonitor monitor) {
+ IStatus touchpointCompleteOperand(IProfile profile, Operand operand, Map<String, Object> parameters, IProgressMonitor monitor) {
if (touchpointToTouchpointOperandParameters.isEmpty())
return Status.OK_STATUS;
MultiStatus status = new MultiStatus(EngineActivator.ID, IStatus.OK, null, null);
- for (Iterator it = touchpointToTouchpointOperandParameters.entrySet().iterator(); it.hasNext();) {
- Entry entry = (Entry) it.next();
- Touchpoint touchpoint = (Touchpoint) entry.getKey();
- Map touchpointParameters = (Map) entry.getValue();
+ for (Iterator<Entry<Touchpoint, Map<String, Object>>> it = touchpointToTouchpointOperandParameters.entrySet().iterator(); it.hasNext();) {
+ Entry<Touchpoint, Map<String, Object>> entry = it.next();
+ Touchpoint touchpoint = entry.getKey();
+ Map<String, Object> touchpointParameters = entry.getValue();
mergeStatus(status, touchpoint.completeOperand(profile, operand, touchpointParameters));
}
touchpointToTouchpointOperandParameters.clear();
return status;
}
- protected IStatus initializeOperand(IProfile profile, Operand operand, Map parameters, IProgressMonitor monitor) {
+ protected IStatus initializeOperand(IProfile profile, Operand operand, Map<String, Object> parameters, IProgressMonitor monitor) {
return Status.OK_STATUS;
}
- protected abstract ProvisioningAction[] getActions(Operand operand);
+ protected abstract List<ProvisioningAction> getActions(Operand operand);
/**
* Returns a human-readable message to be displayed in case of an error performing
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/PhaseSet.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/PhaseSet.java
index cb836c2c4..e215cc820 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/PhaseSet.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/PhaseSet.java
@@ -19,24 +19,24 @@ import org.eclipse.osgi.util.NLS;
public class PhaseSet implements IPhaseSet {
- public static final List DEFAULT_PHASES = Arrays.asList(new String[] {IPhaseSet.PHASE_COLLECT, IPhaseSet.PHASE_UNCONFIGURE, IPhaseSet.PHASE_UNINSTALL, IPhaseSet.PHASE_PROPERTY, IPhaseSet.PHASE_CHECK_TRUST, IPhaseSet.PHASE_INSTALL, IPhaseSet.PHASE_CONFIGURE});
+ public static final List<String> DEFAULT_PHASES = Arrays.asList(new String[] {IPhaseSet.PHASE_COLLECT, IPhaseSet.PHASE_UNCONFIGURE, IPhaseSet.PHASE_UNINSTALL, IPhaseSet.PHASE_PROPERTY, IPhaseSet.PHASE_CHECK_TRUST, IPhaseSet.PHASE_INSTALL, IPhaseSet.PHASE_CONFIGURE});
public static final boolean forcedUninstall = Boolean.valueOf(EngineActivator.getContext().getProperty("org.eclipse.equinox.p2.engine.forcedUninstall")).booleanValue(); //$NON-NLS-1$
private final Phase[] phases;
public static IPhaseSet createPhaseSetExcluding(String[] excludes) {
- ArrayList phases = new ArrayList(DEFAULT_PHASES);
+ ArrayList<String> phases = new ArrayList<String>(DEFAULT_PHASES);
if (excludes != null) {
for (int i = 0; i < excludes.length; i++) {
phases.remove(excludes[i]);
}
}
- return createPhaseSetIncluding((String[]) phases.toArray(new String[phases.size()]));
+ return createPhaseSetIncluding(phases.toArray(new String[phases.size()]));
}
public static IPhaseSet createPhaseSetIncluding(String[] includes) {
- ArrayList phases = new ArrayList();
+ ArrayList<Phase> phases = new ArrayList<Phase>();
for (int i = 0; i < includes.length; i++) {
String current = includes[i];
if (current.equals(IPhaseSet.PHASE_CONFIGURE))
@@ -54,7 +54,7 @@ public class PhaseSet implements IPhaseSet {
else if (current.equals(IPhaseSet.PHASE_UNINSTALL))
phases.add(new Uninstall(50, forcedUninstall));
}
- return new PhaseSet((Phase[]) phases.toArray(new Phase[phases.size()]));
+ return new PhaseSet(phases.toArray(new Phase[phases.size()]));
}
public PhaseSet(Phase[] phases) {
@@ -110,7 +110,7 @@ public class PhaseSet implements IPhaseSet {
}
public final IStatus validate(ActionManager actionManager, IProfile profile, Operand[] operands, ProvisioningContext context, IProgressMonitor monitor) {
- Set missingActions = new HashSet();
+ Set<MissingAction> missingActions = new HashSet<MissingAction>();
for (int i = 0; i < phases.length; i++) {
Phase phase = phases[i];
phase.actionManager = actionManager;
@@ -121,13 +121,13 @@ public class PhaseSet implements IPhaseSet {
if (!phase.isApplicable(operand))
continue;
- ProvisioningAction[] actions = phase.getActions(operand);
+ List<ProvisioningAction> actions = phase.getActions(operand);
if (actions == null)
continue;
- for (int k = 0; k < actions.length; k++) {
- ProvisioningAction action = actions[k];
+ for (int k = 0; k < actions.size(); k++) {
+ ProvisioningAction action = actions.get(k);
if (action instanceof MissingAction)
- missingActions.add(action);
+ missingActions.add((MissingAction) action);
}
} catch (RuntimeException e) {
// "perform" calls user code and might throw an unchecked exception
@@ -143,7 +143,7 @@ public class PhaseSet implements IPhaseSet {
}
}
if (!missingActions.isEmpty()) {
- MissingAction[] missingActionsArray = (MissingAction[]) missingActions.toArray(new MissingAction[missingActions.size()]);
+ MissingAction[] missingActionsArray = missingActions.toArray(new MissingAction[missingActions.size()]);
MissingActionsException exception = new MissingActionsException(missingActionsArray);
return (new Status(IStatus.ERROR, EngineActivator.ID, exception.getMessage(), exception));
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Profile.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Profile.java
index 276b89acd..60486f67e 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Profile.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Profile.java
@@ -12,9 +12,9 @@ import java.util.*;
import java.util.Map.Entry;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils;
import org.eclipse.equinox.internal.p2.core.helpers.OrderedProperties;
import org.eclipse.equinox.internal.provisional.p2.metadata.query.ICompositeQuery;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.IQueryable;
import org.eclipse.equinox.p2.engine.IProfile;
import org.eclipse.equinox.p2.engine.ISurrogateProfileHandler;
import org.eclipse.equinox.p2.engine.query.IUProfilePropertyQuery;
@@ -23,7 +23,7 @@ import org.eclipse.equinox.p2.metadata.query.IQuery;
import org.eclipse.equinox.p2.metadata.query.IQueryResult;
import org.eclipse.osgi.util.NLS;
-public class Profile implements IQueryable, IProfile {
+public class Profile implements IProfile {
//Internal id of the profile
private final String profileId;
@@ -33,22 +33,21 @@ public class Profile implements IQueryable, IProfile {
/**
* A collection of child profiles.
*/
- private List subProfileIds; // child profile ids
+ private List<String> subProfileIds; // child profile ids
- private static final String[] noSubProfiles = new String[0];
/**
* This storage is to be used by the touchpoints to store data.
*/
private OrderedProperties storage = new OrderedProperties();
- private Set ius = new HashSet();
- private Map iuProperties = new HashMap();
+ private Set<IInstallableUnit> ius = new HashSet<IInstallableUnit>();
+ private Map<IInstallableUnit, OrderedProperties> iuProperties = new HashMap<IInstallableUnit, OrderedProperties>();
private boolean changed = false;
private long timestamp;
private ISurrogateProfileHandler surrogateProfileHandler;
- public Profile(String profileId, Profile parent, Map properties) {
+ public Profile(String profileId, Profile parent, Map<String, String> properties) {
if (profileId == null || profileId.length() == 0) {
throw new IllegalArgumentException(NLS.bind(Messages.Profile_Null_Profile_Id, null));
}
@@ -97,7 +96,7 @@ public class Profile implements IQueryable, IProfile {
public void addSubProfile(String subProfileId) throws IllegalArgumentException {
if (subProfileIds == null)
- subProfileIds = new ArrayList();
+ subProfileIds = new ArrayList<String>();
if (!subProfileIds.contains(subProfileId))
subProfileIds.add(subProfileId);
@@ -121,11 +120,10 @@ public class Profile implements IQueryable, IProfile {
/* (non-Javadoc)
* @see org.eclipse.equinox.internal.provisional.p2.engine.IProfile#getSubProfileIds()
*/
- public String[] getSubProfileIds() {
+ public List<String> getSubProfileIds() {
if (subProfileIds == null)
- return noSubProfiles;
-
- return (String[]) subProfileIds.toArray(new String[subProfileIds.size()]);
+ return CollectionUtils.emptyList();
+ return Collections.unmodifiableList(subProfileIds);
}
/* (non-Javadoc)
@@ -163,7 +161,7 @@ public class Profile implements IQueryable, IProfile {
/* (non-Javadoc)
* @see org.eclipse.equinox.internal.provisional.p2.engine.IProfile#query(org.eclipse.equinox.internal.provisional.p2.query.Query, org.eclipse.equinox.internal.provisional.p2.query.Collector, org.eclipse.core.runtime.IProgressMonitor)
*/
- public IQueryResult query(IQuery query, IProgressMonitor monitor) {
+ public IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor) {
propagateProfileContext(query);
if (query instanceof IUProfilePropertyQuery) {
return query.perform(iuProperties.keySet().iterator());
@@ -171,24 +169,21 @@ public class Profile implements IQueryable, IProfile {
return query.perform(ius.iterator());
}
- private void propagateProfileContext(IQuery query) {
+ private <T> void propagateProfileContext(IQuery<T> query) {
// FIXME
if (query instanceof IUProfilePropertyQuery) {
((IUProfilePropertyQuery) query).setProfile(this);
return;
}
- IQuery[] queries = null;
- if (query instanceof ICompositeQuery) {
- queries = ((ICompositeQuery) query).getQueries();
- }
- if (queries != null) {
- for (int i = 0; i < queries.length; i++) {
- propagateProfileContext(queries[i]);
+ if (query instanceof ICompositeQuery<?>) {
+ List<IQuery<T>> queries = ((ICompositeQuery<T>) query).getQueries();
+ for (int i = 0; i < queries.size(); i++) {
+ propagateProfileContext(queries.get(i));
}
}
}
- public IQueryResult available(IQuery query, IProgressMonitor monitor) {
+ public IQueryResult<IInstallableUnit> available(IQuery<IInstallableUnit> query, IProgressMonitor monitor) {
if (surrogateProfileHandler != null)
return surrogateProfileHandler.queryProfile(this, query, monitor);
return query(query, new NullProgressMonitor());
@@ -198,7 +193,7 @@ public class Profile implements IQueryable, IProfile {
* @see org.eclipse.equinox.internal.provisional.p2.engine.IProfile#getInstallableUnitProperty(org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit, java.lang.String)
*/
public String getInstallableUnitProperty(IInstallableUnit iu, String key) {
- OrderedProperties properties = (OrderedProperties) iuProperties.get(iu);
+ OrderedProperties properties = iuProperties.get(iu);
if (properties == null)
return null;
@@ -207,7 +202,7 @@ public class Profile implements IQueryable, IProfile {
public String setInstallableUnitProperty(IInstallableUnit iu, String key, String value) {
// String iuKey = createIUKey(iu);
- OrderedProperties properties = (OrderedProperties) iuProperties.get(iu);
+ OrderedProperties properties = iuProperties.get(iu);
if (properties == null) {
properties = new OrderedProperties();
iuProperties.put(iu, properties);
@@ -219,11 +214,11 @@ public class Profile implements IQueryable, IProfile {
public String removeInstallableUnitProperty(IInstallableUnit iu, String key) {
// String iuKey = createIUKey(iu);
- OrderedProperties properties = (OrderedProperties) iuProperties.get(iu);
+ OrderedProperties properties = iuProperties.get(iu);
if (properties == null)
return null;
- String oldValue = (String) properties.remove(key);
+ String oldValue = properties.remove(key);
if (properties.isEmpty())
iuProperties.remove(iu);
@@ -238,18 +233,18 @@ public class Profile implements IQueryable, IProfile {
/* (non-Javadoc)
* @see org.eclipse.equinox.internal.provisional.p2.engine.IProfile#getLocalProperties()
*/
- public Map getLocalProperties() {
+ public Map<String, String> getLocalProperties() {
return OrderedProperties.unmodifiableProperties(storage);
}
/* (non-Javadoc)
* @see org.eclipse.equinox.internal.provisional.p2.engine.IProfile#getProperties()
*/
- public Map getProperties() {
+ public Map<String, String> getProperties() {
if (parentProfile == null)
return getLocalProperties();
- Map properties = new HashMap(parentProfile.getProperties());
+ Map<String, String> properties = new HashMap<String, String>(parentProfile.getProperties());
properties.putAll(storage);
return OrderedProperties.unmodifiableProperties(properties);
}
@@ -258,7 +253,7 @@ public class Profile implements IQueryable, IProfile {
* Add all the properties in the map to the local properties
* of the profile.
*/
- public void addProperties(Map properties) {
+ public void addProperties(Map<String, String> properties) {
storage.putAll(properties);
changed = true;
}
@@ -281,8 +276,8 @@ public class Profile implements IQueryable, IProfile {
/* (non-Javadoc)
* @see org.eclipse.equinox.internal.provisional.p2.engine.IProfile#getInstallableUnitProperties(org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit)
*/
- public Map getInstallableUnitProperties(IInstallableUnit iu) {
- OrderedProperties properties = (OrderedProperties) iuProperties.get(iu);
+ public Map<String, String> getInstallableUnitProperties(IInstallableUnit iu) {
+ OrderedProperties properties = iuProperties.get(iu);
if (properties == null)
properties = new OrderedProperties();
@@ -319,16 +314,16 @@ public class Profile implements IQueryable, IProfile {
snapshot.setTimestamp(timestamp);
if (subProfileIds != null) {
- for (Iterator it = subProfileIds.iterator(); it.hasNext();) {
- String subProfileId = (String) it.next();
+ for (Iterator<String> it = subProfileIds.iterator(); it.hasNext();) {
+ String subProfileId = it.next();
snapshot.addSubProfile(subProfileId);
}
}
- for (Iterator it = ius.iterator(); it.hasNext();) {
- IInstallableUnit iu = (IInstallableUnit) it.next();
+ for (Iterator<IInstallableUnit> it = ius.iterator(); it.hasNext();) {
+ IInstallableUnit iu = it.next();
snapshot.addInstallableUnit(iu);
- Map properties = getInstallableUnitProperties(iu);
+ Map<String, String> properties = getInstallableUnitProperties(iu);
if (properties != null)
snapshot.addInstallableUnitProperties(iu, properties);
}
@@ -336,12 +331,10 @@ public class Profile implements IQueryable, IProfile {
return snapshot;
}
- public void addInstallableUnitProperties(IInstallableUnit iu, Map properties) {
- for (Iterator it = properties.entrySet().iterator(); it.hasNext();) {
- Entry entry = (Entry) it.next();
- String key = (String) entry.getKey();
- String value = (String) entry.getValue();
- setInstallableUnitProperty(iu, key, value);
+ public void addInstallableUnitProperties(IInstallableUnit iu, Map<String, String> properties) {
+ for (Iterator<Entry<String, String>> it = properties.entrySet().iterator(); it.hasNext();) {
+ Entry<String, String> entry = it.next();
+ setInstallableUnitProperty(iu, entry.getKey(), entry.getValue());
}
}
@@ -351,16 +344,16 @@ public class Profile implements IQueryable, IProfile {
}
public void clearOrphanedInstallableUnitProperties() {
- Set keys = iuProperties.keySet();
+ Set<IInstallableUnit> keys = iuProperties.keySet();
// Set orphans = new HashSet();
- Collection toRemove = new ArrayList();
- for (Iterator iterator = keys.iterator(); iterator.hasNext();) {
- Object iu = iterator.next();
+ Collection<IInstallableUnit> toRemove = new ArrayList<IInstallableUnit>();
+ for (Iterator<IInstallableUnit> iterator = keys.iterator(); iterator.hasNext();) {
+ IInstallableUnit iu = iterator.next();
if (!ius.contains(iu))
toRemove.add(iu);
}
- for (Iterator iterator = toRemove.iterator(); iterator.hasNext();) {
+ for (Iterator<IInstallableUnit> iterator = toRemove.iterator(); iterator.hasNext();) {
iuProperties.remove(iterator.next());
}
// List iuKeys = new ArrayList();
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileMetadataRepository.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileMetadataRepository.java
index 71c5189a6..c9481ef6b 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileMetadataRepository.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileMetadataRepository.java
@@ -23,6 +23,7 @@ import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEv
import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryEvent;
import org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository.AbstractMetadataRepository;
import org.eclipse.equinox.p2.engine.IProfile;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.query.IQuery;
import org.eclipse.equinox.p2.metadata.query.IQueryResult;
import org.eclipse.equinox.p2.repository.IRepository;
@@ -50,19 +51,19 @@ public class ProfileMetadataRepository extends AbstractMetadataRepository {
}
private void publishArtifactRepos() {
- List artifactRepos = findArtifactRepos();
+ List<URI> artifactRepos = findArtifactRepos();
IProvisioningEventBus bus = (IProvisioningEventBus) ServiceHelper.getService(EngineActivator.getContext(), IProvisioningEventBus.SERVICE_NAME);
if (bus == null)
return;
- for (Iterator it = artifactRepos.iterator(); it.hasNext();) {
- URI repo = (URI) it.next();
+ for (Iterator<URI> it = artifactRepos.iterator(); it.hasNext();) {
+ URI repo = it.next();
bus.publishEvent(new RepositoryEvent(repo, IRepository.TYPE_ARTIFACT, RepositoryEvent.DISCOVERED, true));
}
}
- private List findArtifactRepos() {
- List artifactRepos = new ArrayList();
+ private List<URI> findArtifactRepos() {
+ List<URI> artifactRepos = new ArrayList<URI>();
File p2Directory = findP2Directory();
// Add the profile registry's default agent artifact repository.
@@ -155,7 +156,7 @@ public class ProfileMetadataRepository extends AbstractMetadataRepository {
// nothing to do
}
- public IQueryResult query(IQuery query, IProgressMonitor monitor) {
+ public IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor) {
return profile.query(query, monitor);
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileMetadataRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileMetadataRepositoryFactory.java
index ba3798e90..1e152f3c4 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileMetadataRepositoryFactory.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileMetadataRepositoryFactory.java
@@ -24,7 +24,7 @@ public class ProfileMetadataRepositoryFactory extends MetadataRepositoryFactory
* @throws ProvisionException
* documenting to avoid warning
*/
- public IMetadataRepository create(URI location, String name, String type, Map properties) throws ProvisionException {
+ public IMetadataRepository create(URI location, String name, String type, Map<String, String> properties) throws ProvisionException {
return null;
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileParser.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileParser.java
index e9db68466..d78409ae0 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileParser.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileParser.java
@@ -96,7 +96,7 @@ public abstract class ProfileParser extends MetadataParser implements ProfileXML
return 0;
}
- public Map getProperties() {
+ public Map<String, String> getProperties() {
if (propertiesHandler == null)
return null;
return propertiesHandler.getProperties();
@@ -108,16 +108,16 @@ public abstract class ProfileParser extends MetadataParser implements ProfileXML
return unitsHandler.getUnits();
}
- public Map getIUProperties(IInstallableUnit iu) {
+ public Map<String, String> getIUProperties(IInstallableUnit iu) {
if (iusPropertiesHandler == null)
return null;
- Map iusPropertiesMap = iusPropertiesHandler.getIUsPropertiesMap();
+ Map<String, Map<String, String>> iusPropertiesMap = iusPropertiesHandler.getIUsPropertiesMap();
if (iusPropertiesMap == null)
return null;
String iuIdentity = iu.getId() + "_" + iu.getVersion().toString(); //$NON-NLS-1$
- return (Map) iusPropertiesMap.get(iuIdentity);
+ return iusPropertiesMap.get(iuIdentity);
}
}
@@ -126,10 +126,10 @@ public abstract class ProfileParser extends MetadataParser implements ProfileXML
private final String[] required = new String[] {ID_ATTRIBUTE, VERSION_ATTRIBUTE};
private String iuIdentity;
- private Map iusPropertiesMap;
+ private Map<String, Map<String, String>> iusPropertiesMap;
private PropertiesHandler propertiesHandler;
- public IUPropertiesHandler(AbstractHandler parentHandler, Attributes attributes, Map iusPropertiesMap) {
+ public IUPropertiesHandler(AbstractHandler parentHandler, Attributes attributes, Map<String, Map<String, String>> iusPropertiesMap) {
super(parentHandler, IU_PROPERTIES_ELEMENT);
this.iusPropertiesMap = iusPropertiesMap;
@@ -156,15 +156,16 @@ public abstract class ProfileParser extends MetadataParser implements ProfileXML
protected class IUsPropertiesHandler extends AbstractHandler {
- private Map iusPropertiesMap;
+ private Map<String, Map<String, String>> iusPropertiesMap;
public IUsPropertiesHandler(AbstractHandler parentHandler, Attributes attributes) {
super(parentHandler, IUS_PROPERTIES_ELEMENT);
- String size = parseOptionalAttribute(attributes, COLLECTION_SIZE_ATTRIBUTE);
- iusPropertiesMap = (size != null ? new LinkedHashMap(new Integer(size).intValue()) : new LinkedHashMap(4));
+ String sizeStr = parseOptionalAttribute(attributes, COLLECTION_SIZE_ATTRIBUTE);
+ int size = (sizeStr != null ? new Integer(sizeStr).intValue() : 4);
+ iusPropertiesMap = new LinkedHashMap<String, Map<String, String>>(size);
}
- public Map getIUsPropertiesMap() {
+ public Map<String, Map<String, String>> getIUsPropertiesMap() {
return iusPropertiesMap;
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfilePreferences.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfilePreferences.java
index 2255ca0d8..362f9f289 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfilePreferences.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfilePreferences.java
@@ -51,7 +51,7 @@ public class ProfilePreferences extends EclipsePreferences {
}
// cache which nodes have been loaded from disk
- private static Set loadedNodes = Collections.synchronizedSet(new HashSet());
+ private static Set<String> loadedNodes = Collections.synchronizedSet(new HashSet<String>());
public static final Object PROFILE_SAVE_JOB_FAMILY = new Object();
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileWriter.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileWriter.java
index 85eb289fd..44d646ecf 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileWriter.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileWriter.java
@@ -29,11 +29,9 @@ public class ProfileWriter extends MetadataWriter implements ProfileXMLConstants
attribute(ID_ATTRIBUTE, profile.getProfileId());
attribute(TIMESTAMP_ATTRIBUTE, Long.toString(profile.getTimestamp()));
writeProperties(profile.getProperties());
- ArrayList ius = new ArrayList(profile.query(InstallableUnitQuery.ANY, null).unmodifiableSet());
- Collections.sort(ius, new Comparator() {
- public int compare(Object o1, Object o2) {
- IInstallableUnit iu1 = (IInstallableUnit) o1;
- IInstallableUnit iu2 = (IInstallableUnit) o2;
+ ArrayList<IInstallableUnit> ius = new ArrayList<IInstallableUnit>(profile.query(InstallableUnitQuery.ANY, null).unmodifiableSet());
+ Collections.sort(ius, new Comparator<IInstallableUnit>() {
+ public int compare(IInstallableUnit iu1, IInstallableUnit iu2) {
int IdCompare = iu1.getId().compareTo(iu2.getId());
if (IdCompare != 0)
return IdCompare;
@@ -47,14 +45,14 @@ public class ProfileWriter extends MetadataWriter implements ProfileXMLConstants
flush();
}
- private void writeInstallableUnitsProperties(Iterator it, int size, IProfile profile) {
+ private void writeInstallableUnitsProperties(Iterator<IInstallableUnit> it, int size, IProfile profile) {
if (size == 0)
return;
start(IUS_PROPERTIES_ELEMENT);
attribute(COLLECTION_SIZE_ATTRIBUTE, size);
while (it.hasNext()) {
- IInstallableUnit iu = (IInstallableUnit) it.next();
- Map properties = profile.getInstallableUnitProperties(iu);
+ IInstallableUnit iu = it.next();
+ Map<String, String> properties = profile.getInstallableUnitProperties(iu);
if (properties.isEmpty())
continue;
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java
index b99ded205..d2edb719a 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java
@@ -47,8 +47,8 @@ public class SimpleProfileRegistry implements IProfileRegistry {
/**
* Reference to Map of String(Profile id)->Profile.
*/
- private SoftReference profiles;
- private Map profileLocks = new HashMap();
+ private SoftReference<Map<String, Profile>> profiles;
+ private Map<String, ProfileLock> profileLocks = new HashMap<String, ProfileLock>();
private String self;
@@ -107,10 +107,10 @@ public class SimpleProfileRegistry implements IProfileRegistry {
* If the current profile for self is marked as a roaming profile, we need
* to update its install and bundle pool locations.
*/
- private void updateSelfProfile(Map profileMap) {
+ private void updateSelfProfile(Map<String, Profile> profileMap) {
if (profileMap == null)
return;
- Profile selfProfile = (Profile) profileMap.get(self);
+ Profile selfProfile = profileMap.get(self);
if (selfProfile == null)
return;
@@ -190,7 +190,7 @@ public class SimpleProfileRegistry implements IProfileRegistry {
} catch (IOException e) {
LogHelper.log(new Status(IStatus.ERROR, EngineActivator.ID, NLS.bind(Messages.error_parsing_profile, profileFile), e));
}
- return (IProfile) parser.getProfileMap().get(id);
+ return parser.getProfileMap().get(id);
}
public synchronized long[] listProfileTimestamps(String id) {
@@ -227,7 +227,7 @@ public class SimpleProfileRegistry implements IProfileRegistry {
private Profile internalGetProfile(String id) {
if (SELF.equals(id))
id = self;
- Profile profile = (Profile) getProfileMap().get(id);
+ Profile profile = getProfileMap().get(id);
if (profile == null && self != null && self.equals(id))
profile = createSurrogateProfile(id);
@@ -244,15 +244,15 @@ public class SimpleProfileRegistry implements IProfileRegistry {
saveProfile(profile);
resetProfiles();
- return (Profile) getProfileMap().get(id);
+ return getProfileMap().get(id);
}
public synchronized IProfile[] getProfiles() {
- Map profileMap = getProfileMap();
+ Map<String, Profile> profileMap = getProfileMap();
Profile[] result = new Profile[profileMap.size()];
int i = 0;
- for (Iterator it = profileMap.values().iterator(); it.hasNext(); i++) {
- Profile profile = (Profile) it.next();
+ for (Iterator<Profile> it = profileMap.values().iterator(); it.hasNext(); i++) {
+ Profile profile = it.next();
result[i] = profile.snapshot();
}
return result;
@@ -261,16 +261,16 @@ public class SimpleProfileRegistry implements IProfileRegistry {
/**
* Returns an initialized map of String(Profile id)->Profile.
*/
- protected Map getProfileMap() {
+ protected Map<String, Profile> getProfileMap() {
if (profiles != null) {
- Map result = (Map) profiles.get();
+ Map<String, Profile> result = profiles.get();
if (result != null)
return result;
}
- Map result = restore();
+ Map<String, Profile> result = restore();
if (result == null)
- result = new LinkedHashMap(8);
- profiles = new SoftReference(result);
+ result = new LinkedHashMap<String, Profile>(8);
+ profiles = new SoftReference<Map<String, Profile>>(result);
if (updateSelfProfile) {
//update self profile on first load
updateSelfProfile(result);
@@ -284,18 +284,18 @@ public class SimpleProfileRegistry implements IProfileRegistry {
if (current == null)
throw new IllegalArgumentException(NLS.bind(Messages.profile_does_not_exist, id));
- ProfileLock lock = (ProfileLock) profileLocks.get(id);
+ ProfileLock lock = profileLocks.get(id);
lock.checkLocked();
current.clearLocalProperties();
current.clearInstallableUnits();
current.addProperties(profile.getLocalProperties());
- IQueryResult queryResult = profile.query(InstallableUnitQuery.ANY, null);
- for (Iterator queryResultIt = queryResult.iterator(); queryResultIt.hasNext();) {
- IInstallableUnit iu = (IInstallableUnit) queryResultIt.next();
+ IQueryResult<IInstallableUnit> queryResult = profile.query(InstallableUnitQuery.ANY, null);
+ for (Iterator<IInstallableUnit> queryResultIt = queryResult.iterator(); queryResultIt.hasNext();) {
+ IInstallableUnit iu = queryResultIt.next();
current.addInstallableUnit(iu);
- Map iuProperties = profile.getInstallableUnitProperties(iu);
+ Map<String, String> iuProperties = profile.getInstallableUnitProperties(iu);
if (iuProperties != null)
current.addInstallableUnitProperties(iu, iuProperties);
}
@@ -309,14 +309,14 @@ public class SimpleProfileRegistry implements IProfileRegistry {
return addProfile(id, null, null);
}
- public IProfile addProfile(String id, Map profileProperties) throws ProvisionException {
+ public IProfile addProfile(String id, Map<String, String> profileProperties) throws ProvisionException {
return addProfile(id, profileProperties, null);
}
- public synchronized IProfile addProfile(String id, Map profileProperties, String parentId) throws ProvisionException {
+ public synchronized IProfile addProfile(String id, Map<String, String> profileProperties, String parentId) throws ProvisionException {
if (SELF.equals(id))
id = self;
- Map profileMap = getProfileMap();
+ Map<String, Profile> profileMap = getProfileMap();
if (profileMap.get(id) != null)
throw new ProvisionException(NLS.bind(Messages.Profile_Duplicate_Root_Profile_Id, id));
@@ -324,7 +324,7 @@ public class SimpleProfileRegistry implements IProfileRegistry {
if (parentId != null) {
if (SELF.equals(parentId))
parentId = self;
- parent = (Profile) profileMap.get(parentId);
+ parent = profileMap.get(parentId);
if (parent == null)
throw new ProvisionException(NLS.bind(Messages.Profile_Parent_Not_Found, parentId));
}
@@ -342,14 +342,14 @@ public class SimpleProfileRegistry implements IProfileRegistry {
if (SELF.equals(profileId))
profileId = self;
//note we need to maintain a reference to the profile map until it is persisted to prevent gc
- Map profileMap = getProfileMap();
- Profile profile = (Profile) profileMap.get(profileId);
+ Map<String, Profile> profileMap = getProfileMap();
+ Profile profile = profileMap.get(profileId);
if (profile == null)
return;
- String[] subProfileIds = profile.getSubProfileIds();
- for (int i = 0; i < subProfileIds.length; i++) {
- removeProfile(subProfileIds[i]);
+ List<String> subProfileIds = profile.getSubProfileIds();
+ for (int i = 0; i < subProfileIds.size(); i++) {
+ removeProfile(subProfileIds.get(i));
}
internalLockProfile(profile);
// The above call recursively locked the parent(s). So save it away to rewind the locking process.
@@ -401,7 +401,7 @@ public class SimpleProfileRegistry implements IProfileRegistry {
* Restores the profile registry from disk, and returns the loaded profile map.
* Returns <code>null</code> if unable to read the registry.
*/
- private Map restore() {
+ private Map<String, Profile> restore() {
if (store == null || !store.isDirectory())
throw new IllegalStateException(NLS.bind(Messages.reg_dir_not_available, store));
@@ -414,7 +414,7 @@ public class SimpleProfileRegistry implements IProfileRegistry {
for (int i = 0; i < profileDirectories.length; i++) {
String directoryName = profileDirectories[i].getName();
String profileId = unescape(directoryName.substring(0, directoryName.lastIndexOf(PROFILE_EXT)));
- ProfileLock lock = (ProfileLock) profileLocks.get(profileId);
+ ProfileLock lock = profileLocks.get(profileId);
if (lock == null) {
lock = new ProfileLock(this, profileDirectories[i]);
profileLocks.put(profileId, lock);
@@ -588,7 +588,7 @@ public class SimpleProfileRegistry implements IProfileRegistry {
* as written by the Writer class.
*/
class Parser extends ProfileParser {
- private final Map profileHandlers = new HashMap();
+ private final Map<String, ProfileHandler> profileHandlers = new HashMap<String, ProfileHandler>();
public Parser(BundleContext context, String bundleId) {
super(context, bundleId);
@@ -631,26 +631,26 @@ public class SimpleProfileRegistry implements IProfileRegistry {
return this;
}
- public Map getProfileMap() {
- Map profileMap = new HashMap();
- for (Iterator it = profileHandlers.keySet().iterator(); it.hasNext();) {
- String profileId = (String) it.next();
+ public Map<String, Profile> getProfileMap() {
+ Map<String, Profile> profileMap = new HashMap<String, Profile>();
+ for (Iterator<String> it = profileHandlers.keySet().iterator(); it.hasNext();) {
+ String profileId = it.next();
addProfile(profileId, profileMap);
}
return profileMap;
}
- private void addProfile(String profileId, Map profileMap) {
+ private void addProfile(String profileId, Map<String, Profile> profileMap) {
if (profileMap.containsKey(profileId))
return;
- ProfileHandler profileHandler = (ProfileHandler) profileHandlers.get(profileId);
+ ProfileHandler profileHandler = profileHandlers.get(profileId);
Profile parentProfile = null;
String parentId = profileHandler.getParentId();
if (parentId != null) {
addProfile(parentId, profileMap);
- parentProfile = (Profile) profileMap.get(parentId);
+ parentProfile = profileMap.get(parentId);
}
Profile profile = new Profile(profileId, parentProfile, profileHandler.getProperties());
@@ -664,13 +664,11 @@ public class SimpleProfileRegistry implements IProfileRegistry {
for (int i = 0; i < ius.length; i++) {
IInstallableUnit iu = ius[i];
profile.addInstallableUnit(iu);
- Map iuProperties = profileHandler.getIUProperties(iu);
+ Map<String, String> iuProperties = profileHandler.getIUProperties(iu);
if (iuProperties != null) {
- for (Iterator it = iuProperties.entrySet().iterator(); it.hasNext();) {
- Entry entry = (Entry) it.next();
- String key = (String) entry.getKey();
- String value = (String) entry.getValue();
- profile.setInstallableUnitProperty(iu, key, value);
+ for (Iterator<Entry<String, String>> it = iuProperties.entrySet().iterator(); it.hasNext();) {
+ Entry<String, String> entry = it.next();
+ profile.setInstallableUnitProperty(iu, entry.getKey(), entry.getValue());
}
}
}
@@ -750,7 +748,7 @@ public class SimpleProfileRegistry implements IProfileRegistry {
}
private boolean internalLockProfile(IProfile profile) {
- ProfileLock lock = (ProfileLock) profileLocks.get(profile.getProfileId());
+ ProfileLock lock = profileLocks.get(profile.getProfileId());
if (lock == null) {
lock = new ProfileLock(this, new File(store, escape(profile.getProfileId()) + PROFILE_EXT));
profileLocks.put(profile.getProfileId(), lock);
@@ -817,7 +815,7 @@ public class SimpleProfileRegistry implements IProfileRegistry {
}
private void internalUnlockProfile(IProfile profile) {
- ProfileLock lock = (ProfileLock) profileLocks.get(profile.getProfileId());
+ ProfileLock lock = profileLocks.get(profile.getProfileId());
lock.unlock();
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SurrogateProfileHandler.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SurrogateProfileHandler.java
index 9a36c7498..7e17d9990 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SurrogateProfileHandler.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SurrogateProfileHandler.java
@@ -44,22 +44,17 @@ public class SurrogateProfileHandler implements ISurrogateProfileHandler {
private SimpleProfileRegistry profileRegistry;
- private SoftReference cachedProfile;
+ private SoftReference<IProfile> cachedProfile;
private static void addSharedProfileBaseIUs(final IProfile sharedProfile, final Profile userProfile) {
- IQuery rootIUQuery = CompoundQuery.createCompoundQuery(new IQuery[] {new UserVisibleRootQuery(), new MatchQuery() {
- public boolean isMatch(Object candidate) {
- if (candidate instanceof IInstallableUnit) {
- IInstallableUnit iu = (IInstallableUnit) candidate;
- if (iu.getTouchpointType().getId().equals(NATIVE_TOUCHPOINT_TYPE))
- return true;
- }
- return false;
+ IQuery<IInstallableUnit> rootIUQuery = CompoundQuery.createCompoundQuery(new UserVisibleRootQuery(), new MatchQuery<IInstallableUnit>() {
+ public boolean isMatch(IInstallableUnit iu) {
+ return iu.getTouchpointType().getId().equals(NATIVE_TOUCHPOINT_TYPE);
}
- }}, false);
- IQueryResult rootIUs = sharedProfile.query(rootIUQuery, null);
- for (Iterator iterator = rootIUs.iterator(); iterator.hasNext();) {
- IInstallableUnit iu = (IInstallableUnit) iterator.next();
+ }, false);
+ IQueryResult<IInstallableUnit> rootIUs = sharedProfile.query(rootIUQuery, null);
+ for (Iterator<IInstallableUnit> iterator = rootIUs.iterator(); iterator.hasNext();) {
+ IInstallableUnit iu = iterator.next();
userProfile.addInstallableUnit(iu);
userProfile.addInstallableUnitProperties(iu, sharedProfile.getInstallableUnitProperties(iu));
userProfile.setInstallableUnitProperty(iu, IProfile.PROP_PROFILE_LOCKED_IU, IU_LOCKED);
@@ -68,18 +63,18 @@ public class SurrogateProfileHandler implements ISurrogateProfileHandler {
}
private static void removeUserProfileBaseIUs(final Profile userProfile) {
- IQuery rootIUQuery = new IUProfilePropertyQuery(PROP_BASE, Boolean.TRUE.toString());
- IQueryResult rootIUs = userProfile.query(rootIUQuery, null);
- for (Iterator iterator = rootIUs.iterator(); iterator.hasNext();) {
- IInstallableUnit iu = (IInstallableUnit) iterator.next();
+ IQuery<IInstallableUnit> rootIUQuery = new IUProfilePropertyQuery(PROP_BASE, Boolean.TRUE.toString());
+ IQueryResult<IInstallableUnit> rootIUs = userProfile.query(rootIUQuery, null);
+ for (Iterator<IInstallableUnit> iterator = rootIUs.iterator(); iterator.hasNext();) {
+ IInstallableUnit iu = iterator.next();
userProfile.removeInstallableUnit(iu);
}
}
private static void markRootsOptional(final Profile userProfile) {
- IQueryResult rootIUs = userProfile.query(new UserVisibleRootQuery(), null);
- for (Iterator iterator = rootIUs.iterator(); iterator.hasNext();) {
- IInstallableUnit iu = (IInstallableUnit) iterator.next();
+ IQueryResult<IInstallableUnit> rootIUs = userProfile.query(new UserVisibleRootQuery(), null);
+ for (Iterator<IInstallableUnit> iterator = rootIUs.iterator(); iterator.hasNext();) {
+ IInstallableUnit iu = iterator.next();
userProfile.setInstallableUnitProperty(iu, PROP_INCLUSION_RULES, OPTIONAL);
}
}
@@ -140,14 +135,14 @@ public class SurrogateProfileHandler implements ISurrogateProfileHandler {
//see if we have a cached profile
if (cachedProfile != null) {
- IProfile profile = (IProfile) cachedProfile.get();
+ IProfile profile = cachedProfile.get();
if (profile != null && profile.getProfileId().equals(id) && profile.getTimestamp() == currentTimestamp)
return profile;
}
final IProfile profile = registry.getProfile(id, currentTimestamp);
if (profile != null)
- cachedProfile = new SoftReference(profile);
+ cachedProfile = new SoftReference<IProfile>(profile);
return profile;
}
@@ -177,13 +172,13 @@ public class SurrogateProfileHandler implements ISurrogateProfileHandler {
/* (non-Javadoc)
* @see org.eclipse.equinox.internal.p2.engine.ISurrogateProfileHandler#queryProfile(org.eclipse.equinox.internal.provisional.p2.engine.IProfile, org.eclipse.equinox.internal.provisional.p2.query.Query, org.eclipse.equinox.internal.provisional.p2.query.Collector, org.eclipse.core.runtime.IProgressMonitor)
*/
- public IQueryResult queryProfile(IProfile profile, IQuery query, IProgressMonitor monitor) {
+ public IQueryResult<IInstallableUnit> queryProfile(IProfile profile, IQuery<IInstallableUnit> query, IProgressMonitor monitor) {
IProfile sharedProfile = getSharedProfile(profile.getProfileId());
if (sharedProfile == null)
return profile.query(query, monitor);
// TODO: Should consider using a sequenced iterator here instead of collecting
- Collector result = new Collector();
+ Collector<IInstallableUnit> result = new Collector<IInstallableUnit>();
result.addAll(sharedProfile.query(query, monitor));
result.addAll(profile.query(query, monitor));
return result;
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/TouchpointManager.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/TouchpointManager.java
index 7f8dd45f6..896d70e6d 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/TouchpointManager.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/TouchpointManager.java
@@ -89,7 +89,7 @@ public class TouchpointManager implements IRegistryChangeListener {
// 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 Map<String, TouchpointEntry> touchpointEntries;
public TouchpointManager() {
RegistryFactory.getRegistry().addRegistryChangeListener(this, EngineActivator.ID);
@@ -113,7 +113,7 @@ public class TouchpointManager implements IRegistryChangeListener {
if (typeId == null || typeId.length() == 0)
throw new IllegalArgumentException(Messages.TouchpointManager_Null_Touchpoint_Type_Argument);
- TouchpointEntry entry = (TouchpointEntry) getTouchpointEntries().get(typeId);
+ TouchpointEntry entry = getTouchpointEntries().get(typeId);
if (entry == null)
return null;
if (versionRange != null) {
@@ -128,13 +128,13 @@ public class TouchpointManager implements IRegistryChangeListener {
/*
* Construct a map of the extensions that implement the touchpoints extension point.
*/
- private synchronized Map getTouchpointEntries() {
+ private synchronized Map<String, TouchpointEntry> getTouchpointEntries() {
if (touchpointEntries != null)
return touchpointEntries;
IExtensionPoint point = RegistryFactory.getRegistry().getExtensionPoint(EngineActivator.ID, PT_TOUCHPOINTS);
IExtension[] extensions = point.getExtensions();
- touchpointEntries = new HashMap(extensions.length);
+ touchpointEntries = new HashMap<String, TouchpointEntry>(extensions.length);
for (int i = 0; i < extensions.length; i++) {
try {
IConfigurationElement[] elements = extensions[i].getConfigurationElements();
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CertificateChecker.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CertificateChecker.java
index 63fdb2335..8e3ed8f8a 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CertificateChecker.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CertificateChecker.java
@@ -30,7 +30,7 @@ import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
public class CertificateChecker {
- private ArrayList artifacts;
+ private ArrayList<File> artifacts;
private final IProvisioningAgent agent;
public CertificateChecker() {
@@ -39,7 +39,7 @@ public class CertificateChecker {
public CertificateChecker(IProvisioningAgent agent) {
this.agent = agent;
- artifacts = new ArrayList();
+ artifacts = new ArrayList<File>();
}
public IStatus start() {
@@ -60,14 +60,14 @@ public class CertificateChecker {
IServiceUI serviceUI = (IServiceUI) agent.getService(IServiceUI.SERVICE_NAME);
SignedContent content = null;
SignerInfo[] signerInfo = null;
- ArrayList untrusted = new ArrayList();
- ArrayList unsigned = new ArrayList();
- ArrayList untrustedChain = new ArrayList();
+ ArrayList<Certificate> untrusted = new ArrayList<Certificate>();
+ ArrayList<File> unsigned = new ArrayList<File>();
+ ArrayList<Certificate[]> untrustedChain = new ArrayList<Certificate[]>();
IStatus status = Status.OK_STATUS;
if (artifacts.size() == 0 || serviceUI == null)
return status;
- for (Iterator it = artifacts.iterator(); it.hasNext();) {
- File artifact = (File) it.next();
+ for (Iterator<File> it = artifacts.iterator(); it.hasNext();) {
+ File artifact = it.next();
try {
content = verifierFactory.getSignedContent(artifact);
if (!content.isSigned()) {
@@ -116,7 +116,7 @@ public class CertificateChecker {
} else {
unTrustedCertificateChains = new Certificate[untrustedChain.size()][];
for (int i = 0; i < untrustedChain.size(); i++) {
- unTrustedCertificateChains[i] = (Certificate[]) untrustedChain.get(i);
+ unTrustedCertificateChains[i] = untrustedChain.get(i);
}
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CheckTrust.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CheckTrust.java
index b91e95877..b4f5a4451 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CheckTrust.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CheckTrust.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.engine.phases;
+import java.io.File;
import java.util.*;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -37,8 +38,9 @@ public class CheckTrust extends InstallableUnitPhase {
return (op.second() != null);
}
- protected IStatus completePhase(IProgressMonitor monitor, IProfile profile, Map parameters) {
- Collection artifactRequests = (Collection) parameters.get(PARM_ARTIFACT_FILES);
+ protected IStatus completePhase(IProgressMonitor monitor, IProfile profile, Map<String, Object> parameters) {
+ @SuppressWarnings("unchecked")
+ Collection<File> artifactRequests = (Collection<File>) parameters.get(PARM_ARTIFACT_FILES);
IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT);
// Instantiate a check trust manager
@@ -49,9 +51,9 @@ public class CheckTrust extends InstallableUnitPhase {
return status;
}
- protected ProvisioningAction[] getActions(InstallableUnitOperand operand) {
+ protected List<ProvisioningAction> getActions(InstallableUnitOperand operand) {
IInstallableUnit unit = operand.second();
- ProvisioningAction[] parsedActions = getActions(unit, phaseId);
+ List<ProvisioningAction> parsedActions = getActions(unit, phaseId);
if (parsedActions != null)
return parsedActions;
@@ -64,18 +66,18 @@ public class CheckTrust extends InstallableUnitPhase {
if (action == null) {
return null;
}
- return new ProvisioningAction[] {action};
+ return Collections.singletonList(action);
}
- protected IStatus initializeOperand(IProfile profile, InstallableUnitOperand operand, Map parameters, IProgressMonitor monitor) {
+ protected IStatus initializeOperand(IProfile profile, InstallableUnitOperand operand, Map<String, Object> parameters, IProgressMonitor monitor) {
IInstallableUnit iu = operand.second();
parameters.put(PARM_IU, iu);
return super.initializeOperand(profile, operand, parameters, monitor);
}
- protected IStatus initializePhase(IProgressMonitor monitor, IProfile profile, Map parameters) {
- parameters.put(PARM_ARTIFACT_FILES, new ArrayList());
+ protected IStatus initializePhase(IProgressMonitor monitor, IProfile profile, Map<String, Object> parameters) {
+ parameters.put(PARM_ARTIFACT_FILES, new ArrayList<File>());
return super.initializePhase(monitor, profile, parameters);
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Collect.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Collect.java
index 8510b05be..cd40190b1 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Collect.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Collect.java
@@ -42,9 +42,9 @@ public class Collect extends InstallableUnitPhase {
return (op.second() != null && !op.second().equals(op.first()));
}
- protected ProvisioningAction[] getActions(InstallableUnitOperand operand) {
+ protected List<ProvisioningAction> getActions(InstallableUnitOperand operand) {
IInstallableUnit unit = operand.second();
- ProvisioningAction[] parsedActions = getActions(unit, phaseId);
+ List<ProvisioningAction> parsedActions = getActions(unit, phaseId);
if (parsedActions != null)
return parsedActions;
@@ -57,29 +57,30 @@ public class Collect extends InstallableUnitPhase {
if (action == null) {
return null;
}
- return new ProvisioningAction[] {action};
+ return Collections.singletonList(action);
}
protected String getProblemMessage() {
return Messages.Phase_Collect_Error;
}
- protected IStatus completePhase(IProgressMonitor monitor, IProfile profile, Map parameters) {
- List artifactRequests = (List) parameters.get(PARM_ARTIFACT_REQUESTS);
+ protected IStatus completePhase(IProgressMonitor monitor, IProfile profile, Map<String, Object> parameters) {
+ @SuppressWarnings("unchecked")
+ List<IArtifactRequest[]> artifactRequests = (List<IArtifactRequest[]>) parameters.get(PARM_ARTIFACT_REQUESTS);
ProvisioningContext context = (ProvisioningContext) parameters.get(PARM_CONTEXT);
IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT);
IArtifactRepositoryManager repositoryManager = (IArtifactRepositoryManager) agent.getService(IArtifactRepositoryManager.SERVICE_NAME);
DownloadManager dm = new DownloadManager(context, repositoryManager);
- for (Iterator it = artifactRequests.iterator(); it.hasNext();) {
- IArtifactRequest[] requests = (IArtifactRequest[]) it.next();
+ for (Iterator<IArtifactRequest[]> it = artifactRequests.iterator(); it.hasNext();) {
+ IArtifactRequest[] requests = it.next();
dm.add(requests);
}
return dm.start(monitor);
}
- protected IStatus initializePhase(IProgressMonitor monitor, IProfile profile, Map parameters) {
- parameters.put(PARM_ARTIFACT_REQUESTS, new ArrayList());
+ protected IStatus initializePhase(IProgressMonitor monitor, IProfile profile, Map<String, Object> parameters) {
+ parameters.put(PARM_ARTIFACT_REQUESTS, new ArrayList<IArtifactRequest[]>());
return null;
}
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Configure.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Configure.java
index 61122640b..ea1f83a9a 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Configure.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Configure.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.engine.phases;
+import java.util.List;
import java.util.Map;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.engine.InstallableUnitPhase;
@@ -31,7 +32,7 @@ public class Configure extends InstallableUnitPhase {
return (op.second() != null);
}
- protected ProvisioningAction[] getActions(InstallableUnitOperand currentOperand) {
+ protected List<ProvisioningAction> getActions(InstallableUnitOperand currentOperand) {
IInstallableUnit unit = currentOperand.second();
if (FragmentQuery.isFragment(unit))
return null;
@@ -42,14 +43,14 @@ public class Configure extends InstallableUnitPhase {
return Messages.Phase_Configure_Error;
}
- protected IStatus initializeOperand(IProfile profile, InstallableUnitOperand operand, Map parameters, IProgressMonitor monitor) {
+ protected IStatus initializeOperand(IProfile profile, InstallableUnitOperand operand, Map<String, Object> parameters, IProgressMonitor monitor) {
IInstallableUnit iu = operand.second();
monitor.subTask(NLS.bind(Messages.Phase_Configure_Task, iu.getId()));
parameters.put(PARM_IU, iu);
- IArtifactKey[] artifacts = iu.getArtifacts();
- if (artifacts != null && artifacts.length > 0)
- parameters.put(PARM_ARTIFACT, artifacts[0]);
+ List<IArtifactKey> artifacts = iu.getArtifacts();
+ if (artifacts != null && artifacts.size() > 0)
+ parameters.put(PARM_ARTIFACT, artifacts.get(0));
return Status.OK_STATUS;
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Install.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Install.java
index e114204b9..c1e019dcc 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Install.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Install.java
@@ -10,7 +10,7 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.engine.phases;
-import java.util.Map;
+import java.util.*;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.engine.*;
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus;
@@ -27,7 +27,7 @@ public class Install extends InstallableUnitPhase {
final static class BeforeInstallEventAction extends ProvisioningAction {
- public IStatus execute(Map parameters) {
+ public IStatus execute(Map<String, Object> parameters) {
IProfile profile = (IProfile) parameters.get(PARM_PROFILE);
String phaseId = (String) parameters.get(PARM_PHASE_ID);
InstallableUnitOperand operand = (InstallableUnitOperand) parameters.get(PARM_OPERAND);
@@ -36,7 +36,7 @@ public class Install extends InstallableUnitPhase {
return null;
}
- public IStatus undo(Map parameters) {
+ public IStatus undo(Map<String, Object> parameters) {
Profile profile = (Profile) parameters.get(PARM_PROFILE);
String phaseId = (String) parameters.get(PARM_PHASE_ID);
InstallableUnitOperand operand = (InstallableUnitOperand) parameters.get(PARM_OPERAND);
@@ -50,7 +50,7 @@ public class Install extends InstallableUnitPhase {
final static class AfterInstallEventAction extends ProvisioningAction {
- public IStatus execute(Map parameters) {
+ public IStatus execute(Map<String, Object> parameters) {
Profile profile = (Profile) parameters.get(PARM_PROFILE);
String phaseId = (String) parameters.get(PARM_PHASE_ID);
InstallableUnitOperand operand = (InstallableUnitOperand) parameters.get(PARM_OPERAND);
@@ -61,7 +61,7 @@ public class Install extends InstallableUnitPhase {
return null;
}
- public IStatus undo(Map parameters) {
+ public IStatus undo(Map<String, Object> parameters) {
IProfile profile = (IProfile) parameters.get(PARM_PROFILE);
String phaseId = (String) parameters.get(PARM_PHASE_ID);
InstallableUnitOperand operand = (InstallableUnitOperand) parameters.get(PARM_OPERAND);
@@ -81,7 +81,7 @@ public class Install extends InstallableUnitPhase {
return (op.second() != null && !op.second().equals(op.first()));
}
- protected ProvisioningAction[] getActions(InstallableUnitOperand currentOperand) {
+ protected List<ProvisioningAction> getActions(InstallableUnitOperand currentOperand) {
//TODO: monitor.subTask(NLS.bind(Messages.Engine_Installing_IU, unit.getId()));
ProvisioningAction beforeAction = new BeforeInstallEventAction();
@@ -94,17 +94,18 @@ public class Install extends InstallableUnitPhase {
afterAction.setTouchpoint(touchpoint);
}
- if (FragmentQuery.isFragment(unit))
- return new ProvisioningAction[] {beforeAction, afterAction};
+ ArrayList<ProvisioningAction> actions = new ArrayList<ProvisioningAction>();
+ actions.add(beforeAction);
- ProvisioningAction[] parsedActions = getActions(unit, phaseId);
- if (parsedActions == null)
- return new ProvisioningAction[] {beforeAction, afterAction};
+ if (FragmentQuery.isFragment(unit)) {
+ actions.add(afterAction);
+ return actions;
+ }
- ProvisioningAction[] actions = new ProvisioningAction[parsedActions.length + 2];
- actions[0] = beforeAction;
- System.arraycopy(parsedActions, 0, actions, 1, parsedActions.length);
- actions[actions.length - 1] = afterAction;
+ List<ProvisioningAction> parsedActions = getActions(unit, phaseId);
+ if (parsedActions != null)
+ actions.addAll(parsedActions);
+ actions.add(afterAction);
return actions;
}
@@ -112,14 +113,14 @@ public class Install extends InstallableUnitPhase {
return Messages.Phase_Install_Error;
}
- protected IStatus initializeOperand(IProfile profile, InstallableUnitOperand operand, Map parameters, IProgressMonitor monitor) {
+ protected IStatus initializeOperand(IProfile profile, InstallableUnitOperand operand, Map<String, Object> parameters, IProgressMonitor monitor) {
IInstallableUnit iu = operand.second();
monitor.subTask(NLS.bind(Messages.Phase_Install_Task, iu.getId()));
parameters.put(PARM_IU, iu);
- IArtifactKey[] artifacts = iu.getArtifacts();
- if (artifacts != null && artifacts.length > 0)
- parameters.put(PARM_ARTIFACT, artifacts[0]);
+ List<IArtifactKey> artifacts = iu.getArtifacts();
+ if (artifacts != null && artifacts.size() > 0)
+ parameters.put(PARM_ARTIFACT, artifacts.get(0));
return Status.OK_STATUS;
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Property.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Property.java
index 083582835..95d0a828f 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Property.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Property.java
@@ -10,7 +10,7 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.engine.phases;
-import java.util.Map;
+import java.util.*;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.equinox.internal.p2.engine.Phase;
import org.eclipse.equinox.internal.p2.engine.Profile;
@@ -22,7 +22,7 @@ public class Property extends Phase {
public class ProfilePropertyAction extends ProvisioningAction {
- public IStatus execute(Map parameters) {
+ public IStatus execute(Map<String, Object> parameters) {
Profile profile = (Profile) parameters.get(PARM_PROFILE);
PropertyOperand propertyOperand = (PropertyOperand) parameters.get(PARM_OPERAND);
@@ -34,7 +34,7 @@ public class Property extends Phase {
return null;
}
- public IStatus undo(Map parameters) {
+ public IStatus undo(Map<String, Object> parameters) {
Profile profile = (Profile) parameters.get(PARM_PROFILE);
PropertyOperand propertyOperand = (PropertyOperand) parameters.get(PARM_OPERAND);
@@ -71,10 +71,10 @@ public class Property extends Phase {
public class UpdateInstallableUnitProfilePropertiesAction extends ProvisioningAction {
// we do not need to use a memento here since the profile is not persisted unless the operation is successful
- Map originalSourceProperties;
- Map originalTargetProperties;
+ Map<String, String> originalSourceProperties;
+ Map<String, String> originalTargetProperties;
- public IStatus execute(Map parameters) {
+ public IStatus execute(Map<String, Object> parameters) {
Profile profile = (Profile) parameters.get(PARM_PROFILE);
InstallableUnitOperand iuOperand = (InstallableUnitOperand) parameters.get(PARM_OPERAND);
@@ -90,7 +90,7 @@ public class Property extends Phase {
return null;
}
- public IStatus undo(Map parameters) {
+ public IStatus undo(Map<String, Object> parameters) {
Profile profile = (Profile) parameters.get(PARM_PROFILE);
InstallableUnitOperand iuOperand = (InstallableUnitOperand) parameters.get(PARM_OPERAND);
@@ -109,10 +109,10 @@ public class Property extends Phase {
public class RemoveInstallableUnitProfilePropertiesAction extends ProvisioningAction {
// we do not need to use a memento here since the profile is not persisted unless the operation is successful
- Map originalSourceProperties;
- Map originalTargetProperties;
+ Map<String, String> originalSourceProperties;
+ Map<String, String> originalTargetProperties;
- public IStatus execute(Map parameters) {
+ public IStatus execute(Map<String, Object> parameters) {
Profile profile = (Profile) parameters.get(PARM_PROFILE);
InstallableUnitOperand iuOperand = (InstallableUnitOperand) parameters.get(PARM_OPERAND);
@@ -123,7 +123,7 @@ public class Property extends Phase {
return null;
}
- public IStatus undo(Map parameters) {
+ public IStatus undo(Map<String, Object> parameters) {
Profile profile = (Profile) parameters.get(PARM_PROFILE);
InstallableUnitOperand iuOperand = (InstallableUnitOperand) parameters.get(PARM_OPERAND);
@@ -141,17 +141,17 @@ public class Property extends Phase {
super(PHASE_ID, weight);
}
- protected ProvisioningAction[] getActions(Operand operand) {
+ protected List<ProvisioningAction> getActions(Operand operand) {
if (operand instanceof PropertyOperand)
- return new ProvisioningAction[] {new ProfilePropertyAction()};
+ return Collections.<ProvisioningAction> singletonList(new ProfilePropertyAction());
if (operand instanceof InstallableUnitOperand) {
InstallableUnitOperand iuOperand = (InstallableUnitOperand) operand;
if (iuOperand.first() != null) {
if (iuOperand.second() != null) {
- return new ProvisioningAction[] {new UpdateInstallableUnitProfilePropertiesAction()};
+ return Collections.<ProvisioningAction> singletonList(new UpdateInstallableUnitProfilePropertiesAction());
}
- return new ProvisioningAction[] {new RemoveInstallableUnitProfilePropertiesAction()};
+ return Collections.<ProvisioningAction> singletonList(new RemoveInstallableUnitProfilePropertiesAction());
}
}
return null;
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Sizing.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Sizing.java
index 1743bcd60..2bc577137 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Sizing.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Sizing.java
@@ -46,9 +46,9 @@ public class Sizing extends InstallableUnitPhase {
return dlSize;
}
- protected ProvisioningAction[] getActions(InstallableUnitOperand operand) {
+ protected List<ProvisioningAction> getActions(InstallableUnitOperand operand) {
IInstallableUnit unit = operand.second();
- ProvisioningAction[] parsedActions = getActions(unit, COLLECT_PHASE_ID);
+ List<ProvisioningAction> parsedActions = getActions(unit, COLLECT_PHASE_ID);
if (parsedActions != null)
return parsedActions;
@@ -61,23 +61,24 @@ public class Sizing extends InstallableUnitPhase {
if (action == null) {
return null;
}
- return new ProvisioningAction[] {action};
+ return Collections.singletonList(action);
}
protected String getProblemMessage() {
return Messages.Phase_Sizing_Error;
}
- protected IStatus completePhase(IProgressMonitor monitor, IProfile profile, Map parameters) {
- List artifactRequests = (List) parameters.get(Collect.PARM_ARTIFACT_REQUESTS);
+ protected IStatus completePhase(IProgressMonitor monitor, IProfile profile, Map<String, Object> parameters) {
+ @SuppressWarnings("unchecked")
+ List<IArtifactRequest[]> artifactRequests = (List<IArtifactRequest[]>) parameters.get(Collect.PARM_ARTIFACT_REQUESTS);
ProvisioningContext context = (ProvisioningContext) parameters.get(PARM_CONTEXT);
IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT);
int statusCode = 0;
- Set artifactsToObtain = new HashSet(artifactRequests.size());
+ Set<IArtifactRequest> artifactsToObtain = new HashSet<IArtifactRequest>(artifactRequests.size());
- for (Iterator it = artifactRequests.iterator(); it.hasNext();) {
- IArtifactRequest[] requests = (IArtifactRequest[]) it.next();
+ for (Iterator<IArtifactRequest[]> it = artifactRequests.iterator(); it.hasNext();) {
+ IArtifactRequest[] requests = it.next();
if (requests == null)
continue;
for (int i = 0; i < requests.length; i++) {
@@ -95,8 +96,8 @@ public class Sizing extends InstallableUnitPhase {
else
repositories = context.getArtifactRepositories();
- for (Iterator iterator = artifactsToObtain.iterator(); iterator.hasNext() && !monitor.isCanceled();) {
- IArtifactRequest artifactRequest = (IArtifactRequest) iterator.next();
+ for (Iterator<IArtifactRequest> iterator = artifactsToObtain.iterator(); iterator.hasNext() && !monitor.isCanceled();) {
+ IArtifactRequest artifactRequest = iterator.next();
boolean found = false;
for (int i = 0; i < repositories.length; i++) {
IArtifactRepository repo;
@@ -130,8 +131,8 @@ public class Sizing extends InstallableUnitPhase {
return null;
}
- protected IStatus initializePhase(IProgressMonitor monitor, IProfile profile, Map parameters) {
- parameters.put(Collect.PARM_ARTIFACT_REQUESTS, new ArrayList());
+ protected IStatus initializePhase(IProgressMonitor monitor, IProfile profile, Map<String, Object> parameters) {
+ parameters.put(Collect.PARM_ARTIFACT_REQUESTS, new ArrayList<IArtifactRequest[]>());
return null;
}
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Unconfigure.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Unconfigure.java
index 86b6edf6b..e9498a04e 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Unconfigure.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Unconfigure.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.engine.phases;
+import java.util.List;
import java.util.Map;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.engine.InstallableUnitPhase;
@@ -34,7 +35,7 @@ public class Unconfigure extends InstallableUnitPhase {
return (op.first() != null);
}
- protected ProvisioningAction[] getActions(InstallableUnitOperand currentOperand) {
+ protected List<ProvisioningAction> getActions(InstallableUnitOperand currentOperand) {
//TODO: monitor.subTask(NLS.bind(Messages.Engine_Unconfiguring_IU, unit.getId()));
IInstallableUnit unit = currentOperand.first();
@@ -48,13 +49,13 @@ public class Unconfigure extends InstallableUnitPhase {
return Messages.Phase_Unconfigure_Error;
}
- protected IStatus initializeOperand(IProfile profile, InstallableUnitOperand operand, Map parameters, IProgressMonitor monitor) {
+ protected IStatus initializeOperand(IProfile profile, InstallableUnitOperand operand, Map<String, Object> parameters, IProgressMonitor monitor) {
IInstallableUnit iu = operand.first();
parameters.put(PARM_IU, iu);
- IArtifactKey[] artifacts = iu.getArtifacts();
- if (artifacts != null && artifacts.length > 0)
- parameters.put(PARM_ARTIFACT, artifacts[0]);
+ List<IArtifactKey> artifacts = iu.getArtifacts();
+ if (artifacts != null && artifacts.size() > 0)
+ parameters.put(PARM_ARTIFACT, artifacts.get(0));
return Status.OK_STATUS;
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Uninstall.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Uninstall.java
index 05a838aeb..5ae950f9b 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Uninstall.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Uninstall.java
@@ -10,7 +10,7 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.engine.phases;
-import java.util.Map;
+import java.util.*;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.engine.*;
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus;
@@ -25,7 +25,7 @@ import org.eclipse.equinox.p2.metadata.query.FragmentQuery;
public class Uninstall extends InstallableUnitPhase {
final static class BeforeUninstallEventAction extends ProvisioningAction {
- public IStatus execute(Map parameters) {
+ public IStatus execute(Map<String, Object> parameters) {
IProfile profile = (IProfile) parameters.get(PARM_PROFILE);
String phaseId = (String) parameters.get(PARM_PHASE_ID);
InstallableUnitOperand operand = (InstallableUnitOperand) parameters.get(PARM_OPERAND);
@@ -34,7 +34,7 @@ public class Uninstall extends InstallableUnitPhase {
return null;
}
- public IStatus undo(Map parameters) {
+ public IStatus undo(Map<String, Object> parameters) {
Profile profile = (Profile) parameters.get(PARM_PROFILE);
String phaseId = (String) parameters.get(PARM_PHASE_ID);
InstallableUnitOperand operand = (InstallableUnitOperand) parameters.get(PARM_OPERAND);
@@ -47,7 +47,7 @@ public class Uninstall extends InstallableUnitPhase {
}
final static class AfterUninstallEventAction extends ProvisioningAction {
- public IStatus execute(Map parameters) {
+ public IStatus execute(Map<String, Object> parameters) {
Profile profile = (Profile) parameters.get(PARM_PROFILE);
String phaseId = (String) parameters.get(PARM_PHASE_ID);
InstallableUnitOperand operand = (InstallableUnitOperand) parameters.get(PARM_OPERAND);
@@ -58,7 +58,7 @@ public class Uninstall extends InstallableUnitPhase {
return null;
}
- public IStatus undo(Map parameters) {
+ public IStatus undo(Map<String, Object> parameters) {
IProfile profile = (IProfile) parameters.get(PARM_PROFILE);
String phaseId = (String) parameters.get(PARM_PHASE_ID);
InstallableUnitOperand operand = (InstallableUnitOperand) parameters.get(PARM_OPERAND);
@@ -80,7 +80,7 @@ public class Uninstall extends InstallableUnitPhase {
return (op.first() != null && !op.first().equals(op.second()));
}
- protected ProvisioningAction[] getActions(InstallableUnitOperand currentOperand) {
+ protected List<ProvisioningAction> getActions(InstallableUnitOperand currentOperand) {
//TODO: monitor.subTask(NLS.bind(Messages.Engine_Uninstalling_IU, unit.getId()));
ProvisioningAction beforeAction = new BeforeUninstallEventAction();
@@ -93,16 +93,18 @@ public class Uninstall extends InstallableUnitPhase {
afterAction.setTouchpoint(touchpoint);
}
- if (FragmentQuery.isFragment(unit))
- return new ProvisioningAction[] {beforeAction, afterAction};
- ProvisioningAction[] parsedActions = getActions(unit, phaseId);
- if (parsedActions == null)
- return new ProvisioningAction[] {beforeAction, afterAction};
+ ArrayList<ProvisioningAction> actions = new ArrayList<ProvisioningAction>();
+ actions.add(beforeAction);
- ProvisioningAction[] actions = new ProvisioningAction[parsedActions.length + 2];
- actions[0] = beforeAction;
- System.arraycopy(parsedActions, 0, actions, 1, parsedActions.length);
- actions[actions.length - 1] = afterAction;
+ if (FragmentQuery.isFragment(unit)) {
+ actions.add(afterAction);
+ return actions;
+ }
+
+ List<ProvisioningAction> parsedActions = getActions(unit, phaseId);
+ if (parsedActions != null)
+ actions.addAll(parsedActions);
+ actions.add(afterAction);
return actions;
}
@@ -110,13 +112,13 @@ public class Uninstall extends InstallableUnitPhase {
return Messages.Phase_Uninstall_Error;
}
- protected IStatus initializeOperand(IProfile profile, InstallableUnitOperand operand, Map parameters, IProgressMonitor monitor) {
+ protected IStatus initializeOperand(IProfile profile, InstallableUnitOperand operand, Map<String, Object> parameters, IProgressMonitor monitor) {
IInstallableUnit iu = operand.first();
parameters.put(PARM_IU, iu);
- IArtifactKey[] artifacts = iu.getArtifacts();
- if (artifacts != null && artifacts.length > 0)
- parameters.put(PARM_ARTIFACT, artifacts[0]);
+ List<IArtifactKey> artifacts = iu.getArtifacts();
+ if (artifacts != null && artifacts.size() > 0)
+ parameters.put(PARM_ARTIFACT, artifacts.get(0));
return Status.OK_STATUS;
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/DefaultPhaseSet.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/DefaultPhaseSet.java
index 96d5fd1ca..c6fe87bdf 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/DefaultPhaseSet.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/DefaultPhaseSet.java
@@ -46,7 +46,7 @@ public class DefaultPhaseSet extends PhaseSet {
* @return the {@link PhaseSet}
*/
public static final PhaseSet createDefaultPhaseSet(int exclude) {
- ArrayList phases = new ArrayList();
+ ArrayList<Phase> phases = new ArrayList<Phase>();
if ((PHASE_COLLECT & exclude) != PHASE_COLLECT)
phases.add(new Collect(100));
if ((PHASE_UNCONFIGURE & exclude) != PHASE_UNCONFIGURE)
@@ -61,6 +61,6 @@ public class DefaultPhaseSet extends PhaseSet {
phases.add(new Install(50));
if ((PHASE_CONFIGURE & exclude) != PHASE_CONFIGURE)
phases.add(new Configure(10));
- return new DefaultPhaseSet((Phase[]) phases.toArray(new Phase[phases.size()]));
+ return new DefaultPhaseSet(phases.toArray(new Phase[phases.size()]));
}
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/IProfile.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/IProfile.java
index b2d4dd0dc..fbc195dfb 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/IProfile.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/IProfile.java
@@ -20,7 +20,7 @@ import org.eclipse.equinox.p2.metadata.query.IQueryResult;
/**
* @since 2.0
*/
-public interface IProfile extends IQueryable {
+public interface IProfile extends IQueryable<IInstallableUnit> {
/**
* Constant used to indicate that an installable unit is not locked in anyway.
@@ -124,12 +124,12 @@ public interface IProfile extends IQueryable {
public String getInstallableUnitProperty(IInstallableUnit iu, String key);
- public Map getProperties();
+ public Map<String, String> getProperties();
- public Map getInstallableUnitProperties(IInstallableUnit iu);
+ public Map<String, String> getInstallableUnitProperties(IInstallableUnit iu);
public long getTimestamp();
- public IQueryResult available(IQuery query, IProgressMonitor monitor);
+ public IQueryResult<IInstallableUnit> available(IQuery<IInstallableUnit> query, IProgressMonitor monitor);
} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/IProfileRegistry.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/IProfileRegistry.java
index b951ec203..ec58de3ca 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/IProfileRegistry.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/IProfileRegistry.java
@@ -80,7 +80,7 @@ public interface IProfileRegistry {
* @throws ProvisionException if a profile
* with the same id is already present in the registry.
*/
- IProfile addProfile(String id, Map properties) throws ProvisionException;
+ IProfile addProfile(String id, Map<String, String> properties) throws ProvisionException;
/**
* Returns whether this profile registry contains a profile with the given id.
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/IProvisioningPlan.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/IProvisioningPlan.java
index 3bdf49692..5b0cd88f7 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/IProvisioningPlan.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/IProvisioningPlan.java
@@ -31,7 +31,7 @@ public interface IProvisioningPlan {
*
* @return The proposed profile additions
*/
- public abstract IQueryable getAdditions();
+ public abstract IQueryable<IInstallableUnit> getAdditions();
/**
* Returns the provisioning context in which this plan was created.
@@ -68,7 +68,7 @@ public interface IProvisioningPlan {
*
* @return The proposed profile removals.
*/
- public abstract IQueryable getRemovals();
+ public abstract IQueryable<IInstallableUnit> getRemovals();
/**
* Returns the problems associated with changes to the given installable unit
@@ -95,7 +95,7 @@ public interface IProvisioningPlan {
* @return A map of {@link IInstallableUnit} to {@link IStatus} of the additional
* changes and their corresponding explanation.
*/
- public abstract Map getSideEffectChanges();
+ public abstract Map<IInstallableUnit, IStatus> getSideEffectChanges();
/**
* Returns the overall plan status. The severity of this status indicates
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/ISurrogateProfileHandler.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/ISurrogateProfileHandler.java
index 2d45cce45..e74d9aadd 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/ISurrogateProfileHandler.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/ISurrogateProfileHandler.java
@@ -11,6 +11,7 @@
package org.eclipse.equinox.p2.engine;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.query.IQuery;
import org.eclipse.equinox.p2.metadata.query.IQueryResult;
@@ -23,7 +24,7 @@ public interface ISurrogateProfileHandler {
public abstract boolean isSurrogate(IProfile profile);
- public abstract IQueryResult queryProfile(IProfile profile, IQuery query, IProgressMonitor monitor);
+ public abstract IQueryResult<IInstallableUnit> queryProfile(IProfile profile, IQuery<IInstallableUnit> query, IProgressMonitor monitor);
public abstract boolean updateProfile(IProfile selfProfile);
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/MissingAction.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/MissingAction.java
index bfc217ece..b7bece53e 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/MissingAction.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/MissingAction.java
@@ -10,11 +10,10 @@
*******************************************************************************/
package org.eclipse.equinox.p2.engine;
-import org.eclipse.equinox.internal.p2.engine.Messages;
-
import java.util.Map;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.internal.p2.engine.Messages;
import org.eclipse.equinox.internal.provisional.p2.metadata.VersionRange;
import org.eclipse.equinox.p2.engine.spi.ProvisioningAction;
import org.eclipse.osgi.util.NLS;
@@ -40,7 +39,7 @@ public class MissingAction extends ProvisioningAction {
return versionRange;
}
- public IStatus execute(Map parameters) {
+ public IStatus execute(Map<String, Object> parameters) {
throw new IllegalArgumentException(NLS.bind(Messages.action_not_found, actionId + (versionRange == null ? "" : "/" + versionRange.toString()))); //$NON-NLS-1$ //$NON-NLS-2$
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/ProvisioningContext.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/ProvisioningContext.java
index 4dd7cee77..bb08c51d9 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/ProvisioningContext.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/ProvisioningContext.java
@@ -13,6 +13,8 @@ package org.eclipse.equinox.p2.engine;
import java.net.URI;
import java.util.*;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.metadata.IRequirement;
/**
* @since 2.0
@@ -20,9 +22,9 @@ import java.util.*;
public class ProvisioningContext {
private URI[] metadataRepositories; //metadata repositories to consult
private URI[] artifactRepositories; //artifact repositories to consult
- private Properties properties = new Properties();
- private List extraIUs = new ArrayList();
- private Collection additionalRequirements;
+ private Map<String, String> properties = new HashMap<String, String>();
+ private List<IInstallableUnit> extraIUs = new ArrayList<IInstallableUnit>();
+ private Collection<IRequirement> additionalRequirements;
public ProvisioningContext() {
// null repos means look at them all
@@ -51,30 +53,30 @@ public class ProvisioningContext {
}
public String getProperty(String key) {
- return properties.getProperty(key);
+ return properties.get(key);
}
public void setProperty(String key, String value) {
- properties.setProperty(key, value);
+ properties.put(key, value);
}
- public Properties getProperties() {
+ public Map<String, String> getProperties() {
return properties;
}
- public List getExtraIUs() {
+ public List<IInstallableUnit> getExtraIUs() {
return extraIUs;
}
- public void setExtraIUs(List extraIUs) {
+ public void setExtraIUs(List<IInstallableUnit> extraIUs) {
this.extraIUs = extraIUs;
}
- public void setAdditionalRequirements(Collection requirements) {
+ public void setAdditionalRequirements(Collection<IRequirement> requirements) {
additionalRequirements = requirements;
}
- public Collection getAdditionalRequirements() {
+ public Collection<IRequirement> getAdditionalRequirements() {
return additionalRequirements;
}
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/ProvisioningPlan.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/ProvisioningPlan.java
index cd2380581..d23119239 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/ProvisioningPlan.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/ProvisioningPlan.java
@@ -12,6 +12,7 @@ package org.eclipse.equinox.p2.engine;
import java.util.*;
import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils;
import org.eclipse.equinox.internal.provisional.p2.metadata.query.Collector;
import org.eclipse.equinox.internal.provisional.p2.metadata.query.IQueryable;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
@@ -24,12 +25,12 @@ import org.eclipse.equinox.p2.metadata.query.IQueryResult;
public class ProvisioningPlan implements IProvisioningPlan {
IStatus status;
Operand[] operands;
- Map actualChangeRequest;
- Map sideEffectChanges;
+ Map<IInstallableUnit, IStatus> actualChangeRequest;
+ Map<IInstallableUnit, IStatus> sideEffectChanges;
IProvisioningPlan installerPlan;
IStatus globalRequestStatus;
IProfile profile;
- IQueryable completeState;
+ IQueryable<IInstallableUnit> completeState;
private final ProvisioningContext context;
public ProvisioningPlan(IProfile profile, Operand[] operands, ProvisioningContext context) {
@@ -40,7 +41,7 @@ public class ProvisioningPlan implements IProvisioningPlan {
this(status, new Operand[0], null, null, installerPlan, profile, null, null);
}
- public ProvisioningPlan(IStatus status, Operand[] operands, Map[] actualChangeRequest, IStatus globalStatus, IProvisioningPlan installerPlan, IProfile profile, IQueryable futureState, ProvisioningContext context) {
+ public ProvisioningPlan(IStatus status, Operand[] operands, Map<IInstallableUnit, IStatus>[] actualChangeRequest, IStatus globalStatus, IProvisioningPlan installerPlan, IProfile profile, IQueryable<IInstallableUnit> futureState, ProvisioningContext context) {
this.status = status;
this.operands = operands;
if (actualChangeRequest != null) {
@@ -51,9 +52,9 @@ public class ProvisioningPlan implements IProvisioningPlan {
this.installerPlan = installerPlan;
this.profile = profile;
if (futureState == null) {
- futureState = new IQueryable() {
- public IQueryResult query(IQuery query, IProgressMonitor monitor) {
- return Collector.EMPTY_COLLECTOR;
+ futureState = new IQueryable<IInstallableUnit>() {
+ public IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor) {
+ return Collector.emptyCollector();
}
};
}
@@ -87,14 +88,14 @@ public class ProvisioningPlan implements IProvisioningPlan {
/* (non-Javadoc)
* @see org.eclipse.equinox.p2.engine.IProvisioningPlan#getRemovals()
*/
- public IQueryable getRemovals() {
+ public IQueryable<IInstallableUnit> getRemovals() {
return new QueryablePlan(false);
}
/* (non-Javadoc)
* @see org.eclipse.equinox.p2.engine.IProvisioningPlan#getAdditions()
*/
- public IQueryable getAdditions() {
+ public IQueryable<IInstallableUnit> getAdditions() {
return new QueryablePlan(true);
}
@@ -104,7 +105,7 @@ public class ProvisioningPlan implements IProvisioningPlan {
public IStatus getRequestStatus(IInstallableUnit iu) {
if (actualChangeRequest == null)
return null;
- return (IStatus) actualChangeRequest.get(iu);
+ return actualChangeRequest.get(iu);
}
public IStatus getRequestStatus() {
@@ -114,23 +115,23 @@ public class ProvisioningPlan implements IProvisioningPlan {
/* (non-Javadoc)
* @see org.eclipse.equinox.p2.engine.IProvisioningPlan#getSideEffectChanges()
*/
- public Map getSideEffectChanges() {
+ public Map<IInstallableUnit, IStatus> getSideEffectChanges() {
if (sideEffectChanges == null)
- return Collections.EMPTY_MAP;
+ return CollectionUtils.emptyMap();
return sideEffectChanges;
}
- private class QueryablePlan implements IQueryable {
+ private class QueryablePlan implements IQueryable<IInstallableUnit> {
private boolean addition;
public QueryablePlan(boolean add) {
this.addition = add;
}
- public IQueryResult query(IQuery query, IProgressMonitor monitor) {
+ public IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor) {
if (operands == null || status.getSeverity() == IStatus.ERROR)
- return Collector.EMPTY_COLLECTOR;
- Collection list = new ArrayList();
+ return Collector.emptyCollector();
+ Collection<IInstallableUnit> list = new ArrayList<IInstallableUnit>();
for (int i = 0; i < operands.length; i++) {
if (!(operands[i] instanceof InstallableUnitOperand))
continue;
@@ -158,7 +159,7 @@ public class ProvisioningPlan implements IProvisioningPlan {
installerPlan = p;
}
- public IQueryable getCompleteState() {
+ public IQueryable<IInstallableUnit> getCompleteState() {
return completeState;
}
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/spi/Memento.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/spi/Memento.java
index ab8a300c9..fdcb4dbb7 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/spi/Memento.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/spi/Memento.java
@@ -17,11 +17,11 @@ import java.util.*;
*/
public class Memento {
private static final long serialVersionUID = 3257399736837461585L;
- private static final Collection simples = Arrays.asList(new Class[] {String.class, Integer.class, Long.class, Float.class, Double.class, Byte.class, Short.class, Character.class, Boolean.class});
- private static final Collection simpleArrays = Arrays.asList(new Class[] {String[].class, Integer[].class, Long[].class, Float[].class, Double[].class, Byte[].class, Short[].class, Character[].class, Boolean[].class});
- private static final Collection primitiveArrays = Arrays.asList(new Class[] {long[].class, int[].class, short[].class, char[].class, byte[].class, double[].class, float[].class, boolean[].class});
+ private static final Collection<Class<?>> simples = Arrays.<Class<?>> asList(String.class, Integer.class, Long.class, Float.class, Double.class, Byte.class, Short.class, Character.class, Boolean.class);
+ private static final Collection<Class<?>> simpleArrays = Arrays.<Class<?>> asList(String[].class, Integer[].class, Long[].class, Float[].class, Double[].class, Byte[].class, Short[].class, Character[].class, Boolean[].class);
+ private static final Collection<Class<?>> primitiveArrays = Arrays.<Class<?>> asList(long[].class, int[].class, short[].class, char[].class, byte[].class, double[].class, float[].class, boolean[].class);
- Map mementoMap = new HashMap();
+ Map<String, Object> mementoMap = new HashMap<String, Object>();
public Object remove(String key) {
if (key == null)
@@ -48,15 +48,15 @@ public class Memento {
return mementoMap.get(key);
}
- public Enumeration getKeys() {
- return new Enumeration() {
- Iterator keysIterator = mementoMap.keySet().iterator();
+ public Enumeration<String> getKeys() {
+ return new Enumeration<String>() {
+ Iterator<String> keysIterator = mementoMap.keySet().iterator();
public boolean hasMoreElements() {
return keysIterator.hasNext();
}
- public Object nextElement() {
+ public String nextElement() {
return keysIterator.next();
}
};
@@ -66,7 +66,7 @@ public class Memento {
if (value == null)
return;
- Class clazz = value.getClass();
+ Class<? extends Object> clazz = value.getClass();
if (simples.contains(clazz))
return;
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/spi/ProvisioningAction.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/spi/ProvisioningAction.java
index e2cfb214e..2154abcc1 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/spi/ProvisioningAction.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/spi/ProvisioningAction.java
@@ -25,9 +25,9 @@ public abstract class ProvisioningAction {
return memento;
}
- public abstract IStatus execute(Map parameters);
+ public abstract IStatus execute(Map<String, Object> parameters);
- public abstract IStatus undo(Map parameters);
+ public abstract IStatus undo(Map<String, Object> parameters);
// TODO: these probably should not be visible
public void setTouchpoint(Touchpoint touchpoint) {
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/spi/Touchpoint.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/spi/Touchpoint.java
index c7c20933f..bbcc51b60 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/spi/Touchpoint.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/spi/Touchpoint.java
@@ -28,19 +28,19 @@ public abstract class Touchpoint {
return actionId;
}
- public IStatus initializePhase(IProgressMonitor monitor, IProfile profile, String phaseId, Map touchpointParameters) {
+ public IStatus initializePhase(IProgressMonitor monitor, IProfile profile, String phaseId, Map<String, Object> touchpointParameters) {
return Status.OK_STATUS;
}
- public IStatus completePhase(IProgressMonitor monitor, IProfile profile, String phaseId, Map touchpointParameters) {
+ public IStatus completePhase(IProgressMonitor monitor, IProfile profile, String phaseId, Map<String, Object> touchpointParameters) {
return Status.OK_STATUS;
}
- public IStatus initializeOperand(IProfile profile, Operand operand, Map parameters) {
+ public IStatus initializeOperand(IProfile profile, Operand operand, Map<String, Object> parameters) {
return Status.OK_STATUS;
}
- public IStatus completeOperand(IProfile profile, Operand operand, Map parameters) {
+ public IStatus completeOperand(IProfile profile, Operand operand, Map<String, Object> parameters) {
return Status.OK_STATUS;
}
diff --git a/bundles/org.eclipse.equinox.p2.extensionlocation/.classpath b/bundles/org.eclipse.equinox.p2.extensionlocation/.classpath
index 6f3b481ac..64c5e31b7 100644
--- a/bundles/org.eclipse.equinox.p2.extensionlocation/.classpath
+++ b/bundles/org.eclipse.equinox.p2.extensionlocation/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <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.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
diff --git a/bundles/org.eclipse.equinox.p2.extensionlocation/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.extensionlocation/.settings/org.eclipse.jdt.core.prefs
index aceba4d02..884c4b8f5 100644
--- a/bundles/org.eclipse.equinox.p2.extensionlocation/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.equinox.p2.extensionlocation/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,4 @@
-#Thu Nov 20 12:57:22 PST 2008
+#Tue Dec 22 19:30:45 CET 2009
eclipse.preferences.version=1
instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
@@ -8,24 +8,24 @@ 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.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.compliance=1.5
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.assertIdentifier=error
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.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
@@ -72,7 +72,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=en
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.compiler.source=1.5
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
diff --git a/bundles/org.eclipse.equinox.p2.extensionlocation/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.extensionlocation/META-INF/MANIFEST.MF
index c620dcd80..2b4f14340 100644
--- a/bundles/org.eclipse.equinox.p2.extensionlocation/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.extensionlocation/META-INF/MANIFEST.MF
@@ -6,8 +6,9 @@ Bundle-Localization: plugin
Bundle-Version: 1.0.100.qualifier
Bundle-SymbolicName: org.eclipse.equinox.p2.extensionlocation;singleton:=true
Bundle-Activator: org.eclipse.equinox.internal.p2.extensionlocation.Activator
-Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
- J2SE-1.4
+Bundle-RequiredExecutionEnvironment: J2SE-1.5,
+ J2SE-1.4,
+ CDC-1.1/Foundation-1.1
Export-Package: org.eclipse.equinox.internal.p2.extensionlocation;x-friends:="org.eclipse.equinox.p2.reconciler.dropins"
Import-Package: org.eclipse.equinox.internal.p2.core.helpers,
org.eclipse.equinox.internal.p2.publisher.eclipse,
diff --git a/bundles/org.eclipse.equinox.p2.extensionlocation/build.properties b/bundles/org.eclipse.equinox.p2.extensionlocation/build.properties
index 39459475f..668447566 100644
--- a/bundles/org.eclipse.equinox.p2.extensionlocation/build.properties
+++ b/bundles/org.eclipse.equinox.p2.extensionlocation/build.properties
@@ -17,3 +17,5 @@ bin.includes = META-INF/,\
about.html
source.. = src/
src.includes = about.html
+javacTarget=jsr14
+javacSource=1.5
diff --git a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/BundlePoolFilteredListener.java b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/BundlePoolFilteredListener.java
index 249385206..e9f93d69c 100644
--- a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/BundlePoolFilteredListener.java
+++ b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/BundlePoolFilteredListener.java
@@ -21,15 +21,15 @@ import org.eclipse.equinox.p2.repository.artifact.IFileArtifactRepository;
public class BundlePoolFilteredListener extends DirectoryChangeListener {
private DirectoryChangeListener delegate;
- private Set bundlePoolFiles = new HashSet();
+ private Set<File> bundlePoolFiles = new HashSet<File>();
public BundlePoolFilteredListener(DirectoryChangeListener listener) {
delegate = listener;
IFileArtifactRepository bundlePool = Activator.getBundlePoolRepository();
if (bundlePool != null) {
- IQueryResult keys = bundlePool.query(ArtifactKeyQuery.ALL_KEYS, null);
- for (Iterator iterator = keys.iterator(); iterator.hasNext();) {
- IArtifactKey key = (IArtifactKey) iterator.next();
+ IQueryResult<IArtifactKey> keys = bundlePool.query(ArtifactKeyQuery.ALL_KEYS, null);
+ for (Iterator<IArtifactKey> iterator = keys.iterator(); iterator.hasNext();) {
+ IArtifactKey key = iterator.next();
File artifactFile = bundlePool.getArtifactFile(key);
if (artifactFile != null)
bundlePoolFiles.add(artifactFile);
diff --git a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepository.java b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepository.java
index 7f6858502..976614854 100644
--- a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepository.java
+++ b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepository.java
@@ -11,25 +11,25 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.extensionlocation;
-import org.eclipse.equinox.p2.metadata.query.IQueryResult;
-
import java.io.*;
import java.net.URI;
import java.util.*;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
+import org.eclipse.equinox.internal.provisional.p2.metadata.query.IQueryable;
import org.eclipse.equinox.internal.provisional.spi.p2.repository.AbstractRepository;
import org.eclipse.equinox.p2.metadata.IArtifactKey;
import org.eclipse.equinox.p2.metadata.query.IQuery;
+import org.eclipse.equinox.p2.metadata.query.IQueryResult;
import org.eclipse.equinox.p2.repository.artifact.*;
import org.eclipse.osgi.util.NLS;
import org.osgi.framework.BundleContext;
-public class ExtensionLocationArtifactRepository extends AbstractRepository implements IFileArtifactRepository, Constants {
+public class ExtensionLocationArtifactRepository extends AbstractRepository<IArtifactKey> implements IFileArtifactRepository, Constants {
public static final String TYPE = "org.eclipse.equinox.p2.extensionlocation.artifactRepository"; //$NON-NLS-1$
public static final Integer VERSION = new Integer(1);
- public static final List STANDARD_P2_REPOSITORY_FILE_NAMES = Arrays.asList(new Object[] {"artifacts.xml", "content.xml", "compositeArtifacts.xml", "compositeContent.xml"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ public static final List<String> STANDARD_P2_REPOSITORY_FILE_NAMES = Arrays.asList(new String[] {"artifacts.xml", "content.xml", "compositeArtifacts.xml", "compositeContent.xml"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
IFileArtifactRepository artifactRepository;
private File base;
@@ -209,7 +209,7 @@ public class ExtensionLocationArtifactRepository extends AbstractRepository impl
return artifactRepository.getArtifactFile(descriptor);
}
- public Map getProperties() {
+ public Map<String, String> getProperties() {
ensureInitialized();
return artifactRepository.getProperties();
}
@@ -232,7 +232,12 @@ public class ExtensionLocationArtifactRepository extends AbstractRepository impl
return artifactRepository.createArtifactDescriptor(key);
}
- public IQueryResult query(IQuery query, IProgressMonitor monitor) {
+ public IQueryable<IArtifactDescriptor> descriptorQueryable() {
+ ensureInitialized();
+ return artifactRepository.descriptorQueryable();
+ }
+
+ public IQueryResult<IArtifactKey> query(IQuery<IArtifactKey> query, IProgressMonitor monitor) {
ensureInitialized();
return artifactRepository.query(query, monitor);
}
diff --git a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepositoryFactory.java
index 5912e3676..c273f5775 100644
--- a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepositoryFactory.java
+++ b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepositoryFactory.java
@@ -26,7 +26,7 @@ public class ExtensionLocationArtifactRepositoryFactory extends ArtifactReposito
/* (non-Javadoc)
* @see org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.ArtifactRepositoryFactory#create(java.net.URL, java.lang.String, java.lang.String, java.util.Map)
*/
- public IArtifactRepository create(URI location, String name, String type, Map properties) throws ProvisionException {
+ public IArtifactRepository create(URI location, String name, String type, Map<String, String> properties) throws ProvisionException {
// TODO proper progress monitoring
IStatus status = validate(location, null);
if (!status.isOK())
diff --git a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepository.java b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepository.java
index 4e8cba048..59388a3af 100644
--- a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepository.java
+++ b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepository.java
@@ -103,7 +103,7 @@ public class ExtensionLocationMetadataRepository extends AbstractMetadataReposit
/* (non-Javadoc)
* @see org.eclipse.equinox.internal.provisional.p2.query.IQueryable#query(org.eclipse.equinox.internal.provisional.p2.query.Query, org.eclipse.equinox.internal.provisional.p2.query.Collector, org.eclipse.core.runtime.IProgressMonitor)
*/
- public IQueryResult query(IQuery query, IProgressMonitor monitor) {
+ public IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor) {
ensureInitialized();
return metadataRepository.query(query, monitor);
}
@@ -174,7 +174,7 @@ public class ExtensionLocationMetadataRepository extends AbstractMetadataReposit
/* (non-Javadoc)
* @see org.eclipse.equinox.internal.provisional.spi.p2.repository.AbstractRepository#getProperties()
*/
- public Map getProperties() {
+ public Map<String, String> getProperties() {
ensureInitialized();
return metadataRepository.getProperties();
}
diff --git a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepositoryFactory.java
index f83d9a76c..06fe59163 100644
--- a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepositoryFactory.java
+++ b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepositoryFactory.java
@@ -25,7 +25,7 @@ public class ExtensionLocationMetadataRepositoryFactory extends MetadataReposito
/* (non-Javadoc)
* @see org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository.MetadataRepositoryFactory#create(java.net.URL, java.lang.String, java.lang.String, java.util.Map)
*/
- public IMetadataRepository create(URI location, String name, String type, Map properties) throws ProvisionException {
+ public IMetadataRepository create(URI location, String name, String type, Map<String, String> properties) throws ProvisionException {
// TODO proper progress monitoring
IStatus status = validate(location, null);
if (!status.isOK())
diff --git a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/SiteListener.java b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/SiteListener.java
index 05113e87b..9bf52088c 100644
--- a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/SiteListener.java
+++ b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/SiteListener.java
@@ -105,16 +105,16 @@ public class SiteListener extends DirectoryChangeListener {
/*
* Create a new site listener on the given site.
*/
- public SiteListener(Map properties, String url, DirectoryChangeListener delegate) {
+ public SiteListener(Map<String, String> properties, String url, DirectoryChangeListener delegate) {
this.siteLocation = url;
this.delegate = delegate;
- this.policy = (String) properties.get(SITE_POLICY);
- Collection listCollection = new HashSet();
- String listString = (String) properties.get(SITE_LIST);
+ this.policy = properties.get(SITE_POLICY);
+ Collection<String> listCollection = new HashSet<String>();
+ String listString = properties.get(SITE_LIST);
if (listString != null)
for (StringTokenizer tokenizer = new StringTokenizer(listString, ","); tokenizer.hasMoreTokens();) //$NON-NLS-1$
listCollection.add(tokenizer.nextToken());
- this.list = (String[]) listCollection.toArray(new String[listCollection.size()]);
+ this.list = listCollection.toArray(new String[listCollection.size()]);
}
/* (non-Javadoc)
@@ -220,8 +220,8 @@ public class SiteListener extends DirectoryChangeListener {
String urlString = siteLocation;
if (urlString.endsWith(Constants.EXTENSION_LOCATION))
urlString = urlString.substring(0, urlString.length() - Constants.EXTENSION_LOCATION.length());
- List result = new ArrayList();
- for (Enumeration e = properties.elements(); e.hasMoreElements();) {
+ List<String> result = new ArrayList<String>();
+ for (Enumeration<Object> e = properties.elements(); e.hasMoreElements();) {
String line = (String) e.nextElement();
StringTokenizer tokenizer = new StringTokenizer(line, ";"); //$NON-NLS-1$
String targetSite = tokenizer.nextToken();
@@ -229,7 +229,7 @@ public class SiteListener extends DirectoryChangeListener {
continue;
result.add(tokenizer.nextToken());
}
- toBeRemoved = (String[]) result.toArray(new String[result.size()]);
+ toBeRemoved = result.toArray(new String[result.size()]);
return toBeRemoved;
}
@@ -241,7 +241,7 @@ public class SiteListener extends DirectoryChangeListener {
private String[] getManagedFiles() {
if (managedFiles != null)
return managedFiles;
- List result = new ArrayList();
+ List<String> result = new ArrayList<String>();
File siteFile;
try {
siteFile = URIUtil.toFile(new URI(siteLocation));
@@ -249,24 +249,24 @@ public class SiteListener extends DirectoryChangeListener {
LogHelper.log(new Status(IStatus.ERROR, Activator.ID, "Unable to create a URL from site location: " + siteLocation, e)); //$NON-NLS-1$
return new String[0];
}
- Map pluginCache = getPlugins(siteFile);
- Map featureCache = getFeatures(siteFile);
- for (Iterator iter = featureCache.keySet().iterator(); iter.hasNext();) {
- File featureFile = (File) iter.next();
+ Map<String, File> pluginCache = getPlugins(siteFile);
+ Map<File, Feature> featureCache = getFeatures(siteFile);
+ for (Iterator<File> iter = featureCache.keySet().iterator(); iter.hasNext();) {
+ File featureFile = iter.next();
// add the feature path
result.add(featureFile.toString());
- Feature feature = (Feature) featureCache.get(featureFile);
+ Feature feature = featureCache.get(featureFile);
FeatureEntry[] entries = feature.getEntries();
for (int inner = 0; inner < entries.length; inner++) {
FeatureEntry entry = entries[inner];
// grab the right location from the plug-in cache
String key = entry.getId() + '/' + entry.getVersion();
- File pluginLocation = (File) pluginCache.get(key);
+ File pluginLocation = pluginCache.get(key);
if (pluginLocation != null)
result.add(pluginLocation.toString());
}
}
- managedFiles = (String[]) result.toArray(new String[result.size()]);
+ managedFiles = result.toArray(new String[result.size()]);
return managedFiles;
}
@@ -274,8 +274,8 @@ public class SiteListener extends DirectoryChangeListener {
* Iterate over the feature directory and return a map of
* File to Feature objects (from the generator bundle)
*/
- private Map getFeatures(File location) {
- Map result = new HashMap();
+ private Map<File, Feature> getFeatures(File location) {
+ Map<File, Feature> result = new HashMap<File, Feature>();
File featureDir = new File(location, FEATURES);
File[] children = featureDir.listFiles();
for (int i = 0; i < children.length; i++) {
@@ -294,9 +294,9 @@ public class SiteListener extends DirectoryChangeListener {
* Iterate over the plugins directory and return a map of
* plug-in id/version to File locations.
*/
- private Map getPlugins(File location) {
+ private Map<String, File> getPlugins(File location) {
File[] plugins = new File(location, PLUGINS).listFiles();
- Map result = new HashMap();
+ Map<String, File> result = new HashMap<String, File>();
for (int i = 0; plugins != null && i < plugins.length; i++) {
File bundleLocation = plugins[i];
if (bundleLocation.isDirectory() || bundleLocation.getName().endsWith(".jar")) { //$NON-NLS-1$
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/provisional/p2/metadata/generator/Generator.java b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/provisional/p2/metadata/generator/Generator.java
index ac95dac37..833993b31 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/provisional/p2/metadata/generator/Generator.java
+++ b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/provisional/p2/metadata/generator/Generator.java
@@ -1025,10 +1025,10 @@ public class Generator {
String location = feature.getLocation();
boolean isExploded = (location.endsWith(".jar") ? false : true); //$NON-NLS-1$
IInstallableUnit featureIU = MetadataGeneratorHelper.createFeatureJarIU(feature, true);
- IArtifactKey[] artifacts = featureIU.getArtifacts();
+ List artifacts = featureIU.getArtifacts();
storePluginShape(feature, result);
- for (int arti = 0; arti < artifacts.length; arti++) {
- IArtifactDescriptor ad = MetadataGeneratorHelper.createArtifactDescriptor(artifacts[arti], new File(location), true, false);
+ for (int arti = 0; arti < artifacts.size(); arti++) {
+ IArtifactDescriptor ad = MetadataGeneratorHelper.createArtifactDescriptor((IArtifactKey) artifacts.get(arti), new File(location), true, false);
if (isExploded)
publishArtifact(ad, new File(location).listFiles(), destination, false, new File(location));
else
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/.classpath b/bundles/org.eclipse.equinox.p2.metadata.repository/.classpath
index ef379494d..834ea833e 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.repository/.classpath
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <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.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" output="bin_ant" path="src_ant"/>
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
index 904df3197..3699add0a 100644
--- 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
@@ -1,4 +1,4 @@
-#Fri Feb 22 11:22:59 EST 2008
+#Mon Dec 28 00:17:37 CET 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
org.eclipse.jdt.core.builder.duplicateResourceTask=warning
@@ -7,24 +7,24 @@ 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.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.compliance=1.5
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.assertIdentifier=error
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.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
@@ -71,7 +71,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=en
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.compiler.source=1.5
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
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
index 623a0a747..e5b69b4ae 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.repository/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/META-INF/MANIFEST.MF
@@ -36,11 +36,13 @@ Import-Package: javax.xml.parsers,
org.eclipse.equinox.p2.repository.metadata,
org.eclipse.osgi.util;version="1.1.0",
org.osgi.framework;version="1.3.0",
+ org.osgi.service.prefs;version="1.1.1",
org.osgi.util.tracker;version="1.3.0",
org.xml.sax
Bundle-Activator: org.eclipse.equinox.internal.p2.metadata.repository.Activator
Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: J2SE-1.4,
+Bundle-RequiredExecutionEnvironment: J2SE-1.5,
+ J2SE-1.4,
CDC-1.1/Foundation-1.1
Require-Bundle: org.eclipse.equinox.common;bundle-version="[3.5.0,4.0.0)",
org.eclipse.equinox.registry,
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/build.properties b/bundles/org.eclipse.equinox.p2.metadata.repository/build.properties
index 3e90a6c41..ffda85291 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.repository/build.properties
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/build.properties
@@ -24,3 +24,5 @@ jars.compile.order = .,\
ant_tasks/metadataRepository-ant.jar
source.ant_tasks/metadataRepository-ant.jar = src_ant/
output.ant_tasks/metadataRepository-ant.jar = bin_ant/
+javacTarget=jsr14
+javacSource=1.5
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CacheManager.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CacheManager.java
index e4fa76fc7..6e69be2fe 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CacheManager.java
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CacheManager.java
@@ -77,7 +77,7 @@ public class CacheManager {
private static final String RESUME_DEFAULT = "true"; //$NON-NLS-1$
private static final String XML_EXTENSION = ".xml"; //$NON-NLS-1$
- private final HashSet knownPrefixes = new HashSet(5);
+ private final HashSet<String> knownPrefixes = new HashSet<String>(5);
/**
* Returns a hash of the repository location.
@@ -216,8 +216,8 @@ public class CacheManager {
* @param repositoryLocation
*/
void deleteCache(URI repositoryLocation) {
- for (Iterator it = knownPrefixes.iterator(); it.hasNext();) {
- String prefix = (String) it.next();
+ for (Iterator<String> it = knownPrefixes.iterator(); it.hasNext();) {
+ String prefix = it.next();
File[] cacheFiles = getCacheFiles(repositoryLocation, prefix);
for (int i = 0; i < cacheFiles.length; i++) {
// delete the cache file if it exists
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepository.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepository.java
index 407f86b9e..f5e8cb2cd 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepository.java
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepository.java
@@ -35,7 +35,7 @@ import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
import org.eclipse.osgi.util.NLS;
-public class CompositeMetadataRepository extends AbstractMetadataRepository implements IMetadataRepository, ICompositeRepository {
+public class CompositeMetadataRepository extends AbstractMetadataRepository implements IMetadataRepository, ICompositeRepository<IInstallableUnit> {
static final public String REPOSITORY_TYPE = CompositeMetadataRepository.class.getName();
public static final String PI_REPOSITORY_TYPE = "compositeMetadataRepository"; //$NON-NLS-1$
@@ -45,9 +45,9 @@ public class CompositeMetadataRepository extends AbstractMetadataRepository impl
// keep a list of the child URIs. they can be absolute or relative. they may or may not point
// to a valid reachable repo
- private List childrenURIs = new ArrayList();
+ private List<URI> childrenURIs = new ArrayList<URI>();
// keep a list of the repositories that we have successfully loaded
- private List loadedRepos = new ArrayList();
+ private List<IMetadataRepository> loadedRepos = new ArrayList<IMetadataRepository>();
private IMetadataRepositoryManager manager;
/**
@@ -91,7 +91,7 @@ public class CompositeMetadataRepository extends AbstractMetadataRepository impl
return isLocal();
}
- CompositeMetadataRepository(IMetadataRepositoryManager manager, URI location, String name, Map properties) {
+ CompositeMetadataRepository(IMetadataRepositoryManager manager, URI location, String name, Map<String, String> properties) {
super(name == null ? (location != null ? location.toString() : "") : name, REPOSITORY_TYPE, REPOSITORY_VERSION.toString(), location, null, null, properties); //$NON-NLS-1$
this.manager = manager;
//when creating a repository, we must ensure it exists on disk so a subsequent load will succeed
@@ -122,16 +122,16 @@ public class CompositeMetadataRepository extends AbstractMetadataRepository impl
result.setProvider(getProvider());
result.setProperties(getProperties());
// it is important to directly access the field so we have the relative URIs
- result.setChildren((URI[]) childrenURIs.toArray(new URI[childrenURIs.size()]));
+ result.setChildren(childrenURIs.toArray(new URI[childrenURIs.size()]));
return result;
}
- public IQueryResult query(IQuery query, IProgressMonitor monitor) {
+ public IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor) {
if (monitor == null)
monitor = new NullProgressMonitor();
try {
// Query all the all the repositories this composite repo contains
- CompoundQueryable queryable = new CompoundQueryable((IQueryable[]) loadedRepos.toArray(new IQueryable[loadedRepos.size()]));
+ CompoundQueryable<IInstallableUnit> queryable = new CompoundQueryable<IInstallableUnit>(loadedRepos.toArray(new IQueryable[loadedRepos.size()]));
return queryable.query(query, monitor);
} finally {
if (monitor != null)
@@ -179,8 +179,8 @@ public class CompositeMetadataRepository extends AbstractMetadataRepository impl
if (removed) {
// we removed the child from the list so remove the associated repo object as well
IMetadataRepository found = null;
- for (Iterator iter = loadedRepos.iterator(); found == null && iter.hasNext();) {
- IMetadataRepository current = (IMetadataRepository) iter.next();
+ for (Iterator<IMetadataRepository> iter = loadedRepos.iterator(); found == null && iter.hasNext();) {
+ IMetadataRepository current = iter.next();
URI repoLocation = current.getLocation();
if (URIUtil.sameURI(childURI, repoLocation))
found = current;
@@ -240,7 +240,7 @@ public class CompositeMetadataRepository extends AbstractMetadataRepository impl
return;
File file = getActualLocation(location);
File jarFile = getActualLocation(location, JAR_EXTENSION);
- boolean compress = "true".equalsIgnoreCase((String) properties.get(PROP_COMPRESSED)); //$NON-NLS-1$
+ boolean compress = "true".equalsIgnoreCase(properties.get(PROP_COMPRESSED)); //$NON-NLS-1$
try {
OutputStream output = null;
if (!compress) {
@@ -274,10 +274,10 @@ public class CompositeMetadataRepository extends AbstractMetadataRepository impl
}
}
- public List getChildren() {
- List result = new ArrayList();
- for (Iterator iter = childrenURIs.iterator(); iter.hasNext();)
- result.add(URIUtil.makeAbsolute((URI) iter.next(), location));
+ public List<URI> getChildren() {
+ List<URI> result = new ArrayList<URI>();
+ for (Iterator<URI> iter = childrenURIs.iterator(); iter.hasNext();)
+ result.add(URIUtil.makeAbsolute(iter.next(), location));
return result;
}
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepositoryFactory.java
index 287a32aee..ab81fc145 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepositoryFactory.java
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepositoryFactory.java
@@ -33,7 +33,7 @@ public class CompositeMetadataRepositoryFactory extends MetadataRepositoryFactor
private static final String PROTOCOL_FILE = "file"; //$NON-NLS-1$
public static final String CONTENT_FILENAME = "compositeContent"; //$NON-NLS-1$
- public IMetadataRepository create(URI location, String name, String type, Map properties) {
+ public IMetadataRepository create(URI location, String name, String type, Map<String, String> properties) {
return new CompositeMetadataRepository(getManager(), location, name, properties);
}
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/IUMap.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/IUMap.java
index 8e976553d..e14805c42 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/IUMap.java
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/IUMap.java
@@ -23,11 +23,11 @@ public class IUMap {
/**
* Iterator over all the {@link IInstallableUnit} instances in the map.
*/
- public class MapIterator implements Iterator {
+ public class MapIterator implements Iterator<IInstallableUnit> {
//iterator over the keys in UIMap
- private Iterator unitIterator;
+ private Iterator<String> unitIterator;
//iterator over the Set inside a single value of the IUMap
- private Iterator currentBucket;
+ private Iterator<IInstallableUnit> currentBucket;
MapIterator() {
super();
@@ -38,9 +38,9 @@ public class IUMap {
return unitIterator.hasNext() || (currentBucket != null && currentBucket.hasNext());
}
- public Object next() {
+ public IInstallableUnit next() {
if (currentBucket == null || !currentBucket.hasNext())
- currentBucket = ((Set) units.get(unitIterator.next())).iterator();
+ currentBucket = units.get(unitIterator.next()).iterator();
return currentBucket.next();
}
@@ -52,12 +52,12 @@ public class IUMap {
/**
* Map<String,Set<IInstallableUnit>> mapping IU id to iu's with that id.
*/
- final Map units = new HashMap();
+ final Map<String, Set<IInstallableUnit>> units = new HashMap<String, Set<IInstallableUnit>>();
public void add(IInstallableUnit unit) {
- Set matching = (Set) units.get(unit.getId());
+ Set<IInstallableUnit> matching = units.get(unit.getId());
if (matching == null) {
- matching = new HashSet(2);
+ matching = new HashSet<IInstallableUnit>(2);
units.put(unit.getId(), matching);
}
matching.add(unit);
@@ -72,19 +72,19 @@ public class IUMap {
units.clear();
}
- public Iterator iterator() {
+ public Iterator<IInstallableUnit> iterator() {
return new MapIterator();
}
- public IQueryResult query(InstallableUnitQuery query) {
+ public IQueryResult<IInstallableUnit> query(InstallableUnitQuery query) {
//iterate over the entire map, or just the IU's with the given id
- Iterator candidates;
+ Iterator<IInstallableUnit> candidates;
if (query.getId() == null)
candidates = iterator();
else {
- Collection bucket = ((Collection) units.get(query.getId()));
+ Collection<IInstallableUnit> bucket = units.get(query.getId());
if (bucket == null)
- return Collector.EMPTY_COLLECTOR;
+ return Collector.emptyCollector();
candidates = bucket.iterator();
}
return query.perform(candidates);
@@ -92,7 +92,7 @@ public class IUMap {
}
public void remove(IInstallableUnit unit) {
- Set matching = (Set) units.get(unit.getId());
+ Set<IInstallableUnit> matching = units.get(unit.getId());
if (matching == null)
return;
matching.remove(unit);
@@ -100,8 +100,8 @@ public class IUMap {
units.remove(unit.getId());
}
- public void removeAll(Collection toRemove) {
- for (Iterator it = toRemove.iterator(); it.hasNext();)
- remove((IInstallableUnit) it.next());
+ public void removeAll(Collection<IInstallableUnit> toRemove) {
+ for (Iterator<IInstallableUnit> it = toRemove.iterator(); it.hasNext();)
+ remove(it.next());
}
}
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/LocalMetadataRepository.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/LocalMetadataRepository.java
index 3cc5a9558..8acc3883c 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/LocalMetadataRepository.java
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/LocalMetadataRepository.java
@@ -17,8 +17,7 @@ import java.util.*;
import java.util.jar.JarEntry;
import java.util.jar.JarOutputStream;
import org.eclipse.core.runtime.*;
-import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
-import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
+import org.eclipse.equinox.internal.p2.core.helpers.*;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus;
import org.eclipse.equinox.internal.provisional.p2.metadata.query.InstallableUnitQuery;
@@ -45,7 +44,7 @@ public class LocalMetadataRepository extends AbstractMetadataRepository {
static final private String XML_EXTENSION = ".xml"; //$NON-NLS-1$
protected IUMap units = new IUMap();
- protected HashSet repositories = new HashSet();
+ protected HashSet<RepositoryReference> repositories = new HashSet<RepositoryReference>();
private static File getActualLocation(URI location, String extension) {
File spec = URIUtil.toFile(location);
@@ -78,7 +77,7 @@ public class LocalMetadataRepository extends AbstractMetadataRepository {
* @param location The location of the repository
* @param name The name of the repository
*/
- public LocalMetadataRepository(URI location, String name, Map properties) {
+ public LocalMetadataRepository(URI location, String name, Map<String, String> properties) {
super(name == null ? (location != null ? location.toString() : "") : name, REPOSITORY_TYPE, REPOSITORY_VERSION.toString(), location, null, null, properties); //$NON-NLS-1$
if (!location.getScheme().equals("file")) //$NON-NLS-1$
throw new IllegalArgumentException("Invalid local repository location: " + location); //$NON-NLS-1$
@@ -121,18 +120,18 @@ public class LocalMetadataRepository extends AbstractMetadataRepository {
if (bus == null)
return;
- List repositoriesSnapshot = createRepositoriesSnapshot();
- for (Iterator it = repositoriesSnapshot.iterator(); it.hasNext();) {
- RepositoryReference reference = (RepositoryReference) it.next();
+ List<RepositoryReference> repositoriesSnapshot = createRepositoriesSnapshot();
+ for (Iterator<RepositoryReference> it = repositoriesSnapshot.iterator(); it.hasNext();) {
+ RepositoryReference reference = it.next();
boolean isEnabled = (reference.Options & IRepository.ENABLED) != 0;
bus.publishEvent(new RepositoryEvent(reference.Location, reference.Type, RepositoryEvent.DISCOVERED, isEnabled));
}
}
- private synchronized List createRepositoriesSnapshot() {
+ private synchronized List<RepositoryReference> createRepositoriesSnapshot() {
if (repositories.isEmpty())
- return Collections.EMPTY_LIST;
- return new ArrayList(repositories);
+ return CollectionUtils.emptyList();
+ return new ArrayList<RepositoryReference>(repositories);
}
// use this method to setup any transient fields etc after the object has been restored from a stream
@@ -144,7 +143,7 @@ public class LocalMetadataRepository extends AbstractMetadataRepository {
return true;
}
- public synchronized IQueryResult query(IQuery query, IProgressMonitor monitor) {
+ public synchronized IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor) {
if (query instanceof InstallableUnitQuery)
return units.query((InstallableUnitQuery) query);
return query.perform(units.iterator());
@@ -170,7 +169,7 @@ public class LocalMetadataRepository extends AbstractMetadataRepository {
private void save() {
File file = getActualLocation(location);
File jarFile = getActualLocation(location, JAR_EXTENSION);
- boolean compress = "true".equalsIgnoreCase((String) properties.get(PROP_COMPRESSED)); //$NON-NLS-1$
+ boolean compress = "true".equalsIgnoreCase(properties.get(PROP_COMPRESSED)); //$NON-NLS-1$
try {
OutputStream output = null;
if (!compress) {
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/MetadataRepositoryIO.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/MetadataRepositoryIO.java
index 148cc2e0c..cdf8447e2 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/MetadataRepositoryIO.java
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/MetadataRepositoryIO.java
@@ -108,7 +108,7 @@ public class MetadataRepositoryIO {
}
- protected XMLWriter.ProcessingInstruction[] createPI(Class repositoryClass) {
+ protected XMLWriter.ProcessingInstruction[] createPI(Class<?> repositoryClass) {
//TODO We should remove this processing instruction, but currently old clients rely on this. See bug 210450.
return new XMLWriter.ProcessingInstruction[] {XMLWriter.ProcessingInstruction.makeTargetVersionInstruction(XMLConstants.PI_REPOSITORY_TARGET, XMLConstants.CURRENT_VERSION)};
}
@@ -116,7 +116,7 @@ public class MetadataRepositoryIO {
// XML writer for a IMetadataRepository
protected class Writer extends MetadataWriter implements XMLConstants {
- public Writer(OutputStream output, Class repositoryClass) throws IOException {
+ public Writer(OutputStream output, Class<? extends IMetadataRepository> repositoryClass) throws IOException {
super(output, createPI(repositoryClass));
}
@@ -133,11 +133,11 @@ public class MetadataRepositoryIO {
writeProperties(repository.getProperties());
if (repository instanceof LocalMetadataRepository) {
- Set references = ((LocalMetadataRepository) repository).repositories;
+ Set<RepositoryReference> references = ((LocalMetadataRepository) repository).repositories;
writeRepositoryReferences(references.iterator(), references.size());
}
// The size attribute is a problematic since it forces the use of a collection.
- Set units = repository.query(InstallableUnitQuery.ANY, null).unmodifiableSet();
+ Set<IInstallableUnit> units = repository.query(InstallableUnitQuery.ANY, null).unmodifiableSet();
writeInstallableUnits(units.iterator(), units.size());
end(REPOSITORY_ELEMENT);
@@ -149,13 +149,13 @@ public class MetadataRepositoryIO {
* @param references An Iterator of {@link RepositoryReference}.
* @param size The number of references to write
*/
- protected void writeRepositoryReferences(Iterator references, int size) {
+ protected void writeRepositoryReferences(Iterator<RepositoryReference> references, int size) {
if (size == 0)
return;
start(REPOSITORY_REFERENCES_ELEMENT);
attribute(COLLECTION_SIZE_ATTRIBUTE, size);
while (references.hasNext())
- writeRepositoryReference((RepositoryReference) references.next());
+ writeRepositoryReference(references.next());
end(REPOSITORY_REFERENCES_ELEMENT);
}
@@ -307,7 +307,7 @@ public class MetadataRepositoryIO {
//can't create repository if missing type - this is already logged when parsing attributes
if (state.Type == null)
return;
- Class clazz = Class.forName(state.Type);
+ Class<?> clazz = Class.forName(state.Type);
Object repositoryObject = clazz.newInstance();
if (repositoryObject instanceof AbstractMetadataRepository) {
repository = (AbstractMetadataRepository) repositoryObject;
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/MetadataRepositoryManager.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/MetadataRepositoryManager.java
index 0579aca4d..4cd3679f0 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/MetadataRepositoryManager.java
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/MetadataRepositoryManager.java
@@ -17,6 +17,7 @@ import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
import org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository.MetadataRepositoryFactory;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.repository.IRepository;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
@@ -25,7 +26,7 @@ import org.eclipse.osgi.util.NLS;
/**
* Default implementation of {@link IMetadataRepositoryManager}.
*/
-public class MetadataRepositoryManager extends AbstractRepositoryManager implements IMetadataRepositoryManager {
+public class MetadataRepositoryManager extends AbstractRepositoryManager<IInstallableUnit> implements IMetadataRepositoryManager {
public MetadataRepositoryManager() {
super();
@@ -35,11 +36,11 @@ public class MetadataRepositoryManager extends AbstractRepositoryManager impleme
super.addRepository(repository, true, null);
}
- public IMetadataRepository createRepository(URI location, String name, String type, Map properties) throws ProvisionException {
+ public IMetadataRepository createRepository(URI location, String name, String type, Map<String, String> properties) throws ProvisionException {
return (IMetadataRepository) doCreateRepository(location, name, type, properties);
}
- protected IRepository factoryCreate(URI location, String name, String type, Map properties, IExtension extension) throws ProvisionException {
+ protected IRepository<IInstallableUnit> factoryCreate(URI location, String name, String type, Map<String, String> properties, IExtension extension) throws ProvisionException {
MetadataRepositoryFactory factory = (MetadataRepositoryFactory) createExecutableExtension(extension, EL_FACTORY);
if (factory == null)
return null;
@@ -47,7 +48,7 @@ public class MetadataRepositoryManager extends AbstractRepositoryManager impleme
return factory.create(location, name, type, properties);
}
- protected IRepository factoryLoad(URI location, IExtension extension, int flags, SubMonitor monitor) throws ProvisionException {
+ protected IRepository<IInstallableUnit> factoryLoad(URI location, IExtension extension, int flags, SubMonitor monitor) throws ProvisionException {
MetadataRepositoryFactory factory = (MetadataRepositoryFactory) createExecutableExtension(extension, EL_FACTORY);
if (factory == null)
return null;
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/URLMetadataRepository.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/URLMetadataRepository.java
index 5caec190b..58295034f 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/URLMetadataRepository.java
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/URLMetadataRepository.java
@@ -17,6 +17,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.URIUtil;
import org.eclipse.equinox.internal.provisional.p2.metadata.query.InstallableUnitQuery;
import org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository.AbstractMetadataRepository;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.query.IQuery;
import org.eclipse.equinox.p2.metadata.query.IQueryResult;
@@ -47,7 +48,7 @@ public class URLMetadataRepository extends AbstractMetadataRepository {
super();
}
- public URLMetadataRepository(URI location, String name, Map properties) {
+ public URLMetadataRepository(URI location, String name, Map<String, String> properties) {
super(name == null ? (location != null ? location.toString() : "") : name, REPOSITORY_TYPE, REPOSITORY_VERSION.toString(), location, null, null, properties); //$NON-NLS-1$
content = getActualLocation(location);
}
@@ -78,7 +79,7 @@ public class URLMetadataRepository extends AbstractMetadataRepository {
return false;
}
- public synchronized IQueryResult query(IQuery query, IProgressMonitor monitor) {
+ public synchronized IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor) {
if (query instanceof InstallableUnitQuery)
return units.query((InstallableUnitQuery) query);
return query.perform(units.iterator());
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataParser.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataParser.java
index 8f2d5a97e..1a4af5db9 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataParser.java
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataParser.java
@@ -12,8 +12,6 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.metadata.repository.io;
-import org.eclipse.equinox.p2.metadata.ICopyright;
-
import java.net.URI;
import java.util.*;
import org.eclipse.equinox.internal.p2.core.helpers.OrderedProperties;
@@ -35,13 +33,24 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants {
super(context, bundleId);
}
- protected class RepositoryReferencesHandler extends AbstractHandler {
- private HashSet references;
+ protected abstract class AbstractMetadataHandler extends AbstractHandler {
+
+ public AbstractMetadataHandler(ContentHandler parentHandler, String elementHandled) {
+ super(parentHandler, elementHandled);
+ }
+
+ int getOptionalSize(Attributes attributes, int dflt) {
+ String sizeStr = parseOptionalAttribute(attributes, COLLECTION_SIZE_ATTRIBUTE);
+ return sizeStr != null ? Integer.parseInt(sizeStr) : dflt;
+ }
+ }
+
+ protected class RepositoryReferencesHandler extends AbstractMetadataHandler {
+ private HashSet<RepositoryReference> references;
public RepositoryReferencesHandler(AbstractHandler parentHandler, Attributes attributes) {
super(parentHandler, REPOSITORY_REFERENCES_ELEMENT);
- String size = parseOptionalAttribute(attributes, COLLECTION_SIZE_ATTRIBUTE);
- references = (size != null ? new HashSet(Integer.parseInt(size)) : new HashSet(4));
+ references = new HashSet<RepositoryReference>(getOptionalSize(attributes, 4));
}
public void startElement(String name, Attributes attributes) {
@@ -53,7 +62,7 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants {
}
public RepositoryReference[] getReferences() {
- return (RepositoryReference[]) references.toArray(new RepositoryReference[references.size()]);
+ return references.toArray(new RepositoryReference[references.size()]);
}
}
@@ -61,7 +70,7 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants {
private final String[] required = new String[] {TYPE_ATTRIBUTE, OPTIONS_ATTRIBUTE};
- public RepositoryReferenceHandler(AbstractHandler parentHandler, Attributes attributes, Set references) {
+ public RepositoryReferenceHandler(AbstractHandler parentHandler, Attributes attributes, Set<RepositoryReference> references) {
super(parentHandler, REPOSITORY_REFERENCE_ELEMENT);
String[] values = parseRequiredAttributes(attributes, required);
String name = parseOptionalAttribute(attributes, NAME_ATTRIBUTE);
@@ -77,21 +86,20 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants {
}
}
- protected class InstallableUnitsHandler extends AbstractHandler {
- private ArrayList units;
+ protected class InstallableUnitsHandler extends AbstractMetadataHandler {
+ private ArrayList<InstallableUnitDescription> units;
public InstallableUnitsHandler(AbstractHandler parentHandler, Attributes attributes) {
super(parentHandler, INSTALLABLE_UNITS_ELEMENT);
- String size = parseOptionalAttribute(attributes, COLLECTION_SIZE_ATTRIBUTE);
- units = (size != null ? new ArrayList(new Integer(size).intValue()) : new ArrayList(4));
+ units = new ArrayList<InstallableUnitDescription>(getOptionalSize(attributes, 4));
}
public IInstallableUnit[] getUnits() {
int size = units.size();
IInstallableUnit[] result = new IInstallableUnit[size];
int i = 0;
- for (Iterator it = units.iterator(); it.hasNext(); i++) {
- InstallableUnitDescription desc = (InstallableUnitDescription) it.next();
+ for (Iterator<InstallableUnitDescription> it = units.iterator(); it.hasNext(); i++) {
+ InstallableUnitDescription desc = it.next();
result[i] = MetadataFactory.createInstallableUnit(desc);
}
return result;
@@ -130,9 +138,9 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants {
private Version version;
private boolean singleton;
- private List units;
+ private List<InstallableUnitDescription> units;
- public InstallableUnitHandler(AbstractHandler parentHandler, Attributes attributes, List units) {
+ public InstallableUnitHandler(AbstractHandler parentHandler, Attributes attributes, List<InstallableUnitDescription> units) {
super(parentHandler, INSTALLABLE_UNIT_ELEMENT);
String[] values = parseAttributes(attributes, REQUIRED_IU_ATTRIBUTES, OPTIONAL_IU_ATTRIBUTES);
this.units = units;
@@ -250,7 +258,7 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants {
if (isValidXML()) {
if (requirementChangesHandler != null) {
currentUnit = new MetadataFactory.InstallableUnitPatchDescription();
- ((InstallableUnitPatchDescription) currentUnit).setRequirementChanges((IRequirementChange[]) requirementChangesHandler.getRequirementChanges().toArray(new IRequirementChange[requirementChangesHandler.getRequirementChanges().size()]));
+ ((InstallableUnitPatchDescription) currentUnit).setRequirementChanges(requirementChangesHandler.getRequirementChanges().toArray(new IRequirementChange[requirementChangesHandler.getRequirementChanges().size()]));
if (applicabilityScopeHandler != null)
((InstallableUnitPatchDescription) currentUnit).setApplicabilityScope(applicabilityScopeHandler.getScope());
if (lifeCycleHandler != null)
@@ -267,15 +275,15 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants {
OrderedProperties properties = (propertiesHandler == null ? new OrderedProperties(0) : propertiesHandler.getProperties());
String updateFrom = null;
VersionRange updateRange = null;
- for (Enumeration e = properties.keys(); e.hasMoreElements();) {
- String key = (String) e.nextElement();
+ for (Enumeration<String> e = properties.keys(); e.hasMoreElements();) {
+ String key = e.nextElement();
String value = properties.getProperty(key);
//Backward compatibility
- if (key.equals("equinox.p2.update.from")) {
+ if (key.equals("equinox.p2.update.from")) { //$NON-NLS-1$
updateFrom = value;
continue;
}
- if (key.equals("equinox.p2.update.range")) {
+ if (key.equals("equinox.p2.update.range")) { //$NON-NLS-1$
updateRange = new VersionRange(value);
continue;
}
@@ -322,13 +330,12 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants {
}
}
- protected class ApplicabilityScopesHandler extends AbstractHandler {
- private List scopes;
+ protected class ApplicabilityScopesHandler extends AbstractMetadataHandler {
+ private List<IRequirement[]> scopes;
public ApplicabilityScopesHandler(AbstractHandler parentHandler, Attributes attributes) {
super(parentHandler, APPLICABILITY_SCOPE);
- String size = parseOptionalAttribute(attributes, COLLECTION_SIZE_ATTRIBUTE);
- scopes = (size != null ? new ArrayList(new Integer(size).intValue()) : new ArrayList(4));
+ scopes = new ArrayList<IRequirement[]>(getOptionalSize(attributes, 4));
}
public void startElement(String name, Attributes attributes) {
@@ -340,15 +347,15 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants {
}
public IRequirement[][] getScope() {
- return (IRequirement[][]) scopes.toArray(new IRequirement[scopes.size()][]);
+ return scopes.toArray(new IRequirement[scopes.size()][]);
}
}
protected class ApplicabilityScopeHandler extends AbstractHandler {
private RequiredCapabilitiesHandler children;
- private List scopes;
+ private List<IRequirement[]> scopes;
- public ApplicabilityScopeHandler(AbstractHandler parentHandler, Attributes attributes, List scopes) {
+ public ApplicabilityScopeHandler(AbstractHandler parentHandler, Attributes attributes, List<IRequirement[]> scopes) {
super(parentHandler, APPLY_ON);
this.scopes = scopes;
}
@@ -368,13 +375,12 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants {
}
}
- protected class RequirementsChangeHandler extends AbstractHandler {
- private List requirementChanges;
+ protected class RequirementsChangeHandler extends AbstractMetadataHandler {
+ private List<IRequirementChange> requirementChanges;
public RequirementsChangeHandler(InstallableUnitHandler parentHandler, Attributes attributes) {
super(parentHandler, REQUIREMENT_CHANGES);
- String size = parseOptionalAttribute(attributes, COLLECTION_SIZE_ATTRIBUTE);
- requirementChanges = (size != null ? new ArrayList(new Integer(size).intValue()) : new ArrayList(4));
+ requirementChanges = new ArrayList<IRequirementChange>(getOptionalSize(attributes, 4));
}
public void startElement(String name, Attributes attributes) {
@@ -385,20 +391,20 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants {
}
}
- public List getRequirementChanges() {
+ public List<IRequirementChange> getRequirementChanges() {
return requirementChanges;
}
}
protected class RequirementChangeHandler extends AbstractHandler {
- private List from;
- private List to;
- private List requirementChanges;
+ private List<IRequirement> from;
+ private List<IRequirement> to;
+ private List<IRequirementChange> requirementChanges;
- public RequirementChangeHandler(AbstractHandler parentHandler, Attributes attributes, List requirementChanges) {
+ public RequirementChangeHandler(AbstractHandler parentHandler, Attributes attributes, List<IRequirementChange> requirementChanges) {
super(parentHandler, REQUIREMENT_CHANGE);
- from = new ArrayList(1);
- to = new ArrayList(1);
+ from = new ArrayList<IRequirement>(1);
+ to = new ArrayList<IRequirement>(1);
this.requirementChanges = requirementChanges;
}
@@ -421,9 +427,9 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants {
}
protected class RequirementChangeEltHandler extends AbstractHandler {
- private List requirement;
+ private List<IRequirement> requirement;
- public RequirementChangeEltHandler(AbstractHandler parentHandler, String parentId, Attributes attributes, List from) {
+ public RequirementChangeEltHandler(AbstractHandler parentHandler, String parentId, Attributes attributes, List<IRequirement> from) {
super(parentHandler, parentId);
requirement = from;
}
@@ -439,17 +445,17 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants {
}
protected class LifeCycleHandler extends AbstractHandler {
- private List lifeCycleRequirement;
+ private List<IRequirement> lifeCycleRequirement;
public LifeCycleHandler(AbstractHandler parentHandler, Attributes attributes) {
super(parentHandler, LIFECYCLE);
- lifeCycleRequirement = new ArrayList(1);
+ lifeCycleRequirement = new ArrayList<IRequirement>(1);
}
public IRequirement getLifeCycleRequirement() {
if (lifeCycleRequirement.size() == 0)
return null;
- return (IRequirement) lifeCycleRequirement.get(0);
+ return lifeCycleRequirement.get(0);
}
public void startElement(String name, Attributes attributes) {
@@ -461,17 +467,16 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants {
}
}
- protected class ProvidedCapabilitiesHandler extends AbstractHandler {
- private List providedCapabilities;
+ protected class ProvidedCapabilitiesHandler extends AbstractMetadataHandler {
+ private List<IProvidedCapability> providedCapabilities;
public ProvidedCapabilitiesHandler(AbstractHandler parentHandler, Attributes attributes) {
super(parentHandler, PROVIDED_CAPABILITIES_ELEMENT);
- String size = parseOptionalAttribute(attributes, COLLECTION_SIZE_ATTRIBUTE);
- providedCapabilities = (size != null ? new ArrayList(new Integer(size).intValue()) : new ArrayList(4));
+ providedCapabilities = new ArrayList<IProvidedCapability>(getOptionalSize(attributes, 4));
}
public IProvidedCapability[] getProvidedCapabilities() {
- return (IProvidedCapability[]) providedCapabilities.toArray(new IProvidedCapability[providedCapabilities.size()]);
+ return providedCapabilities.toArray(new IProvidedCapability[providedCapabilities.size()]);
}
public void startElement(String name, Attributes attributes) {
@@ -485,7 +490,7 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants {
protected class ProvidedCapabilityHandler extends AbstractHandler {
- public ProvidedCapabilityHandler(AbstractHandler parentHandler, Attributes attributes, List capabilities) {
+ public ProvidedCapabilityHandler(AbstractHandler parentHandler, Attributes attributes, List<IProvidedCapability> capabilities) {
super(parentHandler, PROVIDED_CAPABILITY_ELEMENT);
String[] values = parseRequiredAttributes(attributes, REQUIRED_PROVIDED_CAPABILITY_ATTRIBUTES);
Version version = checkVersion(PROVIDED_CAPABILITY_ELEMENT, VERSION_ATTRIBUTE, values[2]);
@@ -497,17 +502,16 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants {
}
}
- protected class HostRequiredCapabilitiesHandler extends AbstractHandler {
- private List requiredCapabilities;
+ protected class HostRequiredCapabilitiesHandler extends AbstractMetadataHandler {
+ private List<IRequirement> requiredCapabilities;
public HostRequiredCapabilitiesHandler(AbstractHandler parentHandler, Attributes attributes) {
super(parentHandler, HOST_REQUIRED_CAPABILITIES_ELEMENT);
- String size = parseOptionalAttribute(attributes, COLLECTION_SIZE_ATTRIBUTE);
- requiredCapabilities = (size != null ? new ArrayList(new Integer(size).intValue()) : new ArrayList(4));
+ requiredCapabilities = new ArrayList<IRequirement>(getOptionalSize(attributes, 4));
}
public IRequirement[] getHostRequiredCapabilities() {
- return (IRequirement[]) requiredCapabilities.toArray(new IRequirement[requiredCapabilities.size()]);
+ return requiredCapabilities.toArray(new IRequirement[requiredCapabilities.size()]);
}
public void startElement(String name, Attributes attributes) {
@@ -519,17 +523,16 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants {
}
}
- protected class MetaRequiredCapabilitiesHandler extends AbstractHandler {
- private List requiredCapabilities;
+ protected class MetaRequiredCapabilitiesHandler extends AbstractMetadataHandler {
+ private List<IRequirement> requiredCapabilities;
public MetaRequiredCapabilitiesHandler(AbstractHandler parentHandler, Attributes attributes) {
super(parentHandler, META_REQUIRED_CAPABILITIES_ELEMENT);
- String size = parseOptionalAttribute(attributes, COLLECTION_SIZE_ATTRIBUTE);
- requiredCapabilities = (size != null ? new ArrayList(new Integer(size).intValue()) : new ArrayList(4));
+ requiredCapabilities = new ArrayList<IRequirement>(getOptionalSize(attributes, 4));
}
public IRequirement[] getMetaRequiredCapabilities() {
- return (IRequirement[]) requiredCapabilities.toArray(new IRequirement[requiredCapabilities.size()]);
+ return requiredCapabilities.toArray(new IRequirement[requiredCapabilities.size()]);
}
public void startElement(String name, Attributes attributes) {
@@ -541,17 +544,16 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants {
}
}
- protected class RequiredCapabilitiesHandler extends AbstractHandler {
- private List requiredCapabilities;
+ protected class RequiredCapabilitiesHandler extends AbstractMetadataHandler {
+ private List<IRequirement> requiredCapabilities;
public RequiredCapabilitiesHandler(AbstractHandler parentHandler, Attributes attributes) {
super(parentHandler, REQUIRED_CAPABILITIES_ELEMENT);
- String size = parseOptionalAttribute(attributes, COLLECTION_SIZE_ATTRIBUTE);
- requiredCapabilities = (size != null ? new ArrayList(new Integer(size).intValue()) : new ArrayList(4));
+ requiredCapabilities = new ArrayList<IRequirement>(getOptionalSize(attributes, 4));
}
public IRequirement[] getRequiredCapabilities() {
- return (IRequirement[]) requiredCapabilities.toArray(new IRequirement[requiredCapabilities.size()]);
+ return requiredCapabilities.toArray(new IRequirement[requiredCapabilities.size()]);
}
public void startElement(String name, Attributes attributes) {
@@ -569,7 +571,7 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants {
private TextHandler filterHandler = null;
- public RequiredCapabilityHandler(AbstractHandler parentHandler, Attributes attributes, List capabilities) {
+ public RequiredCapabilityHandler(AbstractHandler parentHandler, Attributes attributes, List<IRequirement> capabilities) {
super(parentHandler, REQUIRED_CAPABILITY_ELEMENT);
String[] values = parseAttributes(attributes, REQIURED_CAPABILITY_ATTRIBUTES, OPTIONAL_CAPABILITY_ATTRIBUTES);
VersionRange range = checkVersionRange(REQUIRED_CAPABILITY_ELEMENT, VERSION_RANGE_ATTRIBUTE, values[2]);
@@ -601,16 +603,16 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants {
protected class ArtifactsHandler extends AbstractHandler {
- private List artifacts;
+ private List<IArtifactKey> artifacts;
public ArtifactsHandler(AbstractHandler parentHandler, Attributes attributes) {
super(parentHandler, ARTIFACT_KEYS_ELEMENT);
String size = parseOptionalAttribute(attributes, COLLECTION_SIZE_ATTRIBUTE);
- artifacts = (size != null ? new ArrayList(new Integer(size).intValue()) : new ArrayList(4));
+ artifacts = (size != null ? new ArrayList<IArtifactKey>(new Integer(size).intValue()) : new ArrayList<IArtifactKey>(4));
}
public IArtifactKey[] getArtifactKeys() {
- return (IArtifactKey[]) artifacts.toArray(new IArtifactKey[artifacts.size()]);
+ return artifacts.toArray(new IArtifactKey[artifacts.size()]);
}
public void startElement(String name, Attributes attributes) {
@@ -626,7 +628,7 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants {
private final String[] required = new String[] {CLASSIFIER_ATTRIBUTE, ID_ATTRIBUTE, VERSION_ATTRIBUTE};
- public ArtifactHandler(AbstractHandler parentHandler, Attributes attributes, List artifacts) {
+ public ArtifactHandler(AbstractHandler parentHandler, Attributes attributes, List<IArtifactKey> artifacts) {
super(parentHandler, ARTIFACT_KEY_ELEMENT);
String[] values = parseRequiredAttributes(attributes, required);
Version version = checkVersion(ARTIFACT_KEY_ELEMENT, VERSION_ATTRIBUTE, values[2]);
@@ -664,18 +666,18 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants {
ITouchpointData touchpointData = null;
- List data = null;
+ List<TouchpointInstructionsHandler> data = null;
public TouchpointDataHandler(AbstractHandler parentHandler, Attributes attributes) {
super(parentHandler, TOUCHPOINT_DATA_ELEMENT);
String size = parseOptionalAttribute(attributes, COLLECTION_SIZE_ATTRIBUTE);
- data = (size != null ? new ArrayList(new Integer(size).intValue()) : new ArrayList(4));
+ data = (size != null ? new ArrayList<TouchpointInstructionsHandler>(new Integer(size).intValue()) : new ArrayList<TouchpointInstructionsHandler>(4));
}
public ITouchpointData[] getTouchpointData() {
ITouchpointData[] result = new ITouchpointData[data.size()];
for (int i = 0; i < result.length; i++)
- result[i] = ((TouchpointInstructionsHandler) data.get(i)).getTouchpointData();
+ result[i] = data.get(i).getTouchpointData();
return result;
}
@@ -690,12 +692,12 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants {
protected class TouchpointInstructionsHandler extends AbstractHandler {
- Map instructions = null;
+ Map<String, ITouchpointInstruction> instructions = null;
- public TouchpointInstructionsHandler(AbstractHandler parentHandler, Attributes attributes, List data) {
+ public TouchpointInstructionsHandler(AbstractHandler parentHandler, Attributes attributes, List<TouchpointInstructionsHandler> data) {
super(parentHandler, TOUCHPOINT_DATA_INSTRUCTIONS_ELEMENT);
String size = parseOptionalAttribute(attributes, COLLECTION_SIZE_ATTRIBUTE);
- instructions = (size != null ? new LinkedHashMap(new Integer(size).intValue()) : new LinkedHashMap(4));
+ instructions = (size != null ? new LinkedHashMap<String, ITouchpointInstruction>(new Integer(size).intValue()) : new LinkedHashMap<String, ITouchpointInstruction>(4));
}
public ITouchpointData getTouchpointData() {
@@ -716,11 +718,11 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants {
private final String[] required = new String[] {TOUCHPOINT_DATA_INSTRUCTION_KEY_ATTRIBUTE};
private final String[] optional = new String[] {TOUCHPOINT_DATA_INSTRUCTION_IMPORT_ATTRIBUTE};
- Map instructions = null;
+ Map<String, ITouchpointInstruction> instructions = null;
String key = null;
String qualifier = null;
- public TouchpointInstructionHandler(AbstractHandler parentHandler, Attributes attributes, Map instructions) {
+ public TouchpointInstructionHandler(AbstractHandler parentHandler, Attributes attributes, Map<String, ITouchpointInstruction> instructions) {
super(parentHandler, TOUCHPOINT_DATA_INSTRUCTION_ELEMENT);
String[] values = parseAttributes(attributes, required, optional);
key = values[0];
@@ -764,18 +766,18 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants {
// Note this handler is set up to handle multiple license elements, but for now
// the API for IInstallableUnit only reflects one.
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=216911
- private List licenses;
+ private List<ILicense> licenses;
public LicensesHandler(ContentHandler parentHandler, Attributes attributes) {
super(parentHandler, LICENSES_ELEMENT);
String size = parseOptionalAttribute(attributes, COLLECTION_SIZE_ATTRIBUTE);
- licenses = (size != null ? new ArrayList(new Integer(size).intValue()) : new ArrayList(2));
+ licenses = (size != null ? new ArrayList<ILicense>(new Integer(size).intValue()) : new ArrayList<ILicense>(2));
}
public ILicense[] getLicenses() {
if (licenses.size() == 0)
return NO_LICENSES;
- return (ILicense[]) licenses.toArray(new ILicense[licenses.size()]);
+ return licenses.toArray(new ILicense[licenses.size()]);
}
public void startElement(String name, Attributes attributes) {
@@ -795,9 +797,9 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants {
URI location = null;
- private final List licenses;
+ private final List<ILicense> licenses;
- public LicenseHandler(AbstractHandler parentHandler, Attributes attributes, List licenses) {
+ public LicenseHandler(AbstractHandler parentHandler, Attributes attributes, List<ILicense> licenses) {
super(parentHandler, LICENSE_ELEMENT);
location = parseURIAttribute(attributes, false);
this.licenses = licenses;
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataWriter.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataWriter.java
index aa28742c2..c6c184f2e 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataWriter.java
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataWriter.java
@@ -14,8 +14,8 @@ package org.eclipse.equinox.internal.p2.metadata.repository.io;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
-import java.util.Iterator;
-import java.util.Map;
+import java.util.*;
+import java.util.Map.Entry;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
import org.eclipse.equinox.internal.p2.metadata.IRequiredCapability;
@@ -38,7 +38,7 @@ public abstract class MetadataWriter extends XMLWriter implements XMLConstants {
* @param units An Iterator of {@link IInstallableUnit}.
* @param size The number of units to write
*/
- protected void writeInstallableUnits(Iterator units, int size) {
+ protected void writeInstallableUnits(Iterator<IInstallableUnit> units, int size) {
if (size == 0)
return;
start(INSTALLABLE_UNITS_ELEMENT);
@@ -46,7 +46,7 @@ public abstract class MetadataWriter extends XMLWriter implements XMLConstants {
// The size is a bummer. Is it really needed? It forces the use of a collect
attribute(COLLECTION_SIZE_ATTRIBUTE, size);
while (units.hasNext())
- writeInstallableUnit((IInstallableUnit) units.next());
+ writeInstallableUnit(units.next());
end(INSTALLABLE_UNITS_ELEMENT);
}
@@ -105,38 +105,39 @@ public abstract class MetadataWriter extends XMLWriter implements XMLConstants {
}
}
- protected void writeProvidedCapabilities(IProvidedCapability[] capabilities) {
- if (capabilities != null && capabilities.length > 0) {
+ protected void writeProvidedCapabilities(List<IProvidedCapability> capabilities) {
+ if (capabilities != null && capabilities.size() > 0) {
start(PROVIDED_CAPABILITIES_ELEMENT);
- attribute(COLLECTION_SIZE_ATTRIBUTE, capabilities.length);
- for (int i = 0; i < capabilities.length; i++) {
+ attribute(COLLECTION_SIZE_ATTRIBUTE, capabilities.size());
+ for (int i = 0; i < capabilities.size(); i++) {
+ IProvidedCapability pc = capabilities.get(i);
start(PROVIDED_CAPABILITY_ELEMENT);
- attribute(NAMESPACE_ATTRIBUTE, capabilities[i].getNamespace());
- attribute(NAME_ATTRIBUTE, capabilities[i].getName());
- attribute(VERSION_ATTRIBUTE, capabilities[i].getVersion());
+ attribute(NAMESPACE_ATTRIBUTE, pc.getNamespace());
+ attribute(NAME_ATTRIBUTE, pc.getName());
+ attribute(VERSION_ATTRIBUTE, pc.getVersion());
end(PROVIDED_CAPABILITY_ELEMENT);
}
end(PROVIDED_CAPABILITIES_ELEMENT);
}
}
- protected void writeMetaRequiredCapabilities(IRequirement[] capabilities) {
- if (capabilities != null && capabilities.length > 0) {
+ protected void writeMetaRequiredCapabilities(List<IRequirement> capabilities) {
+ if (capabilities != null && capabilities.size() > 0) {
start(META_REQUIRED_CAPABILITIES_ELEMENT);
- attribute(COLLECTION_SIZE_ATTRIBUTE, capabilities.length);
- for (int i = 0; i < capabilities.length; i++) {
- writeRequiredCapability(capabilities[i]);
+ attribute(COLLECTION_SIZE_ATTRIBUTE, capabilities.size());
+ for (int i = 0; i < capabilities.size(); i++) {
+ writeRequiredCapability(capabilities.get(i));
}
end(META_REQUIRED_CAPABILITIES_ELEMENT);
}
}
- protected void writeRequiredCapabilities(IRequirement[] capabilities) {
- if (capabilities != null && capabilities.length > 0) {
+ protected void writeRequiredCapabilities(List<IRequirement> capabilities) {
+ if (capabilities != null && capabilities.size() > 0) {
start(REQUIRED_CAPABILITIES_ELEMENT);
- attribute(COLLECTION_SIZE_ATTRIBUTE, capabilities.length);
- for (int i = 0; i < capabilities.length; i++) {
- writeRequiredCapability(capabilities[i]);
+ attribute(COLLECTION_SIZE_ATTRIBUTE, capabilities.size());
+ for (int i = 0; i < capabilities.size(); i++) {
+ writeRequiredCapability(capabilities.get(i));
}
end(REQUIRED_CAPABILITIES_ELEMENT);
}
@@ -158,16 +159,16 @@ public abstract class MetadataWriter extends XMLWriter implements XMLConstants {
start(APPLICABILITY_SCOPE);
for (int i = 0; i < capabilities.length; i++) {
start(APPLY_ON);
- writeRequiredCapabilities(capabilities[i]);
+ writeRequiredCapabilities(Arrays.asList(capabilities[i]));
end(APPLY_ON);
}
end(APPLICABILITY_SCOPE);
}
- protected void writeRequirementsChange(IRequirementChange[] changes) {
+ protected void writeRequirementsChange(List<IRequirementChange> changes) {
start(REQUIREMENT_CHANGES);
- for (int i = 0; i < changes.length; i++) {
- writeRequirementChange(changes[i]);
+ for (int i = 0; i < changes.size(); i++) {
+ writeRequirementChange(changes.get(i));
}
end(REQUIREMENT_CHANGES);
}
@@ -176,12 +177,12 @@ public abstract class MetadataWriter extends XMLWriter implements XMLConstants {
start(REQUIREMENT_CHANGE);
if (change.applyOn() != null) {
start(REQUIREMENT_FROM);
- writeRequiredCapability((IRequirement) change.applyOn());
+ writeRequiredCapability(change.applyOn());
end(REQUIREMENT_FROM);
}
if (change.newValue() != null) {
start(REQUIREMENT_TO);
- writeRequiredCapability((IRequirement) change.newValue());
+ writeRequiredCapability(change.newValue());
end(REQUIREMENT_TO);
}
end(REQUIREMENT_CHANGE);
@@ -205,15 +206,16 @@ public abstract class MetadataWriter extends XMLWriter implements XMLConstants {
}
- protected void writeArtifactKeys(IArtifactKey[] artifactKeys) {
- if (artifactKeys != null && artifactKeys.length > 0) {
+ protected void writeArtifactKeys(List<IArtifactKey> artifactKeys) {
+ if (artifactKeys != null && artifactKeys.size() > 0) {
start(ARTIFACT_KEYS_ELEMENT);
- attribute(COLLECTION_SIZE_ATTRIBUTE, artifactKeys.length);
- for (int i = 0; i < artifactKeys.length; i++) {
+ attribute(COLLECTION_SIZE_ATTRIBUTE, artifactKeys.size());
+ for (int i = 0; i < artifactKeys.size(); i++) {
+ IArtifactKey artifactKey = artifactKeys.get(i);
start(ARTIFACT_KEY_ELEMENT);
- attribute(ARTIFACT_KEY_CLASSIFIER_ATTRIBUTE, artifactKeys[i].getClassifier());
- attribute(ID_ATTRIBUTE, artifactKeys[i].getId());
- attribute(VERSION_ATTRIBUTE, artifactKeys[i].getVersion());
+ attribute(ARTIFACT_KEY_CLASSIFIER_ATTRIBUTE, artifactKey.getClassifier());
+ attribute(ID_ATTRIBUTE, artifactKey.getId());
+ attribute(VERSION_ATTRIBUTE, artifactKey.getVersion());
end(ARTIFACT_KEY_ELEMENT);
}
end(ARTIFACT_KEYS_ELEMENT);
@@ -227,21 +229,21 @@ public abstract class MetadataWriter extends XMLWriter implements XMLConstants {
end(TOUCHPOINT_TYPE_ELEMENT);
}
- protected void writeTouchpointData(ITouchpointData[] touchpointData) {
- if (touchpointData != null && touchpointData.length > 0) {
+ protected void writeTouchpointData(List<ITouchpointData> touchpointData) {
+ if (touchpointData != null && touchpointData.size() > 0) {
start(TOUCHPOINT_DATA_ELEMENT);
- attribute(COLLECTION_SIZE_ATTRIBUTE, touchpointData.length);
- for (int i = 0; i < touchpointData.length; i++) {
- ITouchpointData nextData = touchpointData[i];
- Map instructions = nextData.getInstructions();
+ attribute(COLLECTION_SIZE_ATTRIBUTE, touchpointData.size());
+ for (int i = 0; i < touchpointData.size(); i++) {
+ ITouchpointData nextData = touchpointData.get(i);
+ Map<String, ITouchpointInstruction> instructions = nextData.getInstructions();
if (instructions.size() > 0) {
start(TOUCHPOINT_DATA_INSTRUCTIONS_ELEMENT);
attribute(COLLECTION_SIZE_ATTRIBUTE, instructions.size());
- for (Iterator iter = instructions.entrySet().iterator(); iter.hasNext();) {
- Map.Entry entry = (Map.Entry) iter.next();
+ for (Iterator<Entry<String, ITouchpointInstruction>> iter = instructions.entrySet().iterator(); iter.hasNext();) {
+ Entry<String, ITouchpointInstruction> entry = iter.next();
start(TOUCHPOINT_DATA_INSTRUCTION_ELEMENT);
attribute(TOUCHPOINT_DATA_INSTRUCTION_KEY_ATTRIBUTE, entry.getKey());
- ITouchpointInstruction instruction = (ITouchpointInstruction) entry.getValue();
+ ITouchpointInstruction instruction = entry.getValue();
if (instruction.getImportAttribute() != null)
attribute(TOUCHPOINT_DATA_INSTRUCTION_IMPORT_ATTRIBUTE, instruction.getImportAttribute());
cdata(instruction.getBody(), true);
@@ -263,15 +265,15 @@ public abstract class MetadataWriter extends XMLWriter implements XMLConstants {
}
}
- private void writeLicenses(ILicense[] licenses) {
- if (licenses != null && licenses.length > 0) {
+ private void writeLicenses(List<ILicense> licenses) {
+ if (licenses != null && licenses.size() > 0) {
// In the future there may be more than one license, so we write this
// as a collection of one.
// See bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=216911
start(LICENSES_ELEMENT);
- attribute(COLLECTION_SIZE_ATTRIBUTE, licenses.length);
- for (int i = 0; i < licenses.length; i++) {
- ILicense license = licenses[i];
+ attribute(COLLECTION_SIZE_ATTRIBUTE, licenses.size());
+ for (int i = 0; i < licenses.size(); i++) {
+ ILicense license = licenses.get(i);
if (license == null)
continue;
start(LICENSE_ELEMENT);
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/metadata/repository/AbstractMetadataRepository.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/metadata/repository/AbstractMetadataRepository.java
index 912f750cd..71d64b7b9 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/metadata/repository/AbstractMetadataRepository.java
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/metadata/repository/AbstractMetadataRepository.java
@@ -24,7 +24,7 @@ import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
* Clients may subclass this class.
* <p>
*/
-public abstract class AbstractMetadataRepository extends AbstractRepository implements IMetadataRepository {
+public abstract class AbstractMetadataRepository extends AbstractRepository<IInstallableUnit> implements IMetadataRepository {
//TODO Consider removing from abstract class, this is currently an implementation detail of the simple metadata repo parser
public static class RepositoryState {
@@ -34,7 +34,7 @@ public abstract class AbstractMetadataRepository extends AbstractRepository impl
public String Provider;
public String Description;
public URI Location;
- public Map Properties;
+ public Map<String, String> Properties;
public IInstallableUnit[] Units;
public RepositoryReference[] Repositories;
}
@@ -46,7 +46,7 @@ public abstract class AbstractMetadataRepository extends AbstractRepository impl
//TODO Consider removing from abstract class, this is currently an implementation detail of the simple metadata repo parser
public abstract void initialize(RepositoryState state);
- protected AbstractMetadataRepository(String name, String type, String version, URI location, String description, String provider, Map properties) {
+ protected AbstractMetadataRepository(String name, String type, String version, URI location, String description, String provider, Map<String, String> properties) {
super(name, type, version, location, description, provider, properties);
}
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/metadata/repository/MetadataRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/metadata/repository/MetadataRepositoryFactory.java
index b622e8a51..2be0f8b2a 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/metadata/repository/MetadataRepositoryFactory.java
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/metadata/repository/MetadataRepositoryFactory.java
@@ -42,7 +42,7 @@ public abstract class MetadataRepositoryFactory {
* <li>There was an error writing to the given repository location.</li>
* </ul>
*/
- public abstract IMetadataRepository create(URI location, String name, String type, Map properties) throws ProvisionException;
+ public abstract IMetadataRepository create(URI location, String name, String type, Map<String, String> properties) throws ProvisionException;
/**
* Returns the provisioning agent associated with this factory, or <code>null</code>
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/metadata/repository/SimpleMetadataRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/metadata/repository/SimpleMetadataRepositoryFactory.java
index 90d757a79..00cf552c0 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/metadata/repository/SimpleMetadataRepositoryFactory.java
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/metadata/repository/SimpleMetadataRepositoryFactory.java
@@ -29,7 +29,7 @@ public class SimpleMetadataRepositoryFactory extends MetadataRepositoryFactory {
private static final String XML_EXTENSION = ".xml"; //$NON-NLS-1$
private static final String PROTOCOL_FILE = "file"; //$NON-NLS-1$
- public IMetadataRepository create(URI location, String name, String type, Map properties) {
+ public IMetadataRepository create(URI location, String name, String type, Map<String, String> properties) {
if (location.getScheme().equals("file")) //$NON-NLS-1$
return new LocalMetadataRepository(location, name, properties);
return new URLMetadataRepository(location, name, properties);
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/CreateCompositeMetadataRepositoryTask.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/CreateCompositeMetadataRepositoryTask.java
index 685bda3fb..bf94e9c7b 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.repository/src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/CreateCompositeMetadataRepositoryTask.java
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/CreateCompositeMetadataRepositoryTask.java
@@ -34,7 +34,7 @@ public class CreateCompositeMetadataRepositoryTask extends Task {
String name = "Composite Metadata Repository";
boolean compressed = true; // compress by default
boolean failOnExists = false; // should we fail if one already exists?
- Map properties = new HashMap();
+ Map<String, String> properties = new HashMap<String, String>();
/* (non-Javadoc)
* @see org.apache.tools.ant.Task#execute()
diff --git a/bundles/org.eclipse.equinox.p2.metadata/.classpath b/bundles/org.eclipse.equinox.p2.metadata/.classpath
index 7cdeb7319..64c5e31b7 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/.classpath
+++ b/bundles/org.eclipse.equinox.p2.metadata/.classpath
@@ -1,7 +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.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
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
index ed5b63b50..4fd376d1b 100644
--- 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
@@ -1,4 +1,4 @@
-#Mon Nov 05 17:01:21 EST 2007
+#Mon Dec 21 22:17:52 CET 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
org.eclipse.jdt.core.builder.duplicateResourceTask=warning
@@ -8,24 +8,24 @@ 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.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.compliance=1.5
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.assertIdentifier=error
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.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
@@ -74,7 +74,6 @@ 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.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
@@ -88,7 +87,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enab
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.compiler.source=1.5
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
@@ -160,7 +159,6 @@ 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
diff --git a/bundles/org.eclipse.equinox.p2.metadata/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.metadata/META-INF/MANIFEST.MF
index c469471a8..651831a86 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.metadata/META-INF/MANIFEST.MF
@@ -93,8 +93,9 @@ Import-Package: org.eclipse.osgi.service.localization;version="1.0.0",
org.osgi.framework;version="1.3.0"
Bundle-Activator: org.eclipse.equinox.internal.p2.metadata.MetadataActivator
Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
- J2SE-1.4
+Bundle-RequiredExecutionEnvironment: J2SE-1.5,
+ J2SE-1.4,
+ CDC-1.1/Foundation-1.1
Require-Bundle: org.eclipse.equinox.common,
org.eclipse.equinox.p2.core,
org.eclipse.osgi;bundle-version="3.5.0"
diff --git a/bundles/org.eclipse.equinox.p2.metadata/build.properties b/bundles/org.eclipse.equinox.p2.metadata/build.properties
index a6b8330d2..246ea6cb7 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/build.properties
+++ b/bundles/org.eclipse.equinox.p2.metadata/build.properties
@@ -15,3 +15,5 @@ bin.includes = META-INF/,\
about.html,\
plugin.properties
src.includes = about.html
+javacTarget=jsr14
+javacSource=1.5
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/ArtifactKey.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/ArtifactKey.java
index 5e8372291..5aa3fda76 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/ArtifactKey.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/ArtifactKey.java
@@ -31,7 +31,7 @@ public class ArtifactKey implements IArtifactKey {
private static String[] getArrayFromList(String stringList, String separator) {
if (stringList == null || stringList.trim().length() == 0)
return new String[0];
- ArrayList list = new ArrayList();
+ ArrayList<String> list = new ArrayList<String>();
boolean separatorSeen = true;
StringTokenizer tokens = new StringTokenizer(stringList, separator, true);
while (tokens.hasMoreTokens()) {
@@ -48,7 +48,7 @@ public class ArtifactKey implements IArtifactKey {
}
if (separatorSeen)
list.add(""); //$NON-NLS-1$
- return (String[]) list.toArray(new String[list.size()]);
+ return list.toArray(new String[list.size()]);
}
public static IArtifactKey parse(String specification) {
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/BasicVersion.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/BasicVersion.java
index 12d20d482..347612d62 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/BasicVersion.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/BasicVersion.java
@@ -79,5 +79,5 @@ public abstract class BasicVersion extends Version {
* contract.
* @return The raw vector. Must be treated as read-only
*/
- abstract Comparable[] getVector();
+ abstract Comparable<?>[] getVector();
}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/IRequiredCapability.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/IRequiredCapability.java
index ef42ebd58..ba6a5425f 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/IRequiredCapability.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/IRequiredCapability.java
@@ -31,7 +31,7 @@ import org.eclipse.equinox.p2.metadata.IRequirement;
* @noimplement This interface is not intended to be implemented by clients.
* @noextend This interface is not intended to be extended by clients.
*/
-public interface IRequiredCapability extends IMatchQuery, IRequirement {
+public interface IRequiredCapability extends IMatchQuery<IInstallableUnit>, IRequirement {
// public String getFilter();
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/InstallableUnit.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/InstallableUnit.java
index fddab46cd..53a2a61ee 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/InstallableUnit.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/InstallableUnit.java
@@ -11,8 +11,8 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.metadata;
-import java.util.ArrayList;
-import java.util.Map;
+import java.util.*;
+import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils;
import org.eclipse.equinox.internal.p2.core.helpers.OrderedProperties;
import org.eclipse.equinox.internal.provisional.p2.metadata.*;
import org.eclipse.equinox.p2.metadata.*;
@@ -40,7 +40,7 @@ public class InstallableUnit implements IInstallableUnit {
private boolean singleton;
- private ArrayList touchpointData = null;
+ private ITouchpointData[] touchpointData = NO_TOUCHPOINT_DATA;
private ITouchpointType touchpointType;
@@ -55,26 +55,22 @@ public class InstallableUnit implements IInstallableUnit {
}
public void addTouchpointData(ITouchpointData newData) {
- ensureTouchpointDataCapacity(1);
- touchpointData.add(newData);
- }
-
- public int compareTo(Object toCompareTo) {
- if (!(toCompareTo instanceof IInstallableUnit)) {
- return -1;
+ int tl = touchpointData.length;
+ if (tl == 0)
+ touchpointData = new ITouchpointData[] {newData};
+ else {
+ ITouchpointData[] newDatas = new ITouchpointData[tl + 1];
+ System.arraycopy(touchpointData, 0, newDatas, 0, tl);
+ newDatas[tl] = newData;
+ touchpointData = newDatas;
}
- IInstallableUnit other = (IInstallableUnit) toCompareTo;
- if (getId().compareTo(other.getId()) == 0)
- return (getVersion().compareTo(other.getVersion()));
- return getId().compareTo(other.getId());
}
- private void ensureTouchpointDataCapacity(int size) {
- if (touchpointData != null) {
- touchpointData.ensureCapacity(size);
- } else {
- touchpointData = new ArrayList(size);
- }
+ public int compareTo(IInstallableUnit other) {
+ int cmp = getId().compareTo(other.getId());
+ if (cmp == 0)
+ cmp = getVersion().compareTo(other.getVersion());
+ return cmp;
}
public boolean equals(Object obj) {
@@ -98,16 +94,16 @@ public class InstallableUnit implements IInstallableUnit {
return true;
}
- public IArtifactKey[] getArtifacts() {
- return artifacts;
+ public List<IArtifactKey> getArtifacts() {
+ return CollectionUtils.unmodifiableList(artifacts);
}
- public IQuery getFilter() {
+ public IQuery<Boolean> getFilter() {
return filter;
}
- public IInstallableUnitFragment[] getFragments() {
- return null;
+ public List<IInstallableUnitFragment> getFragments() {
+ return Collections.emptyList();
}
public String getId() {
@@ -120,7 +116,7 @@ public class InstallableUnit implements IInstallableUnit {
*
* @return an <i>unmodifiable copy</i> of the IU properties.
*/
- public Map getProperties() {
+ public Map<String, String> getProperties() {
return OrderedProperties.unmodifiableProperties(properties());
}
@@ -138,22 +134,21 @@ public class InstallableUnit implements IInstallableUnit {
return properties().getProperty(key);
}
- public String getProperty(String key, String locale) {
- return TranslationSupport.getInstance().getIUProperty(this, key, locale);
+ public List<IProvidedCapability> getProvidedCapabilities() {
+ return CollectionUtils.unmodifiableList(providedCapabilities);
}
- public IProvidedCapability[] getProvidedCapabilities() {
- return providedCapabilities;
+ public String getProperty(String key, String locale) {
+ return TranslationSupport.getInstance().getIUProperty(this, key, locale);
}
- public IRequirement[] getRequiredCapabilities() {
- return requires;
+ public List<IRequirement> getRequiredCapabilities() {
+ return CollectionUtils.unmodifiableList(requires);
}
- public ITouchpointData[] getTouchpointData() {
- return (touchpointData == null ? NO_TOUCHPOINT_DATA //
- : (ITouchpointData[]) touchpointData.toArray(new ITouchpointData[touchpointData.size()]));
+ public List<ITouchpointData> getTouchpointData() {
+ return CollectionUtils.unmodifiableList(touchpointData);
}
public ITouchpointType getTouchpointType() {
@@ -213,7 +208,7 @@ public class InstallableUnit implements IInstallableUnit {
public String setLocalizedProperty(String key, String value) {
if (localizedProperties == null)
localizedProperties = new OrderedProperties();
- return (String) localizedProperties.put(key, value);
+ return localizedProperties.put(key, value);
}
public String setProperty(String key, String value) {
@@ -229,7 +224,7 @@ public class InstallableUnit implements IInstallableUnit {
this.requires = NO_REQUIRES;
} else {
//copy array for safety
- this.requires = (IRequirement[]) capabilities.clone();
+ this.requires = capabilities.clone();
}
}
@@ -265,8 +260,8 @@ public class InstallableUnit implements IInstallableUnit {
this.licenses = license == null ? NO_LICENSE : license;
}
- public ILicense[] getLicenses() {
- return licenses;
+ public List<ILicense> getLicenses() {
+ return CollectionUtils.unmodifiableList(licenses);
}
public ILicense[] getLicenses(String locale) {
@@ -297,8 +292,8 @@ public class InstallableUnit implements IInstallableUnit {
return false;
}
- public IRequirement[] getMetaRequiredCapabilities() {
- return metaRequires;
+ public List<IRequirement> getMetaRequiredCapabilities() {
+ return CollectionUtils.unmodifiableList(metaRequires);
}
public void setMetaRequiredCapabilities(IRequirement[] metaReqs) {
@@ -306,7 +301,7 @@ public class InstallableUnit implements IInstallableUnit {
this.metaRequires = NO_REQUIRES;
} else {
//copy array for safety
- this.metaRequires = (IRequirement[]) metaReqs.clone();
+ this.metaRequires = metaReqs.clone();
}
}
}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/InstallableUnitFragment.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/InstallableUnitFragment.java
index 41b76cc93..823db16e2 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/InstallableUnitFragment.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/InstallableUnitFragment.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.metadata;
+import java.util.List;
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnitFragment;
import org.eclipse.equinox.p2.metadata.IRequirement;
@@ -29,10 +30,12 @@ public class InstallableUnitFragment extends InstallableUnit implements IInstall
}
private void addRequiredCapability(IRequirement[] toAdd) {
- IRequirement[] current = super.getRequiredCapabilities();
- IRequirement[] result = new IRequirement[current.length + toAdd.length];
- System.arraycopy(current, 0, result, 0, current.length);
- System.arraycopy(toAdd, 0, result, current.length, toAdd.length);
+ List<IRequirement> current = super.getRequiredCapabilities();
+ int currSize = current.size();
+ IRequirement[] result = new IRequirement[currSize + toAdd.length];
+ for (int i = 0; i < currSize; ++i)
+ result[i] = current.get(i);
+ System.arraycopy(toAdd, 0, result, current.size(), toAdd.length);
setRequiredCapabilities(result);
}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/InstallableUnitPatch.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/InstallableUnitPatch.java
index 27fd6071d..cd962d4ca 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/InstallableUnitPatch.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/InstallableUnitPatch.java
@@ -8,6 +8,8 @@
******************************************************************************/
package org.eclipse.equinox.internal.p2.metadata;
+import java.util.List;
+import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils;
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnitPatch;
import org.eclipse.equinox.internal.provisional.p2.metadata.IRequirementChange;
import org.eclipse.equinox.p2.metadata.IRequirement;
@@ -18,10 +20,12 @@ public class InstallableUnitPatch extends InstallableUnit implements IInstallabl
private IRequirement[][] scope;
private void addRequiredCapability(IRequirement[] toAdd) {
- IRequirement[] current = super.getRequiredCapabilities();
- IRequirement[] result = new IRequirement[current.length + toAdd.length];
- System.arraycopy(current, 0, result, 0, current.length);
- System.arraycopy(toAdd, 0, result, current.length, toAdd.length);
+ List<IRequirement> current = super.getRequiredCapabilities();
+ int currSize = current.size();
+ IRequirement[] result = new IRequirement[currSize + toAdd.length];
+ for (int i = 0; i < currSize; ++i)
+ result[i] = current.get(i);
+ System.arraycopy(toAdd, 0, result, current.size(), toAdd.length);
setRequiredCapabilities(result);
}
@@ -33,8 +37,8 @@ public class InstallableUnitPatch extends InstallableUnit implements IInstallabl
return lifeCycle;
}
- public IRequirementChange[] getRequirementsChange() {
- return changes;
+ public List<IRequirementChange> getRequirementsChange() {
+ return CollectionUtils.unmodifiableList(changes);
}
public void setApplicabilityScope(IRequirement[][] applyTo) {
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/LDAPQuery.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/LDAPQuery.java
index 2e2a99dbc..6596b4fff 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/LDAPQuery.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/LDAPQuery.java
@@ -4,7 +4,7 @@ import java.util.Iterator;
import org.eclipse.equinox.p2.metadata.query.IQuery;
import org.eclipse.equinox.p2.metadata.query.IQueryResult;
-public class LDAPQuery implements IQuery {
+public class LDAPQuery implements IQuery<Boolean> {
private String filter;
public LDAPQuery(String filter) {
@@ -15,7 +15,7 @@ public class LDAPQuery implements IQuery {
return filter;
}
- public IQueryResult perform(Iterator iterator) {
+ public IQueryResult<Boolean> perform(Iterator<Boolean> iterator) {
throw new IllegalStateException();
}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/OSGiVersion.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/OSGiVersion.java
index 3369d8621..78deee9a7 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/OSGiVersion.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/OSGiVersion.java
@@ -11,6 +11,7 @@
package org.eclipse.equinox.internal.p2.metadata;
import org.eclipse.equinox.internal.provisional.p2.metadata.IVersionFormat;
+import org.eclipse.equinox.internal.provisional.p2.metadata.Version;
import org.eclipse.osgi.util.NLS;
/**
@@ -29,7 +30,7 @@ public class OSGiVersion extends BasicVersion {
private final int micro;
- private final Comparable qualifier;
+ private final Comparable<?> qualifier;
static {
allowedOSGiChars = new boolean[128];
@@ -43,7 +44,7 @@ public class OSGiVersion extends BasicVersion {
allowedOSGiChars['-'] = true;
}
- public static boolean isValidOSGiQualifier(Comparable e) {
+ public static boolean isValidOSGiQualifier(Comparable<?> e) {
if (e == VersionVector.MAXS_VALUE)
return true;
@@ -61,7 +62,7 @@ public class OSGiVersion extends BasicVersion {
return true;
}
- static BasicVersion fromVector(Comparable[] vector, Comparable pad) {
+ static BasicVersion fromVector(Comparable<?>[] vector, Comparable<? extends Object> pad) {
if (vector.length != 4) {
if (vector.length == 0) {
if (pad == null)
@@ -74,11 +75,11 @@ public class OSGiVersion extends BasicVersion {
int major = ((Integer) vector[0]).intValue();
int minor = ((Integer) vector[1]).intValue();
int micro = ((Integer) vector[2]).intValue();
- Comparable qualifier = vector[3];
+ Comparable<?> qualifier = vector[3];
return (major == 0 && minor == 0 && micro == 0 && qualifier == VersionVector.MINS_VALUE) ? (BasicVersion) emptyVersion : new OSGiVersion(major, minor, micro, qualifier);
}
- public OSGiVersion(int major, int minor, int micro, Comparable qualifier) {
+ public OSGiVersion(int major, int minor, int micro, Comparable<? extends Object> qualifier) {
this.major = major;
this.minor = minor;
this.micro = micro;
@@ -87,7 +88,7 @@ public class OSGiVersion extends BasicVersion {
this.qualifier = qualifier;
}
- public int compareTo(Object v) {
+ public int compareTo(Version v) {
int result;
if (!(v instanceof OSGiVersion)) {
BasicVersion ov = (BasicVersion) v;
@@ -100,7 +101,7 @@ public class OSGiVersion extends BasicVersion {
if (result == 0) {
result = micro - ov.micro;
if (result == 0)
- result = qualifier.compareTo(ov.qualifier);
+ result = VersionVector.compareSegments(qualifier, ov.qualifier);
}
}
}
@@ -183,15 +184,15 @@ public class OSGiVersion extends BasicVersion {
}
}
- public Comparable[] getVector() {
+ public Comparable<?>[] getVector() {
return new Comparable[] {VersionParser.valueOf(major), VersionParser.valueOf(minor), VersionParser.valueOf(micro), qualifier};
}
- public Comparable getPad() {
+ public Comparable<?> getPad() {
return null;
}
- public Comparable getSegment(int index) {
+ public Comparable<?> getSegment(int index) {
switch (index) {
case 0 :
return VersionParser.valueOf(major);
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/OmniVersion.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/OmniVersion.java
index 2723c9be3..d58c0b6ae 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/OmniVersion.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/OmniVersion.java
@@ -35,9 +35,9 @@ public class OmniVersion extends BasicVersion {
private static OmniVersion maximumVersion;
- private final Comparable[] vector;
+ private final Comparable<?>[] vector;
- private final Comparable padValue;
+ private final Comparable<?> padValue;
/**
* The optional format
@@ -49,7 +49,7 @@ public class OmniVersion extends BasicVersion {
*/
private final String original;
- static BasicVersion fromVector(Comparable[] vector, Comparable padValue, IVersionFormat format, String original) {
+ static BasicVersion fromVector(Comparable<?>[] vector, Comparable<?> padValue, IVersionFormat format, String original) {
if (vector.length == 0) {
if (padValue == null)
return (BasicVersion) emptyVersion;
@@ -74,7 +74,7 @@ public class OmniVersion extends BasicVersion {
return maximumVersion;
}
- private OmniVersion(Comparable[] array, Comparable padValue, IVersionFormat format, String original) {
+ private OmniVersion(Comparable<?>[] array, Comparable<?> padValue, IVersionFormat format, String original) {
this.vector = array;
this.padValue = padValue;
this.format = format;
@@ -119,7 +119,7 @@ public class OmniVersion extends BasicVersion {
if (vector.length != 4)
throw new UnsupportedOperationException();
- Comparable qualifier = vector[3];
+ Comparable<?> qualifier = vector[3];
if (qualifier == VersionVector.MAXS_VALUE)
return IVersionFormat.DEFAULT_MAX_STRING_TRANSLATION;
if (!(qualifier instanceof String))
@@ -224,11 +224,11 @@ public class OmniVersion extends BasicVersion {
return v;
}
- public Comparable getPad() {
+ public Comparable<?> getPad() {
return padValue;
}
- public Comparable getSegment(int index) {
+ public Comparable<?> getSegment(int index) {
return vector[index];
}
@@ -236,11 +236,11 @@ public class OmniVersion extends BasicVersion {
return vector.length;
}
- Comparable[] getVector() {
+ Comparable<?>[] getVector() {
return vector;
}
- public int compareTo(Object v) {
+ public int compareTo(Version v) {
BasicVersion ov = (BasicVersion) v;
return VersionVector.compare(vector, padValue, ov.getVector(), ov.getPad());
}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/RequiredCapability.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/RequiredCapability.java
index b0e2fa9de..9f6068ac6 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/RequiredCapability.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/RequiredCapability.java
@@ -32,7 +32,7 @@ import org.eclipse.equinox.p2.metadata.query.IQuery;
*
* @see IInstallableUnit#NAMESPACE_IU_ID
*/
-public class RequiredCapability extends MatchQuery implements IRequiredCapability, IRequirement {
+public class RequiredCapability extends MatchQuery<IInstallableUnit> implements IRequiredCapability, IRequirement {
private LDAPQuery filter;
private final String name;//never null
private final String namespace;//never null
@@ -55,7 +55,7 @@ public class RequiredCapability extends MatchQuery implements IRequiredCapabilit
setFilter(filter);
}
- public RequiredCapability(String namespace, String name, VersionRange range, IQuery filter, int min, int max, boolean greedy) {
+ public RequiredCapability(String namespace, String name, VersionRange range, IQuery<Boolean> filter, int min, int max, boolean greedy) {
Assert.isNotNull(namespace);
Assert.isNotNull(name);
this.namespace = namespace;
@@ -186,19 +186,16 @@ public class RequiredCapability extends MatchQuery implements IRequiredCapabilit
return max;
}
- public IQuery getMatches() {
+ public IQuery<IInstallableUnit> getMatches() {
return this;
}
- public IQuery getFilter() {
+ public IQuery<Boolean> getFilter() {
return filter;
}
- public boolean isMatch(Object object) {
- if (!(object instanceof IInstallableUnit))
- return false;
- IInstallableUnit candidate = (IInstallableUnit) object;
- if (!candidate.satisfies((IRequirement) this))
+ public boolean isMatch(IInstallableUnit candidate) {
+ if (!candidate.satisfies(this))
return false;
return true;
}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/ResolvedInstallableUnit.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/ResolvedInstallableUnit.java
index 7a98558ff..d4e25c330 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/ResolvedInstallableUnit.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/ResolvedInstallableUnit.java
@@ -17,37 +17,40 @@ import org.eclipse.equinox.p2.metadata.*;
import org.eclipse.equinox.p2.metadata.query.IQuery;
public class ResolvedInstallableUnit implements IInstallableUnit {
- private static IInstallableUnit[] NO_IU = new IInstallableUnit[0];
+ private static IInstallableUnitFragment[] NO_IU = new IInstallableUnitFragment[0];
- private IInstallableUnit[] fragments = NO_IU;
- protected IInstallableUnit original;
+ private final IInstallableUnitFragment[] fragments;
+ protected final IInstallableUnit original;
public ResolvedInstallableUnit(IInstallableUnit resolved) {
- this.original = resolved;
+ this(resolved, null);
}
public ResolvedInstallableUnit(IInstallableUnit resolved, IInstallableUnitFragment[] fragments) {
this.original = resolved;
- this.fragments = fragments;
+ this.fragments = fragments == null ? NO_IU : fragments;
}
- public IInstallableUnitFragment[] getFragments() {
- ArrayList result = new ArrayList();
- if (fragments != null)
- result.addAll(Arrays.asList(fragments));
- for (int i = 0; i < result.size(); i++) {
- IInstallableUnit fragment = (IInstallableUnit) result.get(i);
+ public List<IInstallableUnitFragment> getFragments() {
+ int fcount = fragments.length;
+ if (fcount == 0)
+ return Collections.emptyList();
+
+ ArrayList<IInstallableUnitFragment> result = new ArrayList<IInstallableUnitFragment>(fcount);
+ result.addAll(Arrays.asList(fragments));
+ for (int i = 0; i < fcount; i++) {
+ IInstallableUnit fragment = fragments[i];
if (fragment.isResolved())
- result.addAll(Arrays.asList(fragment.getFragments()));
+ result.addAll(fragment.getFragments());
}
- return (IInstallableUnitFragment[]) result.toArray(new IInstallableUnitFragment[result.size()]);
+ return result;
}
- public IArtifactKey[] getArtifacts() {
+ public List<IArtifactKey> getArtifacts() {
return original.getArtifacts();
}
- public IQuery getFilter() {
+ public IQuery<Boolean> getFilter() {
return original.getFilter();
}
@@ -59,51 +62,56 @@ public class ResolvedInstallableUnit implements IInstallableUnit {
return original.getProperty(key);
}
+ public Map<String, String> getProperties() {
+ return original.getProperties();
+ }
+
public String getProperty(String key, String locale) {
return original.getProperty(key, locale);
}
- public Map getProperties() {
- return original.getProperties();
- }
+ public List<IProvidedCapability> getProvidedCapabilities() {
+ List<IProvidedCapability> originalCapabilities = original.getProvidedCapabilities();
+ if (fragments.length == 0)
+ return originalCapabilities;
- public IProvidedCapability[] getProvidedCapabilities() {
- ArrayList result = new ArrayList();
- result.addAll(Arrays.asList(original.getProvidedCapabilities()));
- for (int i = 0; i < fragments.length; i++) {
- result.addAll(Arrays.asList(fragments[i].getProvidedCapabilities()));
- }
- return (IProvidedCapability[]) result.toArray(new IProvidedCapability[result.size()]);
+ ArrayList<IProvidedCapability> result = new ArrayList<IProvidedCapability>(originalCapabilities);
+ for (int i = 0; i < fragments.length; i++)
+ result.addAll(fragments[i].getProvidedCapabilities());
+ return result;
}
- public IRequirement[] getRequiredCapabilities() {
- ArrayList result = new ArrayList();
- result.addAll(Arrays.asList(original.getRequiredCapabilities()));
- for (int i = 0; i < fragments.length; i++) {
- result.addAll(Arrays.asList(fragments[i].getRequiredCapabilities()));
- }
- return (IRequirement[]) result.toArray(new IRequirement[result.size()]);
+ public List<IRequirement> getRequiredCapabilities() {
+ List<IRequirement> originalCapabilities = original.getRequiredCapabilities();
+ if (fragments.length == 0)
+ return originalCapabilities;
+
+ ArrayList<IRequirement> result = new ArrayList<IRequirement>(originalCapabilities);
+ for (int i = 0; i < fragments.length; i++)
+ result.addAll(fragments[i].getRequiredCapabilities());
+ return result;
}
- public IRequirement[] getMetaRequiredCapabilities() {
- ArrayList result = new ArrayList();
- result.addAll(Arrays.asList(original.getMetaRequiredCapabilities()));
- for (int i = 0; i < fragments.length; i++) {
- result.addAll(Arrays.asList(fragments[i].getMetaRequiredCapabilities()));
- }
- return (IRequirement[]) result.toArray(new IRequirement[result.size()]);
+ public List<IRequirement> getMetaRequiredCapabilities() {
+ List<IRequirement> originalCapabilities = original.getMetaRequiredCapabilities();
+ if (fragments.length == 0)
+ return originalCapabilities;
+
+ ArrayList<IRequirement> result = new ArrayList<IRequirement>(originalCapabilities);
+ for (int i = 0; i < fragments.length; i++)
+ result.addAll(fragments[i].getMetaRequiredCapabilities());
+ return result;
}
- public ITouchpointData[] getTouchpointData() {
- ArrayList result = new ArrayList();
- result.addAll(Arrays.asList(original.getTouchpointData()));
- for (int i = 0; i < fragments.length; i++) {
- ITouchpointData[] data = fragments[i].getTouchpointData();
- for (int j = 0; j < data.length; j++) {
- result.add(data[j]);
- }
- }
- return (ITouchpointData[]) result.toArray(new ITouchpointData[result.size()]);
+ public List<ITouchpointData> getTouchpointData() {
+ List<ITouchpointData> originalTouchpointData = original.getTouchpointData();
+ if (fragments.length == 0)
+ return originalTouchpointData;
+
+ ArrayList<ITouchpointData> result = new ArrayList<ITouchpointData>(originalTouchpointData);
+ for (int i = 0; i < fragments.length; i++)
+ result.addAll(fragments[i].getTouchpointData());
+ return result;
}
public ITouchpointType getTouchpointType() {
@@ -141,14 +149,11 @@ public class ResolvedInstallableUnit implements IInstallableUnit {
return original;
}
- 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 int compareTo(IInstallableUnit other) {
+ int cmp = getId().compareTo(other.getId());
+ if (cmp == 0)
+ cmp = getVersion().compareTo(other.getVersion());
+ return cmp;
}
public boolean isResolved() {
@@ -163,7 +168,7 @@ public class ResolvedInstallableUnit implements IInstallableUnit {
return original.getUpdateDescriptor();
}
- public ILicense[] getLicenses() {
+ public List<ILicense> getLicenses() {
return original.getLicenses();
}
@@ -180,9 +185,10 @@ public class ResolvedInstallableUnit implements IInstallableUnit {
}
public boolean satisfies(IRequirement candidate) {
- IProvidedCapability[] provides = getProvidedCapabilities();
- for (int i = 0; i < provides.length; i++)
- if (provides[i].satisfies(candidate))
+ List<IProvidedCapability> provides = getProvidedCapabilities();
+ int top = provides.size();
+ for (int i = 0; i < top; i++)
+ if (provides.get(i).satisfies(candidate))
return true;
return false;
}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/TouchpointData.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/TouchpointData.java
index 9ea83d479..1ba1abb20 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/TouchpointData.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/TouchpointData.java
@@ -31,7 +31,7 @@ public class TouchpointData implements ITouchpointData {
* of keys supported is up to the touchpoint that will process these
* instructions. This map is never null.
*/
- private Map instructions;
+ private Map<String, ITouchpointInstruction> instructions;
public int hashCode() {
return 31 * 1 + ((instructions == null) ? 0 : instructions.hashCode());
@@ -56,7 +56,7 @@ public class TouchpointData implements ITouchpointData {
/**
* Clients must use the factory method on {@link MetadataFactory}.
*/
- public TouchpointData(Map instructions) {
+ public TouchpointData(Map<String, ITouchpointInstruction> instructions) {
this.instructions = instructions;
}
@@ -64,7 +64,7 @@ public class TouchpointData implements ITouchpointData {
* Returns the touchpoint instruction corresponding to the given key.
*/
public ITouchpointInstruction getInstruction(String instructionKey) {
- return (ITouchpointInstruction) instructions.get(instructionKey);
+ return instructions.get(instructionKey);
}
/**
@@ -73,7 +73,7 @@ public class TouchpointData implements ITouchpointData {
*
* @return the touchpoint instructions
*/
- public Map getInstructions() {
+ public Map<String, ITouchpointInstruction> getInstructions() {
return Collections.unmodifiableMap(instructions);
}
@@ -82,8 +82,8 @@ public class TouchpointData implements ITouchpointData {
*/
public String toString() {
StringBuffer result = new StringBuffer();
- for (Iterator iterator = instructions.entrySet().iterator(); iterator.hasNext();) {
- Entry instruction = (Entry) iterator.next();
+ for (Iterator<Entry<String, ITouchpointInstruction>> iterator = instructions.entrySet().iterator(); iterator.hasNext();) {
+ Entry<String, ITouchpointInstruction> instruction = iterator.next();
result.append(instruction.getKey()).append(" -> ").append(instruction.getValue()).append('\n'); //$NON-NLS-1$
}
return result.toString();
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/TouchpointInstruction.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/TouchpointInstruction.java
index e59e9beea..1a7879389 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/TouchpointInstruction.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/TouchpointInstruction.java
@@ -13,6 +13,7 @@ package org.eclipse.equinox.internal.p2.metadata;
import java.util.Iterator;
import java.util.Map;
+import java.util.Map.Entry;
import org.eclipse.equinox.internal.provisional.p2.metadata.ITouchpointInstruction;
import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory;
@@ -65,14 +66,14 @@ public class TouchpointInstruction implements ITouchpointInstruction {
* where the keys are parameter names, and the values are parameter values
* @return An encoded touchpoint instruction statement
*/
- public static String encodeAction(String actionName, Map parameters) {
+ public static String encodeAction(String actionName, Map<String, String> parameters) {
StringBuffer result = new StringBuffer(actionName);
result.append('(');
- for (Iterator it = parameters.entrySet().iterator(); it.hasNext();) {
- Map.Entry entry = (Map.Entry) it.next();
+ for (Iterator<Entry<String, String>> it = parameters.entrySet().iterator(); it.hasNext();) {
+ Entry<String, String> entry = it.next();
result.append(entry.getKey());
result.append(':');
- appendEncoded(result, (String) entry.getValue());
+ appendEncoded(result, entry.getValue());
if (it.hasNext())
result.append(',');
}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/TranslationSupport.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/TranslationSupport.java
index 9c6a0ca9f..bdfade4d1 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/TranslationSupport.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/TranslationSupport.java
@@ -36,11 +36,11 @@ public class TranslationSupport {
private static TranslationSupport instance;
static final String NAMESPACE_IU_LOCALIZATION = "org.eclipse.equinox.p2.localization"; //$NON-NLS-1$
- private IQueryable fragmentSource;
+ private IQueryable<IInstallableUnit> fragmentSource;
// Cache the IU fragments that provide localizations for a given locale.
// Map<String,SoftReference<IQueryResult>>: locale => soft reference to a queryResult
- private Map localeCollectorCache = new HashMap(2);
+ private Map<String, SoftReference<IQueryResult<IInstallableUnit>>> localeCollectorCache = new HashMap<String, SoftReference<IQueryResult<IInstallableUnit>>>(2);
private LocaleProvider localeProvider;
@@ -57,15 +57,15 @@ public class TranslationSupport {
*
* @since 2.0
*/
- private TranslationSupport() {
+ protected TranslationSupport() {
super();
//no instantiate
}
/**
*/
- private List buildLocaleVariants(String locale) {
- ArrayList result = new ArrayList(4);
+ private List<String> buildLocaleVariants(String locale) {
+ ArrayList<String> result = new ArrayList<String>(4);
int lastSeparator;
while (true) {
result.add(locale);
@@ -156,10 +156,10 @@ public class TranslationSupport {
public ILicense[] getLicenses(IInstallableUnit iu, String locale) {
if (locale == null)
locale = getCurrentLocale();
- ILicense[] licenses = iu.getLicenses();
- ILicense[] translatedLicenses = new ILicense[licenses.length];
- for (int i = 0; i < licenses.length; i++) {
- translatedLicenses[i] = getLicense(iu, licenses[i], locale);
+ List<ILicense> licenses = iu.getLicenses();
+ ILicense[] translatedLicenses = new ILicense[licenses.size()];
+ for (int i = 0; i < licenses.size(); i++) {
+ translatedLicenses[i] = getLicense(iu, licenses.get(i), locale);
}
return translatedLicenses;
}
@@ -167,29 +167,30 @@ public class TranslationSupport {
/**
* Collects the installable unit fragments that contain locale data for the given locales.
*/
- private synchronized IQueryResult getLocalizationFragments(List localeVariants, String locale) {
+ private synchronized IQueryResult<IInstallableUnit> getLocalizationFragments(List<String> localeVariants, String locale) {
if (fragmentSource == null) {
LogHelper.log(new Status(IStatus.ERROR, MetadataActivator.PI_METADATA, "Profile registry unavailable. Default language will be used.", new RuntimeException())); //$NON-NLS-1$
- return Collector.EMPTY_COLLECTOR;
+ return Collector.emptyCollector();
}
- SoftReference queryResultReference = (SoftReference) localeCollectorCache.get(locale);
+ SoftReference<IQueryResult<IInstallableUnit>> queryResultReference = localeCollectorCache.get(locale);
if (queryResultReference != null) {
- Collector cached = (Collector) queryResultReference.get();
+ Collector<IInstallableUnit> cached = (Collector<IInstallableUnit>) queryResultReference.get();
if (cached != null)
return cached;
}
- final List locales = localeVariants;
+ final List<String> locales = localeVariants;
- IQuery[] localeQuery = new IQuery[locales.size()];
+ @SuppressWarnings("unchecked")
+ IQuery<IInstallableUnit>[] localeQuery = new IQuery[locales.size()];
for (int j = 0; j < locales.size(); j++) {
- localeQuery[j] = new RequiredCapability(NAMESPACE_IU_LOCALIZATION, (String) locales.get(j), VersionRange.emptyRange, null, false, false);
+ localeQuery[j] = new RequiredCapability(NAMESPACE_IU_LOCALIZATION, locales.get(j), VersionRange.emptyRange, null, false, false);
}
- IQuery iuQuery = new PipedQuery(new IQuery[] {new FragmentQuery(), CompoundQuery.createCompoundQuery(localeQuery, false)});
- IQueryResult collected = fragmentSource.query(iuQuery, null);
- localeCollectorCache.put(locale, new SoftReference(collected));
+ IQuery<IInstallableUnit> iuQuery = new PipedQuery<IInstallableUnit>(new FragmentQuery(), CompoundQuery.createCompoundQuery(localeQuery, false));
+ IQueryResult<IInstallableUnit> collected = fragmentSource.query(iuQuery, null);
+ localeCollectorCache.put(locale, new SoftReference<IQueryResult<IInstallableUnit>>(collected));
return collected;
}
@@ -206,13 +207,13 @@ public class TranslationSupport {
if (localizedValue != null)
return localizedValue;
- final List locales = buildLocaleVariants(locale);
+ final List<String> locales = buildLocaleVariants(locale);
final IInstallableUnit theUnit = iu;
- IQueryResult localizationFragments = getLocalizationFragments(locales, locale);
+ IQueryResult<IInstallableUnit> localizationFragments = getLocalizationFragments(locales, locale);
- MatchQuery hostLocalizationQuery = new MatchQuery() {
- public boolean isMatch(Object object) {
+ IQuery<IInstallableUnit> hostLocalizationQuery = new MatchQuery<IInstallableUnit>() {
+ public boolean isMatch(IInstallableUnit object) {
boolean haveHost = false;
if (object instanceof IInstallableUnitFragment) {
IInstallableUnitFragment fragment = (IInstallableUnitFragment) object;
@@ -228,14 +229,14 @@ public class TranslationSupport {
}
};
- IQuery iuQuery = new PipedQuery(new IQuery[] {new FragmentQuery(), hostLocalizationQuery});
- IQueryResult collected = iuQuery.perform(localizationFragments.iterator());
+ IQuery<IInstallableUnit> iuQuery = new PipedQuery<IInstallableUnit>(new FragmentQuery(), hostLocalizationQuery);
+ IQueryResult<IInstallableUnit> collected = iuQuery.perform(localizationFragments.iterator());
if (!collected.isEmpty()) {
String translation = null;
- for (Iterator iter = collected.iterator(); iter.hasNext() && translation == null;) {
- IInstallableUnit localizationIU = (IInstallableUnit) iter.next();
- for (Iterator jter = locales.iterator(); jter.hasNext();) {
- String localeKey = makeLocalizedKey(actualKey, (String) jter.next());
+ for (Iterator<IInstallableUnit> iter = collected.iterator(); iter.hasNext() && translation == null;) {
+ IInstallableUnit localizationIU = iter.next();
+ for (Iterator<String> jter = locales.iterator(); jter.hasNext();) {
+ String localeKey = makeLocalizedKey(actualKey, jter.next());
translation = localizationIU.getProperty(localeKey);
if (translation != null)
return cacheResult(iu, localizedKey, translation);
@@ -243,8 +244,8 @@ public class TranslationSupport {
}
}
- for (Iterator iter = locales.iterator(); iter.hasNext();) {
- String nextLocale = (String) iter.next();
+ for (Iterator<String> iter = locales.iterator(); iter.hasNext();) {
+ String nextLocale = iter.next();
String localeKey = makeLocalizedKey(actualKey, nextLocale);
String nextValue = iu.getProperty(localeKey);
if (nextValue != null)
@@ -273,8 +274,8 @@ public class TranslationSupport {
* @param queryable an {@link IQueryable} that can supply the appropriate NLS
* translation fragments
*/
- public IQueryable setTranslationSource(IQueryable queryable) {
- IQueryable previous = fragmentSource;
+ public IQueryable<IInstallableUnit> setTranslationSource(IQueryable<IInstallableUnit> queryable) {
+ IQueryable<IInstallableUnit> previous = fragmentSource;
this.fragmentSource = queryable;
return previous;
}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/VersionFormat.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/VersionFormat.java
index 50faa7a1c..ab779e147 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/VersionFormat.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/VersionFormat.java
@@ -39,22 +39,22 @@ public class VersionFormat implements IVersionFormat, Serializable {
private static final long serialVersionUID = -5689435955091405520L;
- static class TreeInfo extends ArrayList {
- private static final long serialVersionUID = 4474591345244587260L;
-
- private static class StateInfo {
- Fragment fragment;
- int position;
- int segmentCount;
-
- StateInfo(int position, int segmentCount, Fragment fragment) {
- this.fragment = fragment;
- this.position = position;
- this.segmentCount = segmentCount;
- }
+ private static class StateInfo {
+ Fragment fragment;
+ int position;
+ int segmentCount;
+
+ StateInfo(int position, int segmentCount, Fragment fragment) {
+ this.fragment = fragment;
+ this.position = position;
+ this.segmentCount = segmentCount;
}
+ }
+
+ static class TreeInfo extends ArrayList<StateInfo> {
+ private static final long serialVersionUID = 4474591345244587260L;
- private Comparable padValue;
+ private Comparable<?> padValue;
private int top;
TreeInfo(Fragment frag, int pos) {
@@ -62,18 +62,18 @@ public class VersionFormat implements IVersionFormat, Serializable {
top = 0;
}
- Comparable getPadValue() {
+ Comparable<?> getPadValue() {
return padValue;
}
int getPosition() {
- return ((StateInfo) get(top)).position;
+ return get(top).position;
}
- void popState(List segments, Fragment frag) {
+ void popState(List<Comparable<?>> segments, Fragment frag) {
int idx = top;
while (idx > 0) {
- StateInfo si = (StateInfo) get(idx);
+ StateInfo si = get(idx);
if (si.fragment == frag) {
int nsegs = segments.size();
int segMax = si.segmentCount;
@@ -86,27 +86,27 @@ public class VersionFormat implements IVersionFormat, Serializable {
}
void pushState(int segCount, Fragment fragment) {
- int pos = ((StateInfo) get(top)).position;
+ int pos = get(top).position;
if (++top == size())
add(new StateInfo(pos, segCount, fragment));
else {
- StateInfo si = (StateInfo) get(top);
+ StateInfo si = get(top);
si.fragment = fragment;
si.position = pos;
si.segmentCount = segCount;
}
}
- void setPadValue(Comparable pad) {
+ void setPadValue(Comparable<?> pad) {
padValue = pad;
}
void setPosition(int pos) {
- ((StateInfo) get(top)).position = pos;
+ get(top).position = pos;
}
}
- private static final Map formatCache = Collections.synchronizedMap(new HashMap());
+ private static final Map<String, VersionFormat> formatCache = Collections.synchronizedMap(new HashMap<String, VersionFormat>());
/**
* The predefined OSGi format that is used when parsing OSGi
@@ -162,7 +162,7 @@ public class VersionFormat implements IVersionFormat, Serializable {
public static VersionFormat compile(String format, int start, int end) throws VersionFormatException {
String fmtString = format.substring(start, end).intern();
synchronized (fmtString) {
- VersionFormat fmt = (VersionFormat) formatCache.get(fmtString);
+ VersionFormat fmt = formatCache.get(fmtString);
if (fmt == null) {
VersionFormatParser parser = new VersionFormatParser();
fmt = new VersionFormat(parser.compile(format, start, end));
@@ -182,13 +182,13 @@ public class VersionFormat implements IVersionFormat, Serializable {
* @throws IllegalArgumentException If the version string could not be parsed.
*/
public static BasicVersion parseRaw(String version, IVersionFormat originalFormat, String original) {
- Comparable[] padReturn = new Comparable[1];
- Comparable[] vector = RAW_FORMAT.parse(version, 0, version.length(), padReturn);
- Comparable pad = padReturn[0];
+ Comparable<?>[] padReturn = new Comparable<?>[1];
+ Comparable<?>[] vector = RAW_FORMAT.parse(version, 0, version.length(), padReturn);
+ Comparable<?> pad = padReturn[0];
return (originalFormat == OSGI_FORMAT) ? OSGiVersion.fromVector(vector, pad) : OmniVersion.fromVector(vector, pad, originalFormat, original);
}
- static void rawToString(StringBuffer sb, boolean forRange, Comparable e) {
+ static void rawToString(StringBuffer sb, boolean forRange, Comparable<?> e) {
if (e instanceof String) {
writeQuotedString(sb, forRange, (String) e, '\'', 0, false);
} else if (e instanceof VersionVector) {
@@ -262,28 +262,28 @@ public class VersionFormat implements IVersionFormat, Serializable {
}
public Version parse(String version) {
- Comparable[] padReturn = new Comparable[1];
- Comparable[] vector = parse(version, 0, version.length(), padReturn);
- Comparable pad = padReturn[0];
+ Comparable<?>[] padReturn = new Comparable<?>[1];
+ Comparable<?>[] vector = parse(version, 0, version.length(), padReturn);
+ Comparable<?> pad = padReturn[0];
return (this == OSGI_FORMAT) ? OSGiVersion.fromVector(vector, pad) : OmniVersion.fromVector(vector, pad, this, version);
}
- Comparable[] parse(String version, int start, int maxPos, Comparable[] padReturn) {
+ Comparable<?>[] parse(String version, int start, int maxPos, Comparable<?>[] padReturn) {
if (start == maxPos)
throw new IllegalArgumentException(NLS.bind(Messages.format_0_unable_to_parse_empty_version, this, version.substring(start, maxPos)));
TreeInfo info = new TreeInfo(topFragment, start);
- ArrayList entries = new ArrayList();
+ ArrayList<Comparable<?>> entries = new ArrayList<Comparable<?>>();
if (!(topFragment.parse(entries, version, maxPos, info) && info.getPosition() == maxPos))
throw new IllegalArgumentException(NLS.bind(Messages.format_0_unable_to_parse_1, this, version.substring(start, maxPos)));
padReturn[0] = VersionParser.removeRedundantTrail(entries, info.getPadValue());
- return (Comparable[]) entries.toArray(new Comparable[entries.size()]);
+ return entries.toArray(new Comparable[entries.size()]);
}
// Preserve cache during deserialization
private Object readResolve() {
synchronized (formatCache) {
String string = toString();
- VersionFormat fmt = (VersionFormat) formatCache.put(string, this);
+ VersionFormat fmt = formatCache.put(string, this);
if (fmt == null)
fmt = this;
else
@@ -333,8 +333,8 @@ class RawFormat extends VersionFormat {
* string as the original.
*/
public Version parse(String version, int start, int maxPos) {
- Comparable[] padReturn = new Comparable[1];
- Comparable[] vector = parse(version, start, maxPos, padReturn);
+ Comparable<?>[] padReturn = new Comparable<?>[1];
+ Comparable<?>[] vector = parse(version, start, maxPos, padReturn);
return OmniVersion.fromVector(vector, padReturn[0], null, null);
}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/VersionFormatParser.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/VersionFormatParser.java
index fd6795a41..e8add0af3 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/VersionFormatParser.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/VersionFormatParser.java
@@ -30,12 +30,12 @@ class VersionFormatParser {
static class Instructions {
char[] characters = null;
- Comparable defaultValue = null;
+ Comparable<?> defaultValue = null;
char oppositeTranslationChar = 0;
int oppositeTranslationRepeat = 0;
boolean ignore = false;
boolean inverted = false;
- Comparable padValue = null;
+ Comparable<?> padValue = null;
int rangeMax = Integer.MAX_VALUE;
int rangeMin = 0;
}
@@ -78,7 +78,7 @@ class VersionFormatParser {
return sb.toString();
}
- Comparable getDefaultValue() {
+ Comparable<?> getDefaultValue() {
return null;
}
@@ -86,7 +86,7 @@ class VersionFormatParser {
return this;
}
- Comparable getPadValue() {
+ Comparable<?> getPadValue() {
return null;
}
@@ -94,13 +94,13 @@ class VersionFormatParser {
return qualifier;
}
- boolean parse(List segments, String version, int maxPos, TreeInfo info) {
+ boolean parse(List<Comparable<?>> segments, String version, int maxPos, TreeInfo info) {
return qualifier.parse(new Fragment[] {this}, 0, segments, version, maxPos, info);
}
- abstract boolean parseOne(List segments, String version, int maxPos, TreeInfo info);
+ abstract boolean parseOne(List<Comparable<?>> segments, String version, int maxPos, TreeInfo info);
- void setDefaults(List segments) {
+ void setDefaults(List<Comparable<?>> segments) {
// No-op at this level
}
@@ -151,7 +151,7 @@ class VersionFormatParser {
return min;
}
- boolean parse(Fragment[] fragments, int fragIdx, List segments, String version, int maxPos, TreeInfo info) {
+ boolean parse(Fragment[] fragments, int fragIdx, List<Comparable<?>> segments, String version, int maxPos, TreeInfo info) {
Fragment fragment = fragments[fragIdx++];
int idx = 0;
@@ -186,7 +186,7 @@ class VersionFormatParser {
if (fragment instanceof StringFragment) {
// Check for translations if we default to for MINS or MAXS
StringFragment stringFrag = (StringFragment) fragment;
- Comparable opposite = stringFrag.getOppositeDefaultValue();
+ Comparable<?> opposite = stringFrag.getOppositeDefaultValue();
if (opposite != null) {
idx = segments.size() - 1;
if (stringFrag.isOppositeTranslation(segments.get(idx)))
@@ -275,7 +275,7 @@ class VersionFormatParser {
super(instr, qualifier);
}
- boolean parseOne(List segments, String version, int maxPos, TreeInfo info) {
+ boolean parseOne(List<Comparable<?>> segments, String version, int maxPos, TreeInfo info) {
int pos = info.getPosition();
maxPos = checkRange(pos, maxPos);
if (maxPos < 0)
@@ -360,7 +360,7 @@ class VersionFormatParser {
return true;
}
- boolean parseOne(List segments, String version, int maxPos, TreeInfo info) {
+ boolean parseOne(List<Comparable<?>> segments, String version, int maxPos, TreeInfo info) {
int pos = info.getPosition();
if (pos < maxPos && isMatch(version, pos)) {
// Just swallow, a delimiter does not contribute to the vector.
@@ -456,9 +456,9 @@ class VersionFormatParser {
private static abstract class ElementFragment extends Fragment {
private static final long serialVersionUID = -6834591415456539713L;
- private final Comparable defaultValue;
+ private final Comparable<?> defaultValue;
private final boolean ignored;
- private final Comparable padValue;
+ private final Comparable<?> padValue;
ElementFragment(VersionFormatParser.Instructions instr, Qualifier qualifier) {
super(qualifier);
@@ -473,11 +473,11 @@ class VersionFormatParser {
}
}
- Comparable getDefaultValue() {
+ Comparable<?> getDefaultValue() {
return defaultValue;
}
- Comparable getPadValue() {
+ Comparable<?> getPadValue() {
return padValue;
}
@@ -485,8 +485,8 @@ class VersionFormatParser {
return ignored;
}
- void setDefaults(List segments) {
- Object defaultVal = getDefaultValue();
+ void setDefaults(List<Comparable<?>> segments) {
+ Comparable<?> defaultVal = getDefaultValue();
if (defaultVal != null)
segments.add(defaultVal);
}
@@ -531,26 +531,26 @@ class VersionFormatParser {
return fragments[0].getFirstLeaf();
}
- boolean parseOne(List segments, String version, int maxPos, TreeInfo info) {
+ boolean parseOne(List<Comparable<?>> segments, String version, int maxPos, TreeInfo info) {
if (array) {
- ArrayList subSegs = new ArrayList();
+ ArrayList<Comparable<?>> subSegs = new ArrayList<Comparable<?>>();
boolean success = fragments[0].getQualifier().parse(fragments, 0, subSegs, version, maxPos, info);
if (!success || subSegs.isEmpty())
return false;
- Comparable padValue = info.getPadValue();
+ Comparable<?> padValue = info.getPadValue();
if (padValue != null)
info.setPadValue(null); // Prevent outer group from getting this.
else
padValue = getPadValue();
padValue = VersionParser.removeRedundantTrail(segments, padValue);
- segments.add(new VersionVector((Comparable[]) subSegs.toArray(new Comparable[subSegs.size()]), padValue));
+ segments.add(new VersionVector(subSegs.toArray(new Comparable[subSegs.size()]), padValue));
return true;
}
if (fragments[0].getQualifier().parse(fragments, 0, segments, version, maxPos, info)) {
- Comparable padValue = getPadValue();
+ Comparable<?> padValue = getPadValue();
if (padValue != null)
info.setPadValue(padValue);
return true;
@@ -558,8 +558,8 @@ class VersionFormatParser {
return false;
}
- void setDefaults(List segments) {
- Comparable dflt = getDefaultValue();
+ void setDefaults(List<Comparable<?>> segments) {
+ Comparable<?> dflt = getDefaultValue();
if (dflt != null) {
// A group default overrides any defaults within the
// group fragments
@@ -603,7 +603,7 @@ class VersionFormatParser {
this.string = string;
}
- boolean parseOne(List segments, String version, int maxPos, TreeInfo info) {
+ boolean parseOne(List<Comparable<?>> segments, String version, int maxPos, TreeInfo info) {
int pos = info.getPosition();
int litLen = string.length();
if (pos + litLen > maxPos)
@@ -660,7 +660,7 @@ class VersionFormatParser {
this.signed = signed;
}
- boolean parseOne(List segments, String version, int maxPos, TreeInfo info) {
+ boolean parseOne(List<Comparable<?>> segments, String version, int maxPos, TreeInfo info) {
int pos = info.getPosition();
maxPos = checkRange(pos, maxPos);
if (maxPos < 0)
@@ -733,13 +733,13 @@ class VersionFormatParser {
super(null, qualifier);
}
- boolean parseOne(List segments, String version, int maxPos, TreeInfo info) {
+ boolean parseOne(List<Comparable<?>> segments, String version, int maxPos, TreeInfo info) {
int pos = info.getPosition();
if (pos >= maxPos || version.charAt(pos) != 'p')
return false;
int[] position = new int[] {++pos};
- Comparable v = VersionParser.parseRawElement(version, position, maxPos);
+ Comparable<?> v = VersionParser.parseRawElement(version, position, maxPos);
if (v == null)
return false;
@@ -762,7 +762,7 @@ class VersionFormatParser {
super(instr, qualifier);
}
- boolean parseOne(List segments, String version, int maxPos, TreeInfo info) {
+ boolean parseOne(List<Comparable<?>> segments, String version, int maxPos, TreeInfo info) {
int pos = info.getPosition();
if (pos >= maxPos)
return false;
@@ -913,9 +913,9 @@ class VersionFormatParser {
super(processing, qualifier);
}
- boolean parseOne(List segments, String version, int maxPos, TreeInfo info) {
+ boolean parseOne(List<Comparable<?>> segments, String version, int maxPos, TreeInfo info) {
int[] position = new int[] {info.getPosition()};
- Comparable v = VersionParser.parseRawElement(version, position, maxPos);
+ Comparable<?> v = VersionParser.parseRawElement(version, position, maxPos);
if (v == null)
return false;
@@ -960,8 +960,8 @@ class VersionFormatParser {
oppositeTranslationRepeat = otr;
}
- Comparable getOppositeDefaultValue() {
- Comparable dflt = getDefaultValue();
+ Comparable<?> getOppositeDefaultValue() {
+ Comparable<?> dflt = getDefaultValue();
return dflt == VersionVector.MAXS_VALUE ? VersionVector.MINS_VALUE : (dflt == VersionVector.MINS_VALUE ? VersionVector.MAXS_VALUE : null);
}
@@ -979,7 +979,7 @@ class VersionFormatParser {
return false;
}
- boolean parseOne(List segments, String version, int maxPos, TreeInfo info) {
+ boolean parseOne(List<Comparable<?>> segments, String version, int maxPos, TreeInfo info) {
int pos = info.getPosition();
maxPos = checkRange(pos, maxPos);
if (maxPos < 0)
@@ -1033,7 +1033,7 @@ class VersionFormatParser {
private int current;
- private List currentList;
+ private List<Fragment> currentList;
private int eos;
@@ -1049,7 +1049,7 @@ class VersionFormatParser {
start = pos;
current = pos;
eos = maxPos;
- currentList = new ArrayList();
+ currentList = new ArrayList<Fragment>();
while (current < eos)
parseFragment();
@@ -1058,14 +1058,14 @@ class VersionFormatParser {
case 0 :
throw new VersionFormatException(Messages.format_is_empty);
case 1 :
- Fragment frag = (Fragment) currentList.get(0);
+ Fragment frag = currentList.get(0);
if (frag.isGroup()) {
topFrag = frag;
break;
}
// Fall through to default
default :
- topFrag = createGroupFragment(null, EXACT_ONE_QUALIFIER, (Fragment[]) currentList.toArray(new Fragment[currentList.size()]), false);
+ topFrag = createGroupFragment(null, EXACT_ONE_QUALIFIER, currentList.toArray(new Fragment[currentList.size()]), false);
}
currentList = null;
return topFrag;
@@ -1129,8 +1129,8 @@ class VersionFormatParser {
}
private void parseBracketGroup() throws VersionFormatException {
- List saveList = currentList;
- currentList = new ArrayList();
+ List<Fragment> saveList = currentList;
+ currentList = new ArrayList<Fragment>();
while (current < eos && format.charAt(current) != ']')
parseFragment();
@@ -1139,7 +1139,7 @@ class VersionFormatParser {
++current;
VersionFormatParser.Instructions ep = parseProcessing();
- saveList.add(createGroupFragment(ep, ZERO_OR_ONE_QUALIFIER, (Fragment[]) currentList.toArray(new Fragment[currentList.size()]), false));
+ saveList.add(createGroupFragment(ep, ZERO_OR_ONE_QUALIFIER, currentList.toArray(new Fragment[currentList.size()]), false));
currentList = saveList;
}
@@ -1256,8 +1256,8 @@ class VersionFormatParser {
}
private void parseGroup(boolean array) throws VersionFormatException {
- List saveList = currentList;
- currentList = new ArrayList();
+ List<Fragment> saveList = currentList;
+ currentList = new ArrayList<Fragment>();
char expectedEnd = array ? '>' : ')';
while (current < eos && format.charAt(current) != expectedEnd)
parseFragment();
@@ -1274,7 +1274,7 @@ class VersionFormatParser {
if (currentList.isEmpty())
throw formatException(array ? Messages.array_can_not_be_empty : Messages.group_can_not_be_empty);
- saveList.add(createGroupFragment(ep, parseQualifier(), (Fragment[]) currentList.toArray(new Fragment[currentList.size()]), array));
+ saveList.add(createGroupFragment(ep, parseQualifier(), currentList.toArray(new Fragment[currentList.size()]), array));
currentList = saveList;
}
@@ -1430,7 +1430,7 @@ class VersionFormatParser {
throw formatException(Messages.default_defined_more_then_once);
if (processing.ignore)
throw formatException(Messages.cannot_combine_ignore_with_other_instruction);
- Comparable dflt = parseRawElement();
+ Comparable<?> dflt = parseRawElement();
processing.defaultValue = dflt;
if (current < eos && format.charAt(current) == '{') {
// =m{<translated min char>}
@@ -1518,9 +1518,9 @@ class VersionFormatParser {
currentList.add(createRawFragment(ep, parseQualifier()));
}
- private Comparable parseRawElement() throws VersionFormatException {
+ private Comparable<?> parseRawElement() throws VersionFormatException {
int[] position = new int[] {current};
- Comparable v = VersionParser.parseRawElement(format, position, eos);
+ Comparable<?> v = VersionParser.parseRawElement(format, position, eos);
if (v == null)
throw new VersionFormatException(NLS.bind(Messages.raw_element_expected_0, format));
current = position[0];
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/VersionParser.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/VersionParser.java
index 412c2bfa0..ec5870ef7 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/VersionParser.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/VersionParser.java
@@ -45,8 +45,8 @@ public abstract class VersionParser {
}
}
- static Comparable removeRedundantTrail(List segments, Comparable padValue) {
- Comparable redundantTrail;
+ static Comparable<?> removeRedundantTrail(List<Comparable<?>> segments, Comparable<?> padValue) {
+ Comparable<?> redundantTrail;
if (padValue == null)
redundantTrail = VersionVector.MIN_VALUE;
else {
@@ -84,9 +84,9 @@ public abstract class VersionParser {
if (pos == maxPos)
return null;
- Comparable[] padReturn = new Comparable[1];
- Comparable[] vector = null;
- Comparable pad = null;
+ Comparable<?>[] padReturn = new Comparable[1];
+ Comparable<?>[] vector = null;
+ Comparable<?> pad = null;
VersionFormat fmt = null;
char c = version.charAt(pos);
if (isDigit(c)) {
@@ -237,14 +237,14 @@ public abstract class VersionParser {
return end;
}
- static Comparable parseRawElement(String value, int[] position, int maxPos) {
+ static Comparable<?> parseRawElement(String value, int[] position, int maxPos) {
int current = position[0];
if (current >= maxPos)
return null;
boolean negate = false;
char c = value.charAt(current);
- Comparable v;
+ Comparable<?> v;
switch (c) {
case '\'' :
case '"' : {
@@ -320,7 +320,7 @@ public abstract class VersionParser {
return v;
}
- private static Comparable parseRawVector(String value, int[] position, int maxPos) {
+ private static Comparable<?> parseRawVector(String value, int[] position, int maxPos) {
int pos = position[0];
if (pos >= maxPos)
return null;
@@ -329,7 +329,7 @@ public abstract class VersionParser {
if (c == '>')
return null;
- ArrayList rawList = new ArrayList();
+ ArrayList<Comparable<?>> rawList = new ArrayList<Comparable<?>>();
boolean padMarkerSeen = (c == 'p');
if (padMarkerSeen) {
if (++pos >= maxPos)
@@ -337,9 +337,9 @@ public abstract class VersionParser {
position[0] = pos;
}
- Comparable pad = null;
+ Comparable<?> pad = null;
for (;;) {
- Comparable elem = parseRawElement(value, position, maxPos);
+ Comparable<?> elem = parseRawElement(value, position, maxPos);
if (elem == null)
return null;
@@ -369,7 +369,7 @@ public abstract class VersionParser {
return null;
}
pad = removeRedundantTrail(rawList, pad);
- return new VersionVector((Comparable[]) rawList.toArray(new Comparable[rawList.size()]), pad);
+ return new VersionVector(rawList.toArray(new Comparable[rawList.size()]), pad);
}
public static int skipWhite(String string, int pos) {
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/VersionVector.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/VersionVector.java
index f3ae34600..c723c8e6b 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/VersionVector.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/VersionVector.java
@@ -18,9 +18,13 @@ import java.io.Serializable;
*
* @Immutable
*/
-public class VersionVector implements Comparable, Serializable {
+public class VersionVector implements Comparable<VersionVector>, Serializable {
- private static final class MaxStringValue implements Comparable, Serializable {
+ interface MinMaxComparable extends Comparable<Object>, Serializable {
+ //
+ }
+
+ private static final class MaxStringValue implements MinMaxComparable {
private static final long serialVersionUID = -4936252230441132767L;
MaxStringValue() {
@@ -41,7 +45,7 @@ public class VersionVector implements Comparable, Serializable {
}
}
- private static final class MaxValue implements Comparable, Serializable {
+ private static final class MaxValue implements MinMaxComparable {
private static final long serialVersionUID = -5889641741635253589L;
MaxValue() {
@@ -62,7 +66,7 @@ public class VersionVector implements Comparable, Serializable {
}
}
- private static class MinValue implements Comparable, Serializable {
+ private static class MinValue implements MinMaxComparable {
private static final long serialVersionUID = -1066323980049812226L;
MinValue() {
@@ -85,18 +89,18 @@ public class VersionVector implements Comparable, Serializable {
/**
* A value that is greater then any other value
*/
- public static final Comparable MAX_VALUE = new MaxValue();
+ public static final Comparable<Object> MAX_VALUE = new MaxValue();
/**
* A value that is greater then any string but less then {@link #MAX_VALUE} and
* any Integer or VersionVector.
*/
- public static final Comparable MAXS_VALUE = new MaxStringValue();
+ public static final Comparable<Object> MAXS_VALUE = new MaxStringValue();
/**
* A value that is less then any other value
*/
- public static final Comparable MIN_VALUE = new MinValue();
+ public static final Comparable<Object> MIN_VALUE = new MinValue();
/**
* A value that is greater then {@link #MIN_VALUE} and less then any string,
@@ -106,7 +110,7 @@ public class VersionVector implements Comparable, Serializable {
private static final long serialVersionUID = -8385373304298723744L;
- static int compare(Comparable[] vectorA, Comparable padA, Comparable[] vectorB, Comparable padB) {
+ static int compare(Comparable<?>[] vectorA, Comparable<?> padA, Comparable<?>[] vectorB, Comparable<?> padB) {
int top = vectorA.length;
if (top > vectorB.length)
top = vectorB.length;
@@ -129,7 +133,7 @@ public class VersionVector implements Comparable, Serializable {
return padA == null ? (padB == null ? 0 : -1) : (padB == null ? 1 : compareSegments(padA, padB));
}
- static boolean equals(Comparable[] vectorA, Comparable padValueA, Comparable[] vectorB, Comparable padValueB) {
+ static boolean equals(Comparable<?>[] vectorA, Comparable<?> padValueA, Comparable<?>[] vectorB, Comparable<?> padValueB) {
// We compare pad first since it is impossible for versions with
// different pad to be equal (versions are padded to infinity)
if (padValueA == null) {
@@ -154,7 +158,7 @@ public class VersionVector implements Comparable, Serializable {
return true;
}
- static int hashCode(Comparable[] vector, Comparable padValue) {
+ static int hashCode(Comparable<?>[] vector, Comparable<?> padValue) {
int hashCode = padValue == null ? 31 : padValue.hashCode();
int idx = vector.length;
while (--idx >= 0) {
@@ -166,7 +170,7 @@ public class VersionVector implements Comparable, Serializable {
return hashCode;
}
- static void toString(StringBuffer sb, Comparable[] vector, Comparable padValue, boolean rangeSafe) {
+ static void toString(StringBuffer sb, Comparable<?>[] vector, Comparable<?> padValue, boolean rangeSafe) {
int top = vector.length;
if (top == 0)
// Write one pad value as explicit. It will be considered
@@ -186,16 +190,16 @@ public class VersionVector implements Comparable, Serializable {
}
}
- private static int compareReminder(int idx, Comparable[] vector, Comparable padValue, Comparable othersPad) {
+ private static int compareReminder(int idx, Comparable<?>[] vector, Comparable<?> padValue, Comparable<?> othersPad) {
int cmp;
for (cmp = 0; idx < vector.length && cmp == 0; ++idx)
cmp = compareSegments(vector[idx], othersPad);
if (cmp == 0)
- cmp = (padValue == null) ? -1 : padValue.compareTo(othersPad);
+ cmp = (padValue == null) ? -1 : compareSegments(padValue, othersPad);
return cmp;
}
- private static int compareSegments(Comparable a, Comparable b) {
+ static int compareSegments(Comparable<?> a, Comparable<?> b) {
if (a == b)
return 0;
@@ -206,20 +210,20 @@ public class VersionVector implements Comparable, Serializable {
}
if (a instanceof String && b instanceof String)
- return a.compareTo(b);
+ return ((String) a).compareTo((String) b);
if (a == MAX_VALUE || a == MIN_VALUE || a == MAXS_VALUE)
- return a.compareTo(b);
+ return ((MinMaxComparable) a).compareTo(b);
if (b == MAX_VALUE || b == MIN_VALUE || b == MAXS_VALUE)
- return -b.compareTo(a);
+ return -((MinMaxComparable) b).compareTo(a);
if (a instanceof Integer)
return 1;
if (b instanceof Integer)
return -1;
if (a instanceof VersionVector)
- return (b instanceof VersionVector) ? a.compareTo(b) : 1;
+ return (b instanceof VersionVector) ? ((VersionVector) a).compareTo((VersionVector) b) : 1;
if (b instanceof VersionVector)
return -1;
@@ -227,20 +231,19 @@ public class VersionVector implements Comparable, Serializable {
throw new IllegalArgumentException();
}
- private final Comparable padValue;
+ private final Comparable<?> padValue;
- private final Comparable[] vector;
+ private final Comparable<?>[] vector;
- public VersionVector(Comparable[] vector, Comparable pad) {
+ public VersionVector(Comparable<?>[] vector, Comparable<?> pad) {
this.vector = vector;
this.padValue = (pad == MIN_VALUE) ? null : pad;
}
- public int compareTo(Object o) {
- if (o == this)
+ public int compareTo(VersionVector ov) {
+ if (ov == this)
return 0;
- VersionVector ov = (VersionVector) o;
return compare(vector, padValue, ov.vector, ov.padValue);
}
@@ -260,7 +263,7 @@ public class VersionVector implements Comparable, Serializable {
* versions that has a raw vector with a larger number of elements
* @return The pad value or <code>null</code> if not set.
*/
- public Comparable getPad() {
+ public Comparable<?> getPad() {
return padValue;
}
@@ -269,7 +272,7 @@ public class VersionVector implements Comparable, Serializable {
* @param index The zero based index of the desired element
* @return An element from the raw vector
*/
- public Comparable getSegment(int index) {
+ public Comparable<?> getSegment(int index) {
return vector[index];
}
@@ -286,7 +289,7 @@ public class VersionVector implements Comparable, Serializable {
* contract.
* @return The raw vector. Must be treated as read-only
*/
- Comparable[] getVector() {
+ Comparable<?>[] getVector() {
return vector;
}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/IInstallableUnitPatch.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/IInstallableUnitPatch.java
index 85a4bcb4e..62cba0a52 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/IInstallableUnitPatch.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/IInstallableUnitPatch.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.equinox.internal.provisional.p2.metadata;
+import java.util.List;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.IRequirement;
@@ -39,7 +40,7 @@ public interface IInstallableUnitPatch extends IInstallableUnit {
* Returns the requirement changes imposed by the patch.
* @return The patch requirement changes.
*/
- IRequirementChange[] getRequirementsChange();
+ List<IRequirementChange> getRequirementsChange();
/**
* Returns the required capability that defines the lifecycle of this patch. The
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/ITouchpointData.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/ITouchpointData.java
index c1ea83b1a..5aa8b49eb 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/ITouchpointData.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/ITouchpointData.java
@@ -35,7 +35,7 @@ public interface ITouchpointData {
*
* @return the touchpoint instructions
*/
- public Map getInstructions();
+ public Map<String, ITouchpointInstruction> getInstructions();
/**
* Returns whether this TouchpointData is equal to the given object.
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/MetadataFactory.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/MetadataFactory.java
index 2b013f5b2..8d2a6f3fc 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/MetadataFactory.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/MetadataFactory.java
@@ -16,6 +16,7 @@ import java.net.URI;
import java.util.*;
import java.util.Map.Entry;
import org.eclipse.core.runtime.Assert;
+import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils;
import org.eclipse.equinox.internal.p2.metadata.*;
import org.eclipse.equinox.p2.metadata.*;
import org.eclipse.equinox.p2.metadata.query.IQuery;
@@ -60,28 +61,24 @@ public class MetadataFactory {
super();
}
- public void addProvidedCapabilities(Collection additional) {
+ public void addProvidedCapabilities(Collection<IProvidedCapability> additional) {
if (additional == null || additional.size() == 0)
return;
- IProvidedCapability[] current = unit().getProvidedCapabilities();
- IProvidedCapability[] result = new IProvidedCapability[additional.size() + current.length];
- System.arraycopy(current, 0, result, 0, current.length);
- int j = current.length;
- for (Iterator i = additional.iterator(); i.hasNext();)
- result[j++] = (IProvidedCapability) i.next();
- unit().setCapabilities(result);
+ List<IProvidedCapability> current = unit().getProvidedCapabilities();
+ ArrayList<IProvidedCapability> all = new ArrayList<IProvidedCapability>(additional.size() + current.size());
+ all.addAll(current);
+ all.addAll(additional);
+ unit().setCapabilities(all.toArray(new IProvidedCapability[all.size()]));
}
- public void addRequiredCapabilities(Collection additional) {
+ public void addRequiredCapabilities(Collection<IRequirement> additional) {
if (additional == null || additional.size() == 0)
return;
- IRequirement[] current = unit().getRequiredCapabilities();
- IRequirement[] result = new IRequirement[additional.size() + current.length];
- System.arraycopy(current, 0, result, 0, current.length);
- int j = current.length;
- for (Iterator i = additional.iterator(); i.hasNext();)
- result[j++] = (IRequirement) i.next();
- unit().setRequiredCapabilities(result);
+ List<IRequirement> current = unit().getRequiredCapabilities();
+ ArrayList<IRequirement> all = new ArrayList<IRequirement>(additional.size() + current.size());
+ all.addAll(current);
+ all.addAll(additional);
+ unit().setRequiredCapabilities(all.toArray(new IRequirement[all.size()]));
}
public void addTouchpointData(ITouchpointData data) {
@@ -93,15 +90,15 @@ public class MetadataFactory {
return unit().getId();
}
- public IProvidedCapability[] getProvidedCapabilities() {
+ public List<IProvidedCapability> getProvidedCapabilities() {
return unit().getProvidedCapabilities();
}
- public IRequirement[] getRequiredCapabilities() {
+ public List<IRequirement> getRequiredCapabilities() {
return unit().getRequiredCapabilities();
}
- public IRequirement[] getMetaRequiredCapabilities() {
+ public List<IRequirement> getMetaRequiredCapabilities() {
return unit().getMetaRequiredCapabilities();
}
@@ -111,7 +108,7 @@ public class MetadataFactory {
*
* @return The current touchpoint data on this description
*/
- public ITouchpointData[] getTouchpointData() {
+ public List<ITouchpointData> getTouchpointData() {
return unit().getTouchpointData();
}
@@ -237,7 +234,7 @@ public class MetadataFactory {
/**
* Singleton touchpoint data for a touchpoint with no instructions.
*/
- private static final ITouchpointData EMPTY_TOUCHPOINT_DATA = new TouchpointData(Collections.EMPTY_MAP);
+ private static final ITouchpointData EMPTY_TOUCHPOINT_DATA = new TouchpointData(CollectionUtils.<String, ITouchpointInstruction> emptyMap());
private static ITouchpointType[] typeCache = new ITouchpointType[5];
@@ -310,7 +307,7 @@ public class MetadataFactory {
return new RequiredCapability(namespace, name, range, filter, optional, multiple);
}
- public static IRequirement createRequiredCapability(String namespace, String name, VersionRange range, IQuery filter, int minCard, int maxCard, boolean greedy) {
+ public static IRequirement createRequiredCapability(String namespace, String name, VersionRange range, IQuery<Boolean> filter, int minCard, int maxCard, boolean greedy) {
return new RequiredCapability(namespace, name, range, filter, minCard, maxCard, greedy);
}
@@ -377,20 +374,22 @@ public class MetadataFactory {
* @param instructions The instructions for the touchpoint data.
* @return The created touchpoint data
*/
- public static ITouchpointData createTouchpointData(Map instructions) {
+ public static ITouchpointData createTouchpointData(Map<String, ? extends Object> instructions) {
Assert.isNotNull(instructions);
//copy the map to protect against subsequent change by caller
if (instructions.isEmpty())
return EMPTY_TOUCHPOINT_DATA;
- Map result = new LinkedHashMap(instructions.size());
- for (Iterator iterator = instructions.entrySet().iterator(); iterator.hasNext();) {
- Entry entry = (Entry) iterator.next();
+ Map<String, ITouchpointInstruction> result = new LinkedHashMap<String, ITouchpointInstruction>(instructions.size());
+
+ for (Entry<String, ? extends Object> entry : instructions.entrySet()) {
Object value = entry.getValue();
+ ITouchpointInstruction instruction;
if (value == null || value instanceof String)
- value = createTouchpointInstruction((String) value, null);
-
- result.put(entry.getKey(), value);
+ instruction = createTouchpointInstruction((String) value, null);
+ else
+ instruction = (ITouchpointInstruction) value;
+ result.put(entry.getKey(), instruction);
}
return new TouchpointData(result);
}
@@ -401,16 +400,15 @@ public class MetadataFactory {
* @param incomingInstructions - Map of ITouchpointInstructions to merge into the initial touchpoint data
* @return the merged ITouchpointData
*/
- public static ITouchpointData mergeTouchpointData(ITouchpointData initial, Map incomingInstructions) {
+ public static ITouchpointData mergeTouchpointData(ITouchpointData initial, Map<String, ITouchpointInstruction> incomingInstructions) {
if (incomingInstructions == null || incomingInstructions.size() == 0)
return initial;
- Map resultInstructions = new HashMap(initial.getInstructions());
- for (Iterator iterator = incomingInstructions.keySet().iterator(); iterator.hasNext();) {
- String key = (String) iterator.next();
- Object incoming = incomingInstructions.get(key);
- ITouchpointInstruction instruction = (incoming instanceof String) ? createTouchpointInstruction((String) incoming, null) : (ITouchpointInstruction) incoming;
- ITouchpointInstruction existingInstruction = (ITouchpointInstruction) resultInstructions.get(key);
+ Map<String, ITouchpointInstruction> resultInstructions = new HashMap<String, ITouchpointInstruction>(initial.getInstructions());
+ for (Iterator<String> iterator = incomingInstructions.keySet().iterator(); iterator.hasNext();) {
+ String key = iterator.next();
+ ITouchpointInstruction instruction = incomingInstructions.get(key);
+ ITouchpointInstruction existingInstruction = resultInstructions.get(key);
if (existingInstruction != null) {
String body = existingInstruction.getBody();
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/Version.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/Version.java
index ea50dc4e2..566911a00 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/Version.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/Version.java
@@ -36,7 +36,7 @@ import org.eclipse.equinox.internal.p2.metadata.*;
* raw vector holds incompatible values. The method {@link #isOSGiCompatible()} can be used
* to test.
*/
-public abstract class Version implements Comparable, Serializable {
+public abstract class Version implements Comparable<Version>, Serializable {
public static final String RAW_PREFIX = "raw:"; //$NON-NLS-1$
/**
@@ -106,7 +106,7 @@ public abstract class Version implements Comparable, Serializable {
* or the qualifier string is invalid.
*/
public static Version createOSGi(int major, int minor, int micro, String qualifier) {
- Comparable logicQualifier;
+ Comparable<?> logicQualifier;
if (qualifier == null || qualifier.length() == 0) {
if (major == 0 && minor == 0 && micro == 0)
return emptyVersion;
@@ -192,14 +192,14 @@ public abstract class Version implements Comparable, Serializable {
* versions that has a larger number of segments
* @return The pad value or <code>null</code> if not set.
*/
- public abstract Comparable getPad();
+ public abstract Comparable<?> getPad();
/**
* An element from the raw vector representation of this version.
* @param index The zero based index of the desired element
* @return An element from the raw vector
*/
- public abstract Comparable getSegment(int index);
+ public abstract Comparable<?> getSegment(int index);
/**
* Returns the number of elements in the raw vector representation of this version.
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/Collector.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/Collector.java
index 92bbc7d14..5c9a07ded 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/Collector.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/Collector.java
@@ -15,6 +15,7 @@ import java.lang.reflect.Array;
import java.util.*;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils;
import org.eclipse.equinox.internal.p2.metadata.Messages;
import org.eclipse.equinox.p2.metadata.query.IQuery;
import org.eclipse.equinox.p2.metadata.query.IQueryResult;
@@ -28,15 +29,20 @@ import org.eclipse.equinox.p2.metadata.query.IQueryResult;
* This default collector just accepts all objects passed to it. Clients may subclass
* to perform different processing on the objects passed to it.
*/
-public class Collector implements IQueryResult {
- private Set collected = null;
+public class Collector<T> implements IQueryResult<T> {
+ private Set<T> collected = null;
- public static final Collector EMPTY_COLLECTOR = new Collector() {
+ public static final Collector<?> EMPTY_COLLECTOR = new Collector<Object>() {
public boolean accept(Object val) {
return false;
}
};
+ @SuppressWarnings("unchecked")
+ public static final <T> Collector<T> emptyCollector() {
+ return (Collector<T>) EMPTY_COLLECTOR;
+ }
+
/**
* Creates a new collector.
*/
@@ -56,7 +62,7 @@ public class Collector implements IQueryResult {
* @return <code>true</code> if the traversal should continue,
* or <code>false</code> to indicate the traversal should stop.
*/
- public boolean accept(Object object) {
+ public boolean accept(T object) {
getCollection().add(object);
return true;
}
@@ -65,9 +71,9 @@ public class Collector implements IQueryResult {
* Adds the elements from one collector to this collector
* @param queryResult The collector from which the elements should be retrieved
*/
- public void addAll(IQueryResult queryResult) {
+ public void addAll(IQueryResult<T> queryResult) {
boolean keepGoing = true;
- for (Iterator iter = queryResult.iterator(); iter.hasNext() && keepGoing;) {
+ for (Iterator<T> iter = queryResult.iterator(); iter.hasNext() && keepGoing;) {
keepGoing = accept(iter.next());
}
}
@@ -80,9 +86,9 @@ public class Collector implements IQueryResult {
*
* @return the collection being used to collect results.
*/
- protected Collection getCollection() {
+ protected Collection<T> getCollection() {
if (collected == null)
- collected = new HashSet();
+ collected = new HashSet<T>();
return collected;
}
@@ -100,8 +106,8 @@ public class Collector implements IQueryResult {
*
* @return an iterator of the collected objects.
*/
- public Iterator iterator() {
- return collected == null ? Collections.EMPTY_LIST.iterator() : collected.iterator();
+ public Iterator<T> iterator() {
+ return collected == null ? CollectionUtils.<T> emptyList().iterator() : collected.iterator();
}
/**
@@ -119,9 +125,10 @@ public class Collector implements IQueryResult {
* @throws ArrayStoreException the runtime type of the specified array is
* not a supertype of the runtime type of every collected object
*/
- public Object[] toArray(Class clazz) {
+ public T[] toArray(Class<? extends T> clazz) {
int size = collected == null ? 0 : collected.size();
- Object[] result = (Object[]) Array.newInstance(clazz, size);
+ @SuppressWarnings("unchecked")
+ T[] result = (T[]) Array.newInstance(clazz, size);
if (size != 0)
collected.toArray(result);
return result;
@@ -132,15 +139,15 @@ public class Collector implements IQueryResult {
*
* @return An unmodifiable collection of the collected objects
*/
- public Set toSet() {
- return collected == null ? new HashSet() : new HashSet(collected);
+ public Set<T> toSet() {
+ return collected == null ? new HashSet<T>() : new HashSet<T>(collected);
}
/**
* Performs a query on this results of this collector.
*/
- public IQueryResult query(IQuery query, IProgressMonitor monitor) {
- IQueryResult result;
+ public IQueryResult<T> query(IQuery<T> query, IProgressMonitor monitor) {
+ IQueryResult<T> result;
if (monitor == null)
monitor = new NullProgressMonitor();
try {
@@ -158,7 +165,8 @@ public class Collector implements IQueryResult {
*
* @return An unmodifiable collection of the collected objects
*/
- public Set unmodifiableSet() {
+ @SuppressWarnings("unchecked")
+ public Set<T> unmodifiableSet() {
return collected == null ? Collections.EMPTY_SET : Collections.unmodifiableSet(collected);
}
}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/CompoundQuery.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/CompoundQuery.java
index 9932af3bb..ae5d360f6 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/CompoundQuery.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/CompoundQuery.java
@@ -30,8 +30,8 @@ import org.eclipse.equinox.p2.metadata.query.IQueryResult;
*
* @noextend This class is not intended to be subclassed by clients.
*/
-public abstract class CompoundQuery implements IQuery, ICompositeQuery {
- protected IQuery[] queries;
+public abstract class CompoundQuery<T> implements ICompositeQuery<T> {
+ protected IQuery<T>[] queries;
protected boolean and;
/**
@@ -48,18 +48,23 @@ public abstract class CompoundQuery implements IQuery, ICompositeQuery {
* @param and <code>true</code> if this query represents a logical 'and', and
* <code>false</code> if this query represents a logical 'or'.
*/
- public static CompoundQuery createCompoundQuery(IQuery[] queries, boolean and) {
+ public static <T> CompoundQuery<T> createCompoundQuery(IQuery<T>[] queries, boolean and) {
if (isMatchQueries(queries)) {
- return new CompoundQuery.MatchCompoundQuery(queries, and);
+ return new CompoundQuery.MatchCompoundQuery<T>(queries, and);
}
- return new CompoundQuery.ContextCompoundQuery(queries, and);
+ return new CompoundQuery.ContextCompoundQuery<T>(queries, and);
+ }
+
+ @SuppressWarnings("unchecked")
+ public static <T> CompoundQuery<T> createCompoundQuery(IQuery<T> query1, IQuery<T> query2, boolean and) {
+ return createCompoundQuery(new IQuery[] {query1, query2}, and);
}
/**
* Returns the queries that make up this compound query
*/
- public IQuery[] getQueries() {
- return queries;
+ public List<IQuery<T>> getQueries() {
+ return Arrays.asList(queries);
}
/**
@@ -72,7 +77,7 @@ public abstract class CompoundQuery implements IQuery, ICompositeQuery {
return and;
}
- protected CompoundQuery(IQuery[] queries, boolean and) {
+ protected CompoundQuery(IQuery<T>[] queries, boolean and) {
this.queries = queries;
this.and = and;
}
@@ -80,9 +85,9 @@ public abstract class CompoundQuery implements IQuery, ICompositeQuery {
/**
* @param queries
*/
- private static boolean isMatchQueries(IQuery[] queries) {
+ private static boolean isMatchQueries(IQuery<?>[] queries) {
for (int i = 0; i < queries.length; i++) {
- if (!(queries[i] instanceof IMatchQuery)) {
+ if (!(queries[i] instanceof IMatchQuery<?>)) {
return false;
}
}
@@ -107,15 +112,15 @@ public abstract class CompoundQuery implements IQuery, ICompositeQuery {
/**
* The compound query instantiated when all queries are Match Queries.
*/
- private static class MatchCompoundQuery extends CompoundQuery implements IMatchQuery {
+ private static class MatchCompoundQuery<T> extends CompoundQuery<T> implements IMatchQuery<T> {
- protected MatchCompoundQuery(IQuery[] queries, boolean and) {
+ protected MatchCompoundQuery(IQuery<T>[] queries, boolean and) {
super(queries, and);
}
- public boolean isMatch(Object candidate) {
+ public boolean isMatch(T candidate) {
for (int i = 0; i < queries.length; i++) {
- boolean valid = ((IMatchQuery) queries[i]).isMatch(candidate);
+ boolean valid = ((IMatchQuery<T>) queries[i]).isMatch(candidate);
// if we are OR'ing then the first time we find a requirement that is met, return success
if (valid && !and)
return true;
@@ -133,12 +138,12 @@ public abstract class CompoundQuery implements IQuery, ICompositeQuery {
* Performs this query on the given iterator, passing all objects in the iterator
* that match the criteria of this query to the given result.
*/
- public final IQueryResult perform(Iterator iterator) {
+ public final IQueryResult<T> perform(Iterator<T> iterator) {
prePerform();
- Collector result = new Collector();
+ Collector<T> result = new Collector<T>();
try {
while (iterator.hasNext()) {
- Object candidate = iterator.next();
+ T candidate = iterator.next();
if (isMatch(candidate))
if (!result.accept(candidate))
break;
@@ -151,13 +156,13 @@ public abstract class CompoundQuery implements IQuery, ICompositeQuery {
public void prePerform() {
for (int i = 0; i < queries.length; i++) {
- ((IMatchQuery) queries[i]).prePerform();
+ ((IMatchQuery<T>) queries[i]).prePerform();
}
}
public void postPerform() {
for (int i = 0; i < queries.length; i++) {
- ((IMatchQuery) queries[i]).postPerform();
+ ((IMatchQuery<T>) queries[i]).postPerform();
}
}
}
@@ -166,19 +171,19 @@ public abstract class CompoundQuery implements IQuery, ICompositeQuery {
* The compound query instantiated when any of the queries are not
* match queries.
*/
- private static class ContextCompoundQuery extends CompoundQuery {
+ private static class ContextCompoundQuery<T> extends CompoundQuery<T> {
- protected ContextCompoundQuery(IQuery[] queries, boolean and) {
+ protected ContextCompoundQuery(IQuery<T>[] queries, boolean and) {
super(queries, and);
}
/*
* A collector that takes the set to puts the elements in.
*/
- static class SetCollector implements IQueryResult {
- private final Set s;
+ static class SetCollector<T> implements IQueryResult<T> {
+ private final Set<T> s;
- public SetCollector(Set s) {
+ public SetCollector(Set<T> s) {
this.s = s;
}
@@ -186,46 +191,47 @@ public abstract class CompoundQuery implements IQuery, ICompositeQuery {
return s.isEmpty();
}
- public Iterator iterator() {
+ public Iterator<T> iterator() {
return s.iterator();
}
- public Object[] toArray(Class clazz) {
- return s.toArray((Object[]) Array.newInstance(clazz, s.size()));
+ @SuppressWarnings("unchecked")
+ public T[] toArray(Class<? extends T> clazz) {
+ return s.toArray((T[]) Array.newInstance(clazz, s.size()));
}
- public IQueryResult query(IQuery query, IProgressMonitor monitor) {
+ public IQueryResult<T> query(IQuery<T> query, IProgressMonitor monitor) {
return query.perform(iterator());
}
- public Set toSet() {
- return new HashSet(s);
+ public Set<T> toSet() {
+ return new HashSet<T>(s);
}
- public Set unmodifiableSet() {
+ public Set<T> unmodifiableSet() {
return Collections.unmodifiableSet(s);
}
}
- public IQueryResult perform(Iterator iterator) {
+ public IQueryResult<T> perform(Iterator<T> iterator) {
if (queries.length < 1)
- return Collector.EMPTY_COLLECTOR;
+ return Collector.emptyCollector();
if (queries.length == 1)
return queries[0].perform(iterator);
- Collection data = new ArrayList();
+ Collection<T> data = new ArrayList<T>();
while (iterator.hasNext())
data.add(iterator.next());
- Set result;
+ Set<T> result;
if (isAnd()) {
result = queries[0].perform(data.iterator()).unmodifiableSet();
for (int i = 1; i < queries.length && result.size() > 0; i++) {
- HashSet retained = new HashSet();
- Iterator itor = queries[i].perform(data.iterator()).iterator();
+ HashSet<T> retained = new HashSet<T>();
+ Iterator<T> itor = queries[i].perform(data.iterator()).iterator();
while (itor.hasNext()) {
- Object nxt = itor.next();
+ T nxt = itor.next();
if (result.contains(nxt))
retained.add(nxt);
}
@@ -234,13 +240,13 @@ public abstract class CompoundQuery implements IQuery, ICompositeQuery {
} else {
result = queries[0].perform(data.iterator()).toSet();
for (int i = 1; i < queries.length; i++) {
- Iterator itor = queries[i].perform(data.iterator()).iterator();
+ Iterator<T> itor = queries[i].perform(data.iterator()).iterator();
while (itor.hasNext()) {
result.add(itor.next());
}
}
}
- return new SetCollector(result);
+ return new SetCollector<T>(result);
}
}
}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/CompoundQueryable.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/CompoundQueryable.java
index 27a4dd0a2..dc6c12a4d 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/CompoundQueryable.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/CompoundQueryable.java
@@ -12,6 +12,7 @@ package org.eclipse.equinox.internal.provisional.p2.metadata.query;
import java.lang.reflect.Array;
import java.util.*;
import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils;
import org.eclipse.equinox.p2.metadata.query.IQuery;
import org.eclipse.equinox.p2.metadata.query.IQueryResult;
@@ -19,31 +20,31 @@ import org.eclipse.equinox.p2.metadata.query.IQueryResult;
* A queryable that holds a number of other IQueryables and provides
* a mechanism for querying the entire set.
*/
-public class CompoundQueryable implements IQueryable {
+public class CompoundQueryable<T> implements IQueryable<T> {
- private IQueryable[] queryables;
+ private IQueryable<T>[] queryables;
- public CompoundQueryable(IQueryable[] queryables) {
+ public CompoundQueryable(IQueryable<T>[] queryables) {
this.queryables = queryables;
}
- public IQueryResult query(IQuery query, IProgressMonitor monitor) {
- IQueryResult subResults = null;
+ public IQueryResult<T> query(IQuery<T> query, IProgressMonitor monitor) {
+ IQueryResult<T> subResults = null;
if (monitor == null) {
monitor = new NullProgressMonitor();
}
- boolean isMatchQuery = query instanceof IMatchQuery;
+ boolean isMatchQuery = query instanceof IMatchQuery<?>;
int totalWork = isMatchQuery ? queryables.length : queryables.length + 1;
try {
SubMonitor subMonitor = SubMonitor.convert(monitor, totalWork * 10);
- Collector results;
+ Collector<T> results;
if (!isMatchQuery) {
// If it is not a match query, then collect the results
// as a list, we will query this list for the final results
- results = new ListCollector();
+ results = new ListCollector<T>();
} else
- results = new Collector();
+ results = new Collector<T>();
for (int i = 0; i < queryables.length; i++) {
if (subMonitor.isCanceled())
@@ -74,16 +75,16 @@ public class CompoundQueryable implements IQueryable {
* @noextend This class is not intended to be subclassed by clients.
*
*/
- public class ListCollector extends Collector {
- private List collected;
+ public static class ListCollector<T> extends Collector<T> {
+ private List<T> collected;
public ListCollector() {
super();
}
- protected Collection getCollection() {
+ protected Collection<T> getCollection() {
if (collected == null)
- collected = new ArrayList();
+ collected = new ArrayList<T>();
return collected;
}
@@ -91,17 +92,18 @@ public class CompoundQueryable implements IQueryable {
return collected == null || collected.isEmpty();
}
- public Object[] toArray(Class clazz) {
+ @SuppressWarnings("unchecked")
+ public T[] toArray(Class<? extends T> clazz) {
int size = collected == null ? 0 : collected.size();
- Object[] result = (Object[]) Array.newInstance(clazz, size);
+ T[] result = (T[]) Array.newInstance(clazz, size);
if (size != 0)
collected.toArray(result);
return result;
}
- public boolean accept(Object object) {
+ public boolean accept(T object) {
if (collected == null)
- collected = new ArrayList();
+ collected = new ArrayList<T>();
collected.add(object);
return true;
}
@@ -111,12 +113,12 @@ public class CompoundQueryable implements IQueryable {
*
* @return An unmodifiable collection of the collected objects
*/
- public Set toSet() {
- return collected == null ? Collections.EMPTY_SET : new HashSet(collected);
+ public Set<T> toSet() {
+ return collected == null ? new HashSet<T>() : new HashSet<T>(collected);
}
- public Iterator iterator() {
- return collected == null ? Collections.EMPTY_LIST.iterator() : collected.iterator();
+ public Iterator<T> iterator() {
+ return collected == null ? CollectionUtils.<T> emptyList().iterator() : collected.iterator();
}
public int size() {
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/ContextQuery.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/ContextQuery.java
index 6faee7266..420c3f97e 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/ContextQuery.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/ContextQuery.java
@@ -32,7 +32,7 @@ import org.eclipse.equinox.p2.metadata.query.IQueryResult;
* execution of the query. <P>
*
*/
-public abstract class ContextQuery implements IQuery {
+public abstract class ContextQuery<T> implements IQuery<T> {
/**
* Evaluates the query for a specific input.
@@ -41,7 +41,7 @@ public abstract class ContextQuery implements IQuery {
* @return The results of the query. The collector returned must be
* the collector passed in.
*/
- public abstract IQueryResult perform(Iterator iterator);
+ public abstract IQueryResult<T> perform(Iterator<T> iterator);
/**
* Gets the ID for this Query.
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/ICompositeQuery.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/ICompositeQuery.java
index 0e84630df..8547b020b 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/ICompositeQuery.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/ICompositeQuery.java
@@ -9,18 +9,19 @@
******************************************************************************/
package org.eclipse.equinox.internal.provisional.p2.metadata.query;
+import java.util.List;
import org.eclipse.equinox.p2.metadata.query.IQuery;
/**
* A query that contains a number of sub queries. All queries that support sub-queries
* should implement this interface so clients can access the sub queries.
*/
-public interface ICompositeQuery {
+public interface ICompositeQuery<T> extends IQuery<T> {
/**
* Returns all the child queries of a CompositeQuery.
* @return All the child queries.
*/
- public IQuery[] getQueries();
+ public List<IQuery<T>> getQueries();
}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/IMatchQuery.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/IMatchQuery.java
index 192e4de98..87f0d613b 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/IMatchQuery.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/IMatchQuery.java
@@ -11,7 +11,6 @@ package org.eclipse.equinox.internal.provisional.p2.metadata.query;
import org.eclipse.equinox.p2.metadata.query.IQuery;
-
/**
* A query in which the elements can be evaluated by calling isMatch on. Each
* element can be evaluated independently of all other elements. Match queries
@@ -20,7 +19,7 @@ import org.eclipse.equinox.p2.metadata.query.IQuery;
*
* @spi Clients should not implement this interface, but rather extend {@link MatchQuery}.
*/
-public interface IMatchQuery extends IQuery {
+public interface IMatchQuery<T> extends IQuery<T> {
/**
* Returns whether the given object satisfies the parameters of this query.
@@ -31,7 +30,7 @@ public interface IMatchQuery extends IQuery {
*
* @noreference This method is not intended to be referenced by clients.
*/
- public boolean isMatch(Object candidate);
+ public boolean isMatch(T candidate);
/**
* Execute any pre-processing that must be done before this query is performed against
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/IQueryable.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/IQueryable.java
index 8dd639c62..e43a54a97 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/IQueryable.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/IQueryable.java
@@ -10,17 +10,16 @@
*******************************************************************************/
package org.eclipse.equinox.internal.provisional.p2.metadata.query;
-import org.eclipse.equinox.p2.metadata.query.IQueryResult;
-
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.equinox.p2.metadata.query.IQuery;
+import org.eclipse.equinox.p2.metadata.query.IQueryResult;
/**
* An IQueryable contains objects, and is able to perform queries on those objects.
* <p>
* This interface may be implemented by clients.
*/
-public interface IQueryable {
+public interface IQueryable<T> {
/**
* Performs a query, passing any objects that satisfy the
* query to the provided collector.
@@ -34,5 +33,5 @@ public interface IQueryable {
* reporting is not desired
* @return The collector argument
*/
- public IQueryResult query(IQuery query, IProgressMonitor monitor);
+ public IQueryResult<T> query(IQuery<T> query, IProgressMonitor monitor);
}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/IUPropertyQuery.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/IUPropertyQuery.java
index 168ce05b8..dfd02c4b0 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/IUPropertyQuery.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/IUPropertyQuery.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.equinox.internal.provisional.p2.metadata.query;
-
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
/**
@@ -18,7 +17,7 @@ import org.eclipse.equinox.p2.metadata.IInstallableUnit;
* a property whose value matches the provided value. If no property name is
* specified, then all {@link IInstallableUnit} instances are accepted.
*/
-public class IUPropertyQuery extends MatchQuery {
+public class IUPropertyQuery extends MatchQuery<IInstallableUnit> {
private String propertyName;
private String propertyValue;
@@ -33,10 +32,7 @@ public class IUPropertyQuery extends MatchQuery {
/* (non-Javadoc)
* @see org.eclipse.equinox.p2.query2.Query#isMatch(java.lang.Object)
*/
- public boolean isMatch(Object object) {
- if (!(object instanceof IInstallableUnit))
- return false;
- IInstallableUnit candidate = (IInstallableUnit) object;
+ public boolean isMatch(IInstallableUnit candidate) {
if (propertyName == null)
return true;
String value = getProperty(candidate, propertyName);
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/InstallableUnitQuery.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/InstallableUnitQuery.java
index e21c65e5f..ee3fcff71 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/InstallableUnitQuery.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/InstallableUnitQuery.java
@@ -18,7 +18,7 @@ import org.eclipse.equinox.p2.metadata.IVersionedId;
/**
* A query that matches on the id and version of an {@link IInstallableUnit}.
*/
-public class InstallableUnitQuery extends MatchQuery {
+public class InstallableUnitQuery extends MatchQuery<IInstallableUnit> {
/**
* A convenience query that will match any {@link IInstallableUnit}
* it encounters.
@@ -92,10 +92,7 @@ public class InstallableUnitQuery extends MatchQuery {
/* (non-Javadoc)
* @see org.eclipse.equinox.p2.query2.Query#isMatch(java.lang.Object)
*/
- public boolean isMatch(Object object) {
- if (!(object instanceof IInstallableUnit))
- return false;
- IInstallableUnit candidate = (IInstallableUnit) object;
+ public boolean isMatch(IInstallableUnit candidate) {
if (id != null && !id.equals(candidate.getId()))
return false;
if (range != null && !range.isIncluded(candidate.getVersion()))
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/LatestIUVersionQuery.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/LatestIUVersionQuery.java
index f1baa98bd..1a6f66b48 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/LatestIUVersionQuery.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/LatestIUVersionQuery.java
@@ -17,35 +17,30 @@ import org.eclipse.equinox.p2.metadata.query.IQueryResult;
* This query returns the latest version for each unique VersionedID.
* All other elements are discarded.
*/
-public class LatestIUVersionQuery extends ContextQuery {
+public class LatestIUVersionQuery<T extends IVersionedId> extends ContextQuery<T> {
/**
* Performs the LatestIUVersionQuery
*/
- public IQueryResult perform(Iterator iterator) {
- HashMap greatestIUVersion = new HashMap();
+ public IQueryResult<T> perform(Iterator<T> iterator) {
+ HashMap<String, T> greatestIUVersion = new HashMap<String, T>();
while (iterator.hasNext()) {
- Object next = iterator.next();
-
- if (!(next instanceof IVersionedId))
- // Don't accept things if they are not IUs
- continue;
- IVersionedId versionedID = (IVersionedId) next;
+ T versionedID = iterator.next();
if (greatestIUVersion.containsKey(versionedID.getId())) {
- IVersionedId currentIU = (IVersionedId) greatestIUVersion.get(versionedID.getId());
+ T currentIU = greatestIUVersion.get(versionedID.getId());
if (currentIU.getVersion().compareTo(versionedID.getVersion()) < 0)
greatestIUVersion.put(versionedID.getId(), versionedID);
} else
greatestIUVersion.put(versionedID.getId(), versionedID);
}
- Collection values = greatestIUVersion.values();
- Iterator valuesIterator = values.iterator();
+ Collection<T> values = greatestIUVersion.values();
+ Iterator<T> valuesIterator = values.iterator();
boolean continueGather = true;
- Collector result = new Collector();
+ Collector<T> result = new Collector<T>();
while (valuesIterator.hasNext() && continueGather) {
- IVersionedId nextIU = (IVersionedId) valuesIterator.next();
+ T nextIU = valuesIterator.next();
continueGather = result.accept(nextIU);
}
return result;
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/LimitQuery.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/LimitQuery.java
index ba96e611e..867994c90 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/LimitQuery.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/LimitQuery.java
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.equinox.internal.provisional.p2.metadata.query;
-import java.util.Iterator;
+import java.util.*;
import org.eclipse.equinox.p2.metadata.query.IQuery;
import org.eclipse.equinox.p2.metadata.query.IQueryResult;
@@ -17,26 +17,26 @@ import org.eclipse.equinox.p2.metadata.query.IQueryResult;
* A limit query can be used to limit the number of query results returned. Once
* the limit is reached, the query is terminated.
*/
-public class LimitQuery extends ContextQuery implements ICompositeQuery {
+public class LimitQuery<T> extends ContextQuery<T> implements ICompositeQuery<T> {
- private final IQuery query;
+ private final IQuery<T> query;
private final int limit;
- public LimitQuery(IQuery query, int limit) {
+ public LimitQuery(IQuery<T> query, int limit) {
this.query = query;
this.limit = limit;
}
- public IQueryResult perform(Iterator iterator) {
+ public IQueryResult<T> perform(Iterator<T> iterator) {
if (limit == 0)
- return Collector.EMPTY_COLLECTOR;
+ return Collector.emptyCollector();
int count = 0;
- Collector result = new Collector();
- if (query instanceof IMatchQuery) {
- IMatchQuery matchQuery = (IMatchQuery) query;
+ Collector<T> result = new Collector<T>();
+ if (query instanceof IMatchQuery<?>) {
+ IMatchQuery<T> matchQuery = (IMatchQuery<T>) query;
while (iterator.hasNext()) {
- Object candidate = iterator.next();
+ T candidate = iterator.next();
if (matchQuery.isMatch(candidate)) {
result.accept(candidate);
if (++count >= limit)
@@ -51,8 +51,8 @@ public class LimitQuery extends ContextQuery implements ICompositeQuery {
return result;
}
- public IQuery[] getQueries() {
- return new IQuery[] {query};
+ public List<IQuery<T>> getQueries() {
+ return Collections.singletonList(query);
}
}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/MatchQuery.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/MatchQuery.java
index 0b1b89bdd..ec211b916 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/MatchQuery.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/MatchQuery.java
@@ -25,7 +25,7 @@ import org.eclipse.equinox.p2.metadata.query.IQueryResult;
* computation, to allow {@link IQueryable} implementations to optimize their
* execution of the query.
*/
-public abstract class MatchQuery implements IMatchQuery {
+public abstract class MatchQuery<T> implements IMatchQuery<T> {
/**
* Returns whether the given object satisfies the parameters of this query.
@@ -37,7 +37,7 @@ public abstract class MatchQuery implements IMatchQuery {
* @noreference This method is not intended to be referenced by clients.
* Clients should call {@link #perform(Iterator)}
*/
- public abstract boolean isMatch(Object candidate);
+ public abstract boolean isMatch(T candidate);
/**
* Gets the ID for this Query.
@@ -58,13 +58,13 @@ public abstract class MatchQuery implements IMatchQuery {
* Performs this query on the given iterator, passing all objects in the iterator
* that match the criteria of this query to the given result.
*/
- public final IQueryResult perform(Iterator iterator) {
- Collector result = new Collector();
+ public final IQueryResult<T> perform(Iterator<T> iterator) {
+ Collector<T> result = new Collector<T>();
prePerform();
try {
while (iterator.hasNext()) {
- Object candidate = iterator.next();
- if (isMatch(candidate))
+ T candidate = iterator.next();
+ if (candidate != null && isMatch(candidate))
if (!result.accept(candidate))
break;
}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/ObjectMatchQuery.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/ObjectMatchQuery.java
new file mode 100644
index 000000000..9fe833156
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/ObjectMatchQuery.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Cloudsmith Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cloudsmith Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.provisional.p2.metadata.query;
+
+/**
+ * Special implementation for use without generic support
+ */
+public abstract class ObjectMatchQuery extends MatchQuery<Object> {
+ public boolean isMatch(Object candidate) {
+ return true;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/PipedQuery.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/PipedQuery.java
index 6f1e0cf45..429e83e46 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/PipedQuery.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/PipedQuery.java
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.equinox.internal.provisional.p2.metadata.query;
-import java.util.Iterator;
+import java.util.*;
import org.eclipse.equinox.p2.metadata.query.IQuery;
import org.eclipse.equinox.p2.metadata.query.IQueryResult;
@@ -18,13 +18,18 @@ import org.eclipse.equinox.p2.metadata.query.IQueryResult;
* is executed in succession. The results from the ith sub-query
* are piped as input into the i+1th sub-query.
*/
-public class PipedQuery implements IQuery, ICompositeQuery {
- protected IQuery[] queries;
+public class PipedQuery<T> implements ICompositeQuery<T> {
+ protected final IQuery<T>[] queries;
- public PipedQuery(IQuery[] queries) {
+ public PipedQuery(IQuery<T>[] queries) {
this.queries = queries;
}
+ @SuppressWarnings("unchecked")
+ public PipedQuery(IQuery<T> query1, IQuery<T> query2) {
+ this(new IQuery[] {query1, query2});
+ }
+
/**
* Gets the ID for this Query.
*/
@@ -41,22 +46,14 @@ public class PipedQuery implements IQuery, ICompositeQuery {
}
/**
- * Set the queries of this composite. This is needed to allow subclasses of
- * CompsiteQuery to set the queries in a constructor
- */
- protected final void setQueries(IQuery[] queries) {
- this.queries = queries;
- }
-
- /**
* Returns the queries that make up this compound query
*/
- public IQuery[] getQueries() {
- return queries;
+ public List<IQuery<T>> getQueries() {
+ return Arrays.asList(queries);
}
- public IQueryResult perform(Iterator iterator) {
- IQueryResult last = Collector.EMPTY_COLLECTOR;
+ public IQueryResult<T> perform(Iterator<T> iterator) {
+ IQueryResult<T> last = Collector.emptyCollector();
if (queries.length > 0) {
last = queries[0].perform(iterator);
for (int i = 1; i < queries.length; i++)
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/QueryHelpers.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/QueryHelpers.java
index ab7407709..06579fa57 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/QueryHelpers.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/QueryHelpers.java
@@ -24,7 +24,7 @@ public class QueryHelpers {
*
* @noreference This method is not intended to be referenced by clients.
*/
- public static String getId(IQuery query) {
+ public static String getId(IQuery<?> query) {
return query.getClass().getName();
}
@@ -35,8 +35,8 @@ public class QueryHelpers {
*
* @noreference This method is not intended to be referenced by clients.
*/
- public static Object getProperty(IQuery query, String property) {
- Class clazz = query.getClass();
+ public static Object getProperty(IQuery<?> query, String property) {
+ Class<?> clazz = query.getClass();
Object result = null;
try {
Method method = clazz.getMethod("get" + property, new Class[0]); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/UpdateQuery.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/UpdateQuery.java
index b08122d25..2d5a2095f 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/UpdateQuery.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/query/UpdateQuery.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.equinox.internal.provisional.p2.metadata.query;
-
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnitPatch;
import org.eclipse.equinox.internal.provisional.p2.metadata.IUpdateDescriptor;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
@@ -20,24 +19,21 @@ import org.eclipse.equinox.p2.metadata.IRequirement;
* A query that finds all IUs that are considered an "Update" of the
* specified IU.
*/
-public class UpdateQuery extends MatchQuery {
+public class UpdateQuery extends MatchQuery<IInstallableUnit> {
private IInstallableUnit updateFrom;
public UpdateQuery(IInstallableUnit updateFrom) {
this.updateFrom = updateFrom;
}
- public boolean isMatch(Object obj) {
- if (!(obj instanceof IInstallableUnit))
- return false;
- if (obj instanceof IInstallableUnitPatch && !(updateFrom instanceof IInstallableUnitPatch)) {
- IInstallableUnitPatch potentialPatch = (IInstallableUnitPatch) obj;
+ public boolean isMatch(IInstallableUnit candidate) {
+ if (candidate instanceof IInstallableUnitPatch && !(updateFrom instanceof IInstallableUnitPatch)) {
+ IInstallableUnitPatch potentialPatch = (IInstallableUnitPatch) candidate;
IRequirement lifeCycle = potentialPatch.getLifeCycle();
if (lifeCycle == null)
return false;
return updateFrom.satisfies(lifeCycle);
}
- IInstallableUnit candidate = (IInstallableUnit) obj;
IUpdateDescriptor descriptor = candidate.getUpdateDescriptor();
if (descriptor != null && descriptor.isUpdateOf(updateFrom)) {
if (!updateFrom.getId().equals(candidate.getId()))
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/IInstallableUnit.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/IInstallableUnit.java
index 76ab1d44e..ed8788377 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/IInstallableUnit.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/IInstallableUnit.java
@@ -11,6 +11,7 @@
******************************************************************************/
package org.eclipse.equinox.p2.metadata;
+import java.util.List;
import java.util.Map;
import org.eclipse.equinox.internal.provisional.p2.metadata.*;
import org.eclipse.equinox.p2.metadata.query.IQuery;
@@ -20,7 +21,7 @@ import org.eclipse.equinox.p2.metadata.query.IQuery;
* @noextend This interface is not intended to be extended by clients.
* @since 2.0
*/
-public interface IInstallableUnit extends IVersionedId, Comparable {
+public interface IInstallableUnit extends IVersionedId, Comparable<IInstallableUnit> {
/**
* A capability namespace representing a particular InstallableUnit by id.
@@ -94,7 +95,7 @@ public interface IInstallableUnit extends IVersionedId, Comparable {
*/
public static final String PROP_PROVIDER = "org.eclipse.equinox.p2.provider"; //$NON-NLS-1$
- public IArtifactKey[] getArtifacts();
+ public List<IArtifactKey> getArtifacts();
/**
* Returns the filter on this installable unit. The filter is matched against
@@ -103,7 +104,7 @@ public interface IInstallableUnit extends IVersionedId, Comparable {
*
* See Profile#getSelectionContext.
*/
- public IQuery getFilter();
+ public IQuery<Boolean> getFilter();
/**
* Returns the fragments that have been bound to this installable unit, or
@@ -112,7 +113,7 @@ public interface IInstallableUnit extends IVersionedId, Comparable {
* @see #isResolved()
* @return The fragments bound to this installable unit, or <code>null</code>
*/
- public IInstallableUnitFragment[] getFragments();
+ public List<IInstallableUnitFragment> getFragments();
/**
* Returns an <i>unmodifiable copy</i> of the properties
@@ -120,7 +121,7 @@ public interface IInstallableUnit extends IVersionedId, Comparable {
*
* @return an <i>unmodifiable copy</i> of the properties of this installable unit.
*/
- public Map getProperties();
+ public Map<String, String> getProperties();
/**
* Returns the untranslated property of this installable unit associated with the given key.
@@ -148,13 +149,13 @@ public interface IInstallableUnit extends IVersionedId, Comparable {
*/
public String getProperty(String key, String locale);
- public IProvidedCapability[] getProvidedCapabilities();
+ public List<IProvidedCapability> getProvidedCapabilities();
- public IRequirement[] getRequiredCapabilities();
+ public List<IRequirement> getRequiredCapabilities();
- public IRequirement[] getMetaRequiredCapabilities();
+ public List<IRequirement> getMetaRequiredCapabilities();
- public ITouchpointData[] getTouchpointData();
+ public List<ITouchpointData> getTouchpointData();
public ITouchpointType getTouchpointType();
@@ -208,7 +209,7 @@ public interface IInstallableUnit extends IVersionedId, Comparable {
* </p>
* @return the licenses that apply to this installable unit
*/
- public ILicense[] getLicenses();
+ public List<ILicense> getLicenses();
/**
* Returns the licenses that apply to this installable unit. Any translation of the
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/IRequirement.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/IRequirement.java
index c7b846f3d..e1fa2ee06 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/IRequirement.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/IRequirement.java
@@ -22,9 +22,9 @@ public interface IRequirement {
public int getMax();
- public IQuery getMatches();
+ public IQuery<IInstallableUnit> getMatches();
- public IQuery getFilter();
+ public IQuery<Boolean> getFilter();
public boolean isGreedy();
} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/query/CategoryMemberQuery.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/query/CategoryMemberQuery.java
index f5578ce25..6ef5a4769 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/query/CategoryMemberQuery.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/query/CategoryMemberQuery.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.equinox.p2.metadata.query;
+import java.util.List;
+import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils;
import org.eclipse.equinox.internal.provisional.p2.metadata.query.MatchQuery;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.IRequirement;
@@ -21,8 +23,8 @@ import org.eclipse.equinox.p2.metadata.IRequirement;
*
* @since 2.0
*/
-public class CategoryMemberQuery extends MatchQuery {
- private IRequirement[] required;
+public class CategoryMemberQuery extends MatchQuery<IInstallableUnit> {
+ private final List<IRequirement> required;
/**
* Creates a new query that will return the members of the
@@ -35,21 +37,19 @@ public class CategoryMemberQuery extends MatchQuery {
if (CategoryQuery.isCategory(category))
this.required = category.getRequiredCapabilities();
else
- this.required = new IRequirement[0];
+ this.required = CollectionUtils.emptyList();
}
/*
* (non-Javadoc)
* @see org.eclipse.equinox.internal.provisional.p2.metadata.query.MatchQuery#isMatch(java.lang.Object)
*/
- public boolean isMatch(Object object) {
- if (!(object instanceof IInstallableUnit))
- return false;
- IInstallableUnit candidate = (IInstallableUnit) object;
+ public boolean isMatch(IInstallableUnit candidate) {
// since a category lists its members as requirements, then meeting
// any requirement means the candidate is a member of the category.
- for (int i = 0; i < required.length; i++)
- if (candidate.satisfies(required[i]))
+ int top = required.size();
+ for (int i = 0; i < top; i++)
+ if (candidate.satisfies(required.get(i)))
return true;
return false;
}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/query/CategoryQuery.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/query/CategoryQuery.java
index bdc7aecd7..92cfc143d 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/query/CategoryQuery.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/query/CategoryQuery.java
@@ -18,7 +18,7 @@ import org.eclipse.equinox.p2.metadata.IInstallableUnit;
* A query matching every {@link IInstallableUnit} that is a category.
* @since 2.0
*/
-public final class CategoryQuery extends MatchQuery {
+public final class CategoryQuery extends MatchQuery<IInstallableUnit> {
private static final String PROP_TYPE_CATEGORY = "org.eclipse.equinox.p2.type.category"; //$NON-NLS-1$
private IUPropertyQuery query;
@@ -26,7 +26,7 @@ public final class CategoryQuery extends MatchQuery {
query = new IUPropertyQuery(PROP_TYPE_CATEGORY, null);
}
- public boolean isMatch(Object candidate) {
+ public boolean isMatch(IInstallableUnit candidate) {
return query.isMatch(candidate);
}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/query/FragmentQuery.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/query/FragmentQuery.java
index 6d8cfb907..4c77258ec 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/query/FragmentQuery.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/query/FragmentQuery.java
@@ -19,7 +19,7 @@ import org.eclipse.equinox.p2.metadata.IInstallableUnit;
* A query matching every {@link IInstallableUnit} that is a category.
* @since 2.0
*/
-public final class FragmentQuery extends MatchQuery {
+public final class FragmentQuery extends MatchQuery<IInstallableUnit> {
private static final String PROP_TYPE_FRAGMENT = "org.eclipse.equinox.p2.type.fragment"; //$NON-NLS-1$
private IUPropertyQuery query;
@@ -27,7 +27,7 @@ public final class FragmentQuery extends MatchQuery {
query = new IUPropertyQuery(PROP_TYPE_FRAGMENT, null);
}
- public boolean isMatch(Object candidate) {
+ public boolean isMatch(IInstallableUnit candidate) {
return query.isMatch(candidate);
}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/query/GroupQuery.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/query/GroupQuery.java
index 50e1856af..84c2854e0 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/query/GroupQuery.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/query/GroupQuery.java
@@ -18,7 +18,7 @@ import org.eclipse.equinox.p2.metadata.IInstallableUnit;
* A query matching every {@link IInstallableUnit} that is a group.
* @since 2.0
*/
-public final class GroupQuery extends MatchQuery {
+public final class GroupQuery extends MatchQuery<IInstallableUnit> {
private static final String PROP_TYPE_GROUP = "org.eclipse.equinox.p2.type.group"; //$NON-NLS-1$
private IUPropertyQuery query;
@@ -26,7 +26,7 @@ public final class GroupQuery extends MatchQuery {
query = new IUPropertyQuery(PROP_TYPE_GROUP, null);
}
- public boolean isMatch(Object candidate) {
+ public boolean isMatch(IInstallableUnit candidate) {
return query.isMatch(candidate);
}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/query/IQuery.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/query/IQuery.java
index d440a5ae0..e3d3f044b 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/query/IQuery.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/query/IQuery.java
@@ -22,7 +22,7 @@ import org.eclipse.equinox.internal.provisional.p2.metadata.query.IQueryable;
* @noextend This interface is not intended to be extended by clients.
* @since 2.0
*/
-public interface IQuery {
+public interface IQuery<T> {
/**
* Evaluates the query for a specific input.
@@ -31,7 +31,7 @@ public interface IQuery {
* @return The results of the query. The collector returned must be
* the collector passed in.
*/
- public abstract IQueryResult perform(Iterator iterator);
+ public abstract IQueryResult<T> perform(Iterator<T> iterator);
/**
* Gets the ID for this Query.
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/query/IQueryResult.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/query/IQueryResult.java
index 351851f3b..79cf9b952 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/query/IQueryResult.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/query/IQueryResult.java
@@ -18,7 +18,7 @@ import org.eclipse.equinox.internal.provisional.p2.metadata.query.IQueryable;
* @since 2.0
*
*/
-public interface IQueryResult extends IQueryable {
+public interface IQueryResult<T> extends IQueryable<T> {
/**
* Returns whether this QueryResult is empty.
* @return <code>true</code> if this QueryResult has accepted any results,
@@ -31,7 +31,7 @@ public interface IQueryResult extends IQueryable {
*
* @return an iterator of the collected objects.
*/
- public Iterator iterator();
+ public Iterator<T> iterator();
/**
* Returns the collected objects as an array
@@ -41,18 +41,18 @@ public interface IQueryResult extends IQueryable {
* @throws ArrayStoreException the runtime type of the specified array is
* not a supertype of the runtime type of every collected object
*/
- public Object[] toArray(Class clazz);
+ public T[] toArray(Class<? extends T> clazz);
/**
* Creates a new Set copy with the contents of this query result. The
* copy can be altered without any side effects on its origin.
* @return A detached copy of the result.
*/
- public Set toSet();
+ public Set<T> toSet();
/**
* Returns a Set backed by this query result. The set is immutable.
* @return A Set backed by this query result.
*/
- public Set unmodifiableSet();
+ public Set<T> unmodifiableSet();
}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/query/PatchQuery.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/query/PatchQuery.java
index ec462dbf5..0b8290b05 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/query/PatchQuery.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/query/PatchQuery.java
@@ -18,7 +18,7 @@ import org.eclipse.equinox.p2.metadata.IInstallableUnit;
* A query matching every {@link IInstallableUnit} that is a patch.
* @since 2.0
*/
-public final class PatchQuery extends MatchQuery {
+public final class PatchQuery extends MatchQuery<IInstallableUnit> {
private static final String PROP_TYPE_PATCH = "org.eclipse.equinox.p2.type.patch"; //$NON-NLS-1$
private IUPropertyQuery query;
@@ -26,7 +26,7 @@ public final class PatchQuery extends MatchQuery {
query = new IUPropertyQuery(PROP_TYPE_PATCH, Boolean.TRUE.toString());
}
- public boolean isMatch(Object candidate) {
+ public boolean isMatch(IInstallableUnit candidate) {
return query.isMatch(candidate);
}
diff --git a/bundles/org.eclipse.equinox.p2.publisher/.classpath b/bundles/org.eclipse.equinox.p2.publisher/.classpath
index ef379494d..834ea833e 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/.classpath
+++ b/bundles/org.eclipse.equinox.p2.publisher/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <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.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" output="bin_ant" path="src_ant"/>
diff --git a/bundles/org.eclipse.equinox.p2.publisher/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.publisher/.settings/org.eclipse.jdt.core.prefs
index d1b455045..afe72633a 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.equinox.p2.publisher/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,4 @@
-#Thu Nov 27 14:50:33 EST 2008
+#Tue Dec 22 17:35:56 CET 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
org.eclipse.jdt.core.builder.duplicateResourceTask=warning
@@ -7,17 +7,17 @@ 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.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.compliance=1.5
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.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
org.eclipse.jdt.core.compiler.problem.deprecation=warning
@@ -25,7 +25,7 @@ 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.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
@@ -73,7 +73,6 @@ 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.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
@@ -88,7 +87,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enab
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.compiler.source=1.5
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
@@ -160,7 +159,6 @@ 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
diff --git a/bundles/org.eclipse.equinox.p2.publisher/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.publisher/META-INF/MANIFEST.MF
index 3e5c2aead..5dd31badd 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.publisher/META-INF/MANIFEST.MF
@@ -4,7 +4,8 @@ Bundle-SymbolicName: org.eclipse.equinox.p2.publisher;singleton:=true
Bundle-Version: 1.1.0.qualifier
Bundle-Name: %bundleName
Bundle-Vendor: %providerName
-Bundle-RequiredExecutionEnvironment: J2SE-1.4,
+Bundle-RequiredExecutionEnvironment: J2SE-1.5,
+ J2SE-1.4,
CDC-1.1/Foundation-1.1
Import-Package: javax.xml.parsers,
org.eclipse.equinox.app;version="1.0.0";resolution:=optional,
diff --git a/bundles/org.eclipse.equinox.p2.publisher/build.properties b/bundles/org.eclipse.equinox.p2.publisher/build.properties
index 23f024bf9..ad78f9038 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/build.properties
+++ b/bundles/org.eclipse.equinox.p2.publisher/build.properties
@@ -24,3 +24,5 @@ jars.compile.order = .,\
ant_tasks/publisher-ant.jar
extra.ant_tasks/publisher-ant.jar = platform:/plugin/org.apache.ant
jars.extra.classpath = platform:/plugin/org.apache.ant/lib/ant.jar
+javacTarget=jsr14
+javacSource=1.5
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/FileSetDescriptor.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/FileSetDescriptor.java
index 4fd08471c..aa1c2d235 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/FileSetDescriptor.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/FileSetDescriptor.java
@@ -16,8 +16,8 @@ import java.util.*;
public class FileSetDescriptor {
private final String key;
private String configSpec = null;
- private HashSet fileset = new HashSet();
- private final ArrayList permissions = new ArrayList();
+ private HashSet<File> fileset = new HashSet<File>();
+ private final ArrayList<String[]> permissions = new ArrayList<String[]>();
private String links = ""; //$NON-NLS-1$
public FileSetDescriptor(String key, String configSpec) {
@@ -51,11 +51,11 @@ public class FileSetDescriptor {
}
public String[][] getPermissions() {
- return (String[][]) permissions.toArray(new String[permissions.size()][]);
+ return permissions.toArray(new String[permissions.size()][]);
}
public File[] getFiles() {
- return (File[]) fileset.toArray(new File[fileset.size()]);
+ return fileset.toArray(new File[fileset.size()]);
}
public int size() {
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/QuotedTokenizer.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/QuotedTokenizer.java
index 452532749..d66af45cb 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/QuotedTokenizer.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/QuotedTokenizer.java
@@ -17,7 +17,7 @@ import java.util.NoSuchElementException;
* Tokenzier which supports quoting using '"'
* The resulting tokens will not contain the quote character '"' unless it was escaped '\"'
*/
-public class QuotedTokenizer implements Enumeration {
+public class QuotedTokenizer implements Enumeration<String> {
private StreamTokenizer tokenizer = null;
/**
@@ -132,7 +132,7 @@ public class QuotedTokenizer implements Enumeration {
return hasMoreTokens();
}
- public Object nextElement() {
+ public String nextElement() {
return nextToken();
}
}
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ExecutablesDescriptor.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ExecutablesDescriptor.java
index 6b2547f6e..a36103210 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ExecutablesDescriptor.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ExecutablesDescriptor.java
@@ -11,6 +11,8 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.publisher.eclipse;
+import java.io.File;
+
import java.io.*;
import java.util.*;
import org.eclipse.core.runtime.*;
@@ -23,7 +25,7 @@ import org.eclipse.osgi.service.environment.Constants;
public class ExecutablesDescriptor {
private File location;
- private Set files;
+ private Set<File> files;
private String executableName;
private boolean temporary = false;
private String os;
@@ -125,9 +127,9 @@ public class ExecutablesDescriptor {
this.executableName = executable;
this.location = location;
if (files == null)
- this.files = new HashSet(11);
+ this.files = new HashSet<File>(11);
else {
- this.files = new HashSet(files.length);
+ this.files = new HashSet<File>(files.length);
for (int i = 0; i < files.length; i++)
addAllFiles(files[i]);
}
@@ -138,7 +140,7 @@ public class ExecutablesDescriptor {
this.location = descriptor.location;
this.executableName = descriptor.executableName;
this.temporary = descriptor.temporary;
- this.files = new HashSet(descriptor.files);
+ this.files = new HashSet<File>(descriptor.files);
}
public void addAllFiles(File file) {
@@ -180,7 +182,7 @@ public class ExecutablesDescriptor {
}
public File[] getFiles() {
- File[] result = (File[]) files.toArray(new File[files.size()]);
+ File[] result = files.toArray(new File[files.size()]);
for (int i = 0; i < result.length; i++)
result[i] = new File(location, result[i].getPath());
return result;
@@ -223,8 +225,8 @@ public class ExecutablesDescriptor {
try {
tempFile = File.createTempFile("p2.brandingIron", ""); //$NON-NLS-1$ //$NON-NLS-2$
tempFile.delete();
- for (Iterator i = files.iterator(); i.hasNext();)
- FileUtils.copy(location, tempFile, (File) i.next(), true);
+ for (Iterator<File> i = files.iterator(); i.hasNext();)
+ FileUtils.copy(location, tempFile, i.next(), true);
} catch (IOException e) {
LogHelper.log(new Status(IStatus.ERROR, Activator.ID, "Error publishing artifacts", e)); //$NON-NLS-1$
}
@@ -245,9 +247,9 @@ public class ExecutablesDescriptor {
String targetExecutable = executableName;
String executableExtension = Constants.OS_WIN32.equals(os) ? ".exe" : ""; //$NON-NLS-1$ //$NON-NLS-2$
targetExecutable = executableName + executableExtension;
- Set filesCopy = new HashSet(files);
- for (Iterator i = filesCopy.iterator(); i.hasNext();) {
- File file = (File) i.next();
+ Set<File> filesCopy = new HashSet<File>(files);
+ for (Iterator<File> i = filesCopy.iterator(); i.hasNext();) {
+ File file = i.next();
String base = file.getParent();
// use String concatenation here because new File("", "foo") is absolute on at least windows...
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/eclipse/FeatureManifestParser.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/eclipse/FeatureManifestParser.java
index ae6239b7f..bae677e86 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/eclipse/FeatureManifestParser.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/eclipse/FeatureManifestParser.java
@@ -33,7 +33,7 @@ public class FeatureManifestParser extends DefaultHandler {
private URL url;
private StringBuffer characters = null;
- private List messageKeys = new ArrayList();
+ private List<String> messageKeys = new ArrayList<String>();
public FeatureManifestParser() {
this(true);
@@ -104,7 +104,7 @@ public class FeatureManifestParser extends DefaultHandler {
return result;
}
- public List getMessageKeys() {
+ public List<String> getMessageKeys() {
return messageKeys;
}
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/eclipse/FeatureParser.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/eclipse/FeatureParser.java
index 47a802066..08fd6a805 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/eclipse/FeatureParser.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/eclipse/FeatureParser.java
@@ -51,8 +51,8 @@ public class FeatureParser extends DefaultHandler {
input = new BufferedInputStream(new FileInputStream(file));
feature = parser.parse(input);
if (feature != null) {
- List messageKeys = parser.getMessageKeys();
- String[] keyStrings = (String[]) messageKeys.toArray(new String[messageKeys.size()]);
+ List<String> messageKeys = parser.getMessageKeys();
+ String[] keyStrings = messageKeys.toArray(new String[messageKeys.size()]);
feature.setLocalizations(LocalizationHelper.getDirPropertyLocalizations(location, "feature", null, keyStrings)); //$NON-NLS-1$
}
} catch (FileNotFoundException e) {
@@ -76,8 +76,8 @@ public class FeatureParser extends DefaultHandler {
InputStream input = new BufferedInputStream(jar.getInputStream(entry));
feature = parser.parse(input);
if (feature != null) {
- List messageKeys = parser.getMessageKeys();
- String[] keyStrings = (String[]) messageKeys.toArray(new String[messageKeys.size()]);
+ List<String> messageKeys = parser.getMessageKeys();
+ String[] keyStrings = messageKeys.toArray(new String[messageKeys.size()]);
feature.setLocalizations(LocalizationHelper.getJarPropertyLocalizations(location, "feature", null, keyStrings)); //$NON-NLS-1$
}
} catch (IOException e) {
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/eclipse/IProductDescriptor.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/eclipse/IProductDescriptor.java
index cdb7a70d8..b9d072ad3 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/eclipse/IProductDescriptor.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/eclipse/IProductDescriptor.java
@@ -12,7 +12,9 @@ package org.eclipse.equinox.internal.p2.publisher.eclipse;
import java.io.File;
import java.util.List;
-import java.util.Properties;
+import java.util.Map;
+import org.eclipse.equinox.internal.provisional.frameworkadmin.BundleInfo;
+import org.eclipse.equinox.p2.metadata.IVersionedId;
/**
* Represents a product file.
@@ -33,17 +35,17 @@ public interface IProductDescriptor {
* @param includeFragments whether or not to include the fragments in the return value
* @return the list of bundles in this product
*/
- public List getBundles(boolean includeFragments);
+ public List<IVersionedId> getBundles(boolean includeFragments);
/**
* Returns a list<VersionedName> of fragments that constitute this product.
*/
- public List getFragments();
+ public List<IVersionedId> getFragments();
/**
* Returns a List<VersionedName> of features that constitute this product.
*/
- public List getFeatures();
+ public List<IVersionedId> getFeatures();
/**
* Returns the path to the config.ini file as specified in the .product file.
@@ -98,7 +100,7 @@ public interface IProductDescriptor {
/**
* Returns the properties for a product file.
*/
- public Properties getConfigurationProperties();
+ public Map<String, String> getConfigurationProperties();
/**
* Returns a list of icons for this product for a given OS.
@@ -109,7 +111,7 @@ public interface IProductDescriptor {
* Returns a List<BundleInfo> for each bundle that has custom configuration data.
* @return A List<BundleInfo>
*/
- public List getBundleInfos();
+ public List<BundleInfo> getBundleInfos();
/**
* This is needed for config.ini files and p2 advice
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ProductFile.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ProductFile.java
index a2900bf87..8a99fdce8 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ProductFile.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ProductFile.java
@@ -17,6 +17,7 @@ import java.io.*;
import java.util.*;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
+import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils;
import org.eclipse.equinox.internal.provisional.frameworkadmin.BundleInfo;
import org.eclipse.equinox.internal.provisional.p2.metadata.VersionedId;
import org.eclipse.equinox.p2.metadata.IVersionedId;
@@ -118,25 +119,25 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor {
private SAXParser parser;
private String launcherName = null;
// private boolean useIco = false;
- private Map icons = new HashMap(6);
+ private Map<String, Collection<String>> icons = new HashMap<String, Collection<String>>(6);
private String configPath = null;
- private final Map platformSpecificConfigPaths = new HashMap();
+ private final Map<String, String> platformSpecificConfigPaths = new HashMap<String, String>();
private String configPlatform = null;
private String platformConfigPath = null;
private String id = null;
private String uid = null;
private boolean useFeatures = false;
- private List plugins = null;
- private List fragments = null;
- private List features = null;
+ private List<IVersionedId> plugins = null;
+ private List<IVersionedId> fragments = null;
+ private List<IVersionedId> features = null;
private String splashLocation = null;
private String productName = null;
private String application = null;
private String version = null;
private Properties launcherArgs = new Properties();
private File location;
- private List bundleInfos;
- private Properties properties;
+ private List<BundleInfo> bundleInfos;
+ private Map<String, String> properties;
private String licenseURL;
private String licenseText = null;
@@ -198,11 +199,11 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor {
* Returns the properties found in .product file. Properties
* are located in the <configurations> block of the file
*/
- public Properties getConfigurationProperties() {
- Properties result = properties != null ? properties : new Properties();
- if (application != null && !result.contains(PROPERTY_ECLIPSE_APPLICATION))
+ public Map<String, String> getConfigurationProperties() {
+ Map<String, String> result = properties != null ? properties : new HashMap<String, String>();
+ if (application != null && !result.containsKey(PROPERTY_ECLIPSE_APPLICATION))
result.put(PROPERTY_ECLIPSE_APPLICATION, application);
- if (id != null && !result.contains(PROPERTY_ECLIPSE_PRODUCT))
+ if (id != null && !result.containsKey(PROPERTY_ECLIPSE_PRODUCT))
result.put(PROPERTY_ECLIPSE_PRODUCT, id);
return result;
@@ -213,17 +214,17 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor {
* @param includeFragments Indicates whether or not fragments should
* be included in the list
*/
- public List getBundles(boolean includeFragments) {
- List p = plugins != null ? plugins : Collections.EMPTY_LIST;
+ public List<IVersionedId> getBundles(boolean includeFragments) {
+ List<IVersionedId> p = plugins != null ? plugins : CollectionUtils.<IVersionedId> emptyList();
if (!includeFragments)
return p;
- List f = fragments != null ? fragments : Collections.EMPTY_LIST;
+ List<IVersionedId> f = fragments != null ? fragments : CollectionUtils.<IVersionedId> emptyList();
int size = p.size() + f.size();
if (size == 0)
- return Collections.EMPTY_LIST;
+ return CollectionUtils.emptyList();
- List both = new ArrayList(size);
+ List<IVersionedId> both = new ArrayList<IVersionedId>(size);
both.addAll(p);
both.addAll(f);
return both;
@@ -234,37 +235,33 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor {
* in the product file.
* @return A List<BundleInfo>
*/
- public List getBundleInfos() {
- return bundleInfos != null ? bundleInfos : Collections.EMPTY_LIST;
+ public List<BundleInfo> getBundleInfos() {
+ return bundleInfos != null ? bundleInfos : CollectionUtils.<BundleInfo> emptyList();
}
/**
* Returns a list<VersionedName> of fragments that constitute this product.
*/
- public List getFragments() {
- if (fragments == null)
- return Collections.EMPTY_LIST;
- return fragments;
+ public List<IVersionedId> getFragments() {
+ return fragments != null ? fragments : CollectionUtils.<IVersionedId> emptyList();
}
/**
* Returns a List<VersionedName> of features that constitute this product.
*/
- public List getFeatures() {
- if (features == null)
- return Collections.EMPTY_LIST;
- return features;
+ public List<IVersionedId> getFeatures() {
+ return features != null ? features : CollectionUtils.<IVersionedId> emptyList();
}
public String[] getIcons(String os) {
- Collection result = (Collection) icons.get(os);
+ Collection<String> result = icons.get(os);
if (result == null)
return null;
- return (String[]) result.toArray(new String[result.size()]);
+ return result.toArray(new String[result.size()]);
}
public String getConfigIniPath(String os) {
- String specific = (String) platformSpecificConfigPaths.get(os);
+ String specific = platformSpecificConfigPaths.get(os);
return specific == null ? configPath : specific;
}
@@ -506,7 +503,7 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor {
if (value == null)
value = ""; //$NON-NLS-1$
if (properties == null)
- properties = new Properties();
+ properties = new HashMap<String, String>();
properties.put(name, value);
}
@@ -524,7 +521,7 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor {
if (value != null)
info.setMarkedAsStarted(Boolean.valueOf(value).booleanValue());
if (bundleInfos == null)
- bundleInfos = new ArrayList();
+ bundleInfos = new ArrayList<BundleInfo>();
bundleInfos.add(info);
}
@@ -644,11 +641,11 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor {
IVersionedId name = new VersionedId(attributes.getValue(ATTRIBUTE_ID), attributes.getValue(ATTRIBUTE_VERSION));
if (fragment != null && new Boolean(fragment).booleanValue()) {
if (fragments == null)
- fragments = new ArrayList();
+ fragments = new ArrayList<IVersionedId>();
fragments.add(name);
} else {
if (plugins == null)
- plugins = new ArrayList();
+ plugins = new ArrayList<IVersionedId>();
plugins.add(name);
}
}
@@ -656,7 +653,7 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor {
private void processFeature(Attributes attributes) {
IVersionedId name = new VersionedId(attributes.getValue(ATTRIBUTE_ID), attributes.getValue(ATTRIBUTE_VERSION));
if (features == null)
- features = new ArrayList();
+ features = new ArrayList<IVersionedId>();
features.add(name);
}
@@ -703,9 +700,9 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor {
private void addIcon(String os, String value) {
if (value == null)
return;
- Collection list = (Collection) icons.get(os);
+ Collection<String> list = icons.get(os);
if (list == null) {
- list = new ArrayList(6);
+ list = new ArrayList<String>(6);
icons.put(os, list);
}
if (!new File(value).isAbsolute())
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/swt/tools/IconExe.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/swt/tools/IconExe.java
index 3efd45525..6367a40b9 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/swt/tools/IconExe.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/swt/tools/IconExe.java
@@ -25,33 +25,33 @@ import java.util.*;
* Know To Start Programming 64-Bit Windows Systems".
*/
public class IconExe {
-
- /**
- * Replace the Desktop icons provided in the Windows executable program
- * with matching icons provided by the user.
- *
- * Takes 2 arguments
- * argument 0: the Windows executable e.g c:/eclipse/eclipse.exe
- * argument 1: The .ico file to write to the given executable e.g. c:/myApp.ico
- *
- * Note 1. Write access to the executable program is required. As a result, that
- * program must not be currently running or edited elsewhere.
- *
- * Note 2. The Eclipse 3.4 launcher requires an .ico file with the following 7 images (in any order).
- * 1. 48x48, 32 bit (RGB / Alpha Channel)
- * 2. 32x32, 32 bit (RGB / Alpha Channel)
- * 3. 16x16, 32 bit (RGB / Alpha Channel)
- * 4. 48x48, 8 bit (256 colors)
- * 5. 32x32, 8 bit (256 colors)
- * 6. 24x24, 8 bit (256 colors)
- * 7. 16x16, 8 bit (256 colors)
- * A user icon matching exactly the width/height/depth of an executable icon will be written
- * to the executable and will replace that executable icon. If an executable icon
- * does not match a user icon, it is silently left as is.
- *
- * Note 3. This function modifies the content of the executable program and may cause
- * its corruption.
- */
+
+ /**
+ * Replace the Desktop icons provided in the Windows executable program
+ * with matching icons provided by the user.
+ *
+ * Takes 2 arguments
+ * argument 0: the Windows executable e.g c:/eclipse/eclipse.exe
+ * argument 1: The .ico file to write to the given executable e.g. c:/myApp.ico
+ *
+ * Note 1. Write access to the executable program is required. As a result, that
+ * program must not be currently running or edited elsewhere.
+ *
+ * Note 2. The Eclipse 3.4 launcher requires an .ico file with the following 7 images (in any order).
+ * 1. 48x48, 32 bit (RGB / Alpha Channel)
+ * 2. 32x32, 32 bit (RGB / Alpha Channel)
+ * 3. 16x16, 32 bit (RGB / Alpha Channel)
+ * 4. 48x48, 8 bit (256 colors)
+ * 5. 32x32, 8 bit (256 colors)
+ * 6. 24x24, 8 bit (256 colors)
+ * 7. 16x16, 8 bit (256 colors)
+ * A user icon matching exactly the width/height/depth of an executable icon will be written
+ * to the executable and will replace that executable icon. If an executable icon
+ * does not match a user icon, it is silently left as is.
+ *
+ * Note 3. This function modifies the content of the executable program and may cause
+ * its corruption.
+ */
public static void main(String[] args) throws Exception {
if (args.length < 2) {
System.err.println("Usage: IconExe <windows executable> <ico file>"); //$NON-NLS-1$
@@ -59,7 +59,7 @@ public class IconExe {
}
ImageLoader loader = new ImageLoader();
- List images = new ArrayList();
+ List<ImageData> images = new ArrayList<ImageData>();
for (int i = 1; i < args.length; i++) {
try {
//An ICO should contain 7 images, a BMP will contain 1
@@ -72,40 +72,41 @@ public class IconExe {
}
}
ImageData[] data = new ImageData[images.size()];
- data = (ImageData[]) images.toArray(data);
-
+ data = images.toArray(data);
+
int nMissing = unloadIcons(args[0], data);
if (nMissing != 0)
System.err.println("Error - " + nMissing + " icon(s) not replaced in " + args[0] + " using " + args[1]); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
-
+
/* Implementation */
/**
* Retrieve the Desktop icons provided in the Windows executable program.
* These icons are typically shown in various places of the Windows desktop.
*
- * Note. The Eclipse 3.4 launcher returns the following 7 images (in any order).
- * 1. 48x48, 32 bit (RGB / Alpha Channel)
- * 2. 32x32, 32 bit (RGB / Alpha Channel)
- * 3. 16x16, 32 bit (RGB / Alpha Channel)
- * 4. 48x48, 8 bit (256 colors)
- * 5. 32x32, 8 bit (256 colors)
- * 6. 24x24, 8 bit (256 colors)
- * 7. 16x16, 8 bit (256 colors)
+ * Note. The Eclipse 3.4 launcher returns the following 7 images (in any order).
+ * 1. 48x48, 32 bit (RGB / Alpha Channel)
+ * 2. 32x32, 32 bit (RGB / Alpha Channel)
+ * 3. 16x16, 32 bit (RGB / Alpha Channel)
+ * 4. 48x48, 8 bit (256 colors)
+ * 5. 32x32, 8 bit (256 colors)
+ * 6. 24x24, 8 bit (256 colors)
+ * 7. 16x16, 8 bit (256 colors)
*
* @param program the Windows executable e.g c:/eclipse/eclipse.exe
- */
+ */
static ImageData[] loadIcons(String program) throws FileNotFoundException, IOException {
RandomAccessFile raf = new RandomAccessFile(program, "r"); //$NON-NLS-1$
IconExe iconExe = new IconExe();
IconResInfo[] iconInfo = iconExe.getIcons(raf);
ImageData[] data = new ImageData[iconInfo.length];
- for (int i = 0; i < data.length; i++) data[i] = iconInfo[i].data;
+ for (int i = 0; i < data.length; i++)
+ data[i] = iconInfo[i].data;
raf.close();
return data;
}
-
+
/**
* Replace the Desktop icons provided in the Windows executable program
* with icons provided by the user.
@@ -125,10 +126,10 @@ public class IconExe {
* 1. 48x48, 32 bit (RGB / Alpha Channel)
* 2. 32x32, 32 bit (RGB / Alpha Channel)
* 3. 16x16, 32 bit (RGB / Alpha Channel)
- * 4. 48x48, 8 bit (256 colors)
+ * 4. 48x48, 8 bit (256 colors)
* 5. 32x32, 8 bit (256 colors)
- * 6. 24x24, 8 bit (256 colors)
- * 7. 16x16, 8 bit (256 colors)
+ * 6. 24x24, 8 bit (256 colors)
+ * 7. 16x16, 8 bit (256 colors)
*
* Note 4. This function modifies the content of the executable program and may cause
* its corruption.
@@ -136,16 +137,16 @@ public class IconExe {
* @param program the Windows executable e.g c:/eclipse/eclipse.exe
* @param icons to write to the given executable
* @return the number of icons from the original program that were not successfully replaced (0 if success)
- */
+ */
static int unloadIcons(String program, ImageData[] icons) throws FileNotFoundException, IOException {
RandomAccessFile raf = new RandomAccessFile(program, "rw"); //$NON-NLS-1$
IconExe iconExe = new IconExe();
IconResInfo[] iconInfo = iconExe.getIcons(raf);
// Display an error if no icons found in target executable.
if (iconInfo.length == 0) {
- System.err.println("Warning - no icons detected in \"" + program + "\"."); //$NON-NLS-1$ //$NON-NLS-2$
- raf.close();
- return 0;
+ System.err.println("Warning - no icons detected in \"" + program + "\"."); //$NON-NLS-1$ //$NON-NLS-2$
+ raf.close();
+ return 0;
}
int cnt = 0;
for (int i = 0; i < iconInfo.length; i++) {
@@ -163,34 +164,39 @@ public class IconExe {
raf.close();
return iconInfo.length - cnt;
}
-
+
public static final String VERSION = "20050124"; //$NON-NLS-1$
-
+
static final boolean DEBUG = false;
+
public static class IconResInfo {
ImageData data;
int offset;
int size;
}
-
+
IconResInfo[] iconInfo = null;
int iconCnt;
-
+
IconResInfo[] getIcons(RandomAccessFile raf) throws IOException {
iconInfo = new IconResInfo[4];
iconCnt = 0;
IMAGE_DOS_HEADER imageDosHeader = new IMAGE_DOS_HEADER();
read(raf, imageDosHeader);
- if (imageDosHeader.e_magic != IMAGE_DOS_SIGNATURE) return new IconResInfo[0];
+ if (imageDosHeader.e_magic != IMAGE_DOS_SIGNATURE)
+ return new IconResInfo[0];
int imageNtHeadersOffset = imageDosHeader.e_lfanew;
raf.seek(imageNtHeadersOffset);
IMAGE_NT_HEADERS imageNtHeaders = new IMAGE_NT_HEADERS();
read(raf, imageNtHeaders);
- if (imageNtHeaders.Signature != IMAGE_NT_SIGNATURE) return new IconResInfo[0];
+ if (imageNtHeaders.Signature != IMAGE_NT_SIGNATURE)
+ return new IconResInfo[0];
// DumpResources
int resourcesRVA = imageNtHeaders.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_RESOURCE].VirtualAddress;
- if (resourcesRVA == 0) return new IconResInfo[0];
- if (DEBUG) System.out.println("* Resources (RVA= "+resourcesRVA+")"); //$NON-NLS-1$ //$NON-NLS-2$
+ if (resourcesRVA == 0)
+ return new IconResInfo[0];
+ if (DEBUG)
+ System.out.println("* Resources (RVA= " + resourcesRVA + ")"); //$NON-NLS-1$ //$NON-NLS-2$
IMAGE_SECTION_HEADER imageSectionHeader = new IMAGE_SECTION_HEADER();
int firstSectionOffset = imageNtHeadersOffset + IMAGE_NT_HEADERS.FIELD_OFFSET_OptionalHeader + imageNtHeaders.FileHeader.SizeOfOptionalHeader;
raf.seek(firstSectionOffset);
@@ -203,7 +209,8 @@ public class IconExe {
break;
}
}
- if (!found) return new IconResInfo[0];
+ if (!found)
+ return new IconResInfo[0];
int delta = imageSectionHeader.VirtualAddress - imageSectionHeader.PointerToRawData;
int imageResourceDirectoryOffset = resourcesRVA - delta;
dumpResourceDirectory(raf, imageResourceDirectoryOffset, imageResourceDirectoryOffset, delta, 0, 0, false);
@@ -215,3125 +222,3118 @@ public class IconExe {
return iconInfo;
}
-void dumpResourceDirectory(RandomAccessFile raf, int imageResourceDirectoryOffset, int resourceBase, int delta, int type, int level, boolean rt_icon_root) throws IOException {
- if (DEBUG) System.out.println("** LEVEL "+level); //$NON-NLS-1$
+ void dumpResourceDirectory(RandomAccessFile raf, int imageResourceDirectoryOffset, int resourceBase, int delta, int type, int level, boolean rt_icon_root) throws IOException {
+ if (DEBUG)
+ System.out.println("** LEVEL " + level); //$NON-NLS-1$
- IMAGE_RESOURCE_DIRECTORY imageResourceDirectory = new IMAGE_RESOURCE_DIRECTORY();
- raf.seek(imageResourceDirectoryOffset);
- read(raf, imageResourceDirectory);
+ IMAGE_RESOURCE_DIRECTORY imageResourceDirectory = new IMAGE_RESOURCE_DIRECTORY();
+ raf.seek(imageResourceDirectoryOffset);
+ read(raf, imageResourceDirectory);
- if (DEBUG) {
- String sType = ""+type; //$NON-NLS-1$
- // level 1 resources are resource types
- if (level == 1) {
- System.out.println("___________________________"); //$NON-NLS-1$
- if (type == RT_ICON) sType = "RT_ICON"; //$NON-NLS-1$
- if (type == RT_GROUP_ICON) sType = "RT_GROUP_ICON"; //$NON-NLS-1$
+ if (DEBUG) {
+ String sType = "" + type; //$NON-NLS-1$
+ // level 1 resources are resource types
+ if (level == 1) {
+ System.out.println("___________________________"); //$NON-NLS-1$
+ if (type == RT_ICON)
+ sType = "RT_ICON"; //$NON-NLS-1$
+ if (type == RT_GROUP_ICON)
+ sType = "RT_GROUP_ICON"; //$NON-NLS-1$
+ }
+ System.out.println("Resource Directory [" + sType + "]" + " (Named " + imageResourceDirectory.NumberOfNamedEntries + ", ID " + imageResourceDirectory.NumberOfIdEntries + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
}
- System.out.println("Resource Directory ["+sType+"]"+" (Named "+imageResourceDirectory.NumberOfNamedEntries+", ID "+imageResourceDirectory.NumberOfIdEntries+")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- }
- IMAGE_RESOURCE_DIRECTORY_ENTRY[] imageResourceDirectoryEntries = new IMAGE_RESOURCE_DIRECTORY_ENTRY[imageResourceDirectory.NumberOfIdEntries];
- for (int i = 0; i < imageResourceDirectoryEntries.length; i++) {
- imageResourceDirectoryEntries[i] = new IMAGE_RESOURCE_DIRECTORY_ENTRY();
- read(raf, imageResourceDirectoryEntries[i]);
- }
- for (int i = 0; i < imageResourceDirectoryEntries.length; i++) {
- if (imageResourceDirectoryEntries[i].DataIsDirectory) {
- dumpResourceDirectory(raf, imageResourceDirectoryEntries[i].OffsetToDirectory + resourceBase, resourceBase, delta, imageResourceDirectoryEntries[i].Id, level + 1, rt_icon_root ? true : type == RT_ICON);
- } else {
- // Resource found
- /// pResDirEntry->Name
- IMAGE_RESOURCE_DIRECTORY_ENTRY irde = imageResourceDirectoryEntries[i];
- IMAGE_RESOURCE_DATA_ENTRY data = new IMAGE_RESOURCE_DATA_ENTRY();
- raf.seek(imageResourceDirectoryEntries[i].OffsetToData + resourceBase);
- read(raf, data);
- if (DEBUG) System.out.println("Resource Id "+irde.Id+" Data Offset RVA "+data.OffsetToData+", Size "+data.Size); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- if (rt_icon_root) {
- if (DEBUG) System.out.println("iconcnt "+iconCnt+" |"+iconInfo.length); //$NON-NLS-1$ //$NON-NLS-2$
- iconInfo[iconCnt] = new IconResInfo();
- iconInfo[iconCnt].data = parseIcon(raf, data.OffsetToData - delta, data.Size);
- iconInfo[iconCnt].offset = data.OffsetToData - delta;
- iconInfo[iconCnt].size = data.Size;
- iconCnt++;
- if (iconCnt == iconInfo.length) {
- IconResInfo[] newArray = new IconResInfo[iconInfo.length + 4];
- System.arraycopy(iconInfo, 0, newArray, 0, iconInfo.length);
- iconInfo = newArray;
+ IMAGE_RESOURCE_DIRECTORY_ENTRY[] imageResourceDirectoryEntries = new IMAGE_RESOURCE_DIRECTORY_ENTRY[imageResourceDirectory.NumberOfIdEntries];
+ for (int i = 0; i < imageResourceDirectoryEntries.length; i++) {
+ imageResourceDirectoryEntries[i] = new IMAGE_RESOURCE_DIRECTORY_ENTRY();
+ read(raf, imageResourceDirectoryEntries[i]);
+ }
+ for (int i = 0; i < imageResourceDirectoryEntries.length; i++) {
+ if (imageResourceDirectoryEntries[i].DataIsDirectory) {
+ dumpResourceDirectory(raf, imageResourceDirectoryEntries[i].OffsetToDirectory + resourceBase, resourceBase, delta, imageResourceDirectoryEntries[i].Id, level + 1, rt_icon_root ? true : type == RT_ICON);
+ } else {
+ // Resource found
+ /// pResDirEntry->Name
+ IMAGE_RESOURCE_DIRECTORY_ENTRY irde = imageResourceDirectoryEntries[i];
+ IMAGE_RESOURCE_DATA_ENTRY data = new IMAGE_RESOURCE_DATA_ENTRY();
+ raf.seek(imageResourceDirectoryEntries[i].OffsetToData + resourceBase);
+ read(raf, data);
+ if (DEBUG)
+ System.out.println("Resource Id " + irde.Id + " Data Offset RVA " + data.OffsetToData + ", Size " + data.Size); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ if (rt_icon_root) {
+ if (DEBUG)
+ System.out.println("iconcnt " + iconCnt + " |" + iconInfo.length); //$NON-NLS-1$ //$NON-NLS-2$
+ iconInfo[iconCnt] = new IconResInfo();
+ iconInfo[iconCnt].data = parseIcon(raf, data.OffsetToData - delta, data.Size);
+ iconInfo[iconCnt].offset = data.OffsetToData - delta;
+ iconInfo[iconCnt].size = data.Size;
+ iconCnt++;
+ if (iconCnt == iconInfo.length) {
+ IconResInfo[] newArray = new IconResInfo[iconInfo.length + 4];
+ System.arraycopy(iconInfo, 0, newArray, 0, iconInfo.length);
+ iconInfo = newArray;
+ }
}
}
}
- }
-}
-
-static ImageData parseIcon(RandomAccessFile raf, int offset, int size) throws IOException {
- raf.seek(offset);
- BITMAPINFO bitmapInfo = new BITMAPINFO();
- read(raf, bitmapInfo);
- bitmapInfo.bmiHeader.biHeight /= 2;
- int width = bitmapInfo.bmiHeader.biWidth;
- int height = bitmapInfo.bmiHeader.biHeight;
- int depth = bitmapInfo.bmiHeader.biBitCount;
-
- PaletteData palette = loadPalette(bitmapInfo.bmiHeader, raf);
- byte[] shapeData = loadData(bitmapInfo.bmiHeader, raf);
- bitmapInfo.bmiHeader.biBitCount = 1;
- byte[] maskData = loadData(bitmapInfo.bmiHeader, raf);
- maskData = convertPad(maskData, width, height, 1, 4, 2);
- bitInvertData(maskData, 0, maskData.length);
- return ImageData.internal_new(
- width,
- height,
- depth,
- palette,
- 4,
- shapeData,
- 2,
- maskData,
- null,
- -1,
- -1,
- SWT.IMAGE_ICO,
- 0,
- 0,
- 0,
- 0);
-}
-
-static byte[] bitInvertData(byte[] data, int startIndex, int endIndex) {
- // Destructively bit invert data in the given byte array.
- for (int i = startIndex; i < endIndex; i++) {
- data[i] = (byte)(255 - data[i - startIndex]);
}
- return data;
-}
-static final byte[] convertPad(byte[] data, int width, int height, int depth, int pad, int newPad) {
- if (pad == newPad) return data;
- int stride = (width * depth + 7) / 8;
- int bpl = (stride + (pad - 1)) / pad * pad;
- int newBpl = (stride + (newPad - 1)) / newPad * newPad;
- byte[] newData = new byte[height * newBpl];
- int srcIndex = 0, destIndex = 0;
- for (int y = 0; y < height; y++) {
- System.arraycopy(data, srcIndex, newData, destIndex, newBpl);
- srcIndex += bpl;
- destIndex += newBpl;
- }
- return newData;
-}
-static PaletteData loadPalette(BITMAPINFOHEADER bih, RandomAccessFile raf) throws IOException {
- int depth = bih.biBitCount;
- if (depth <= 8) {
- int numColors = bih.biClrUsed;
- if (numColors == 0) {
- numColors = 1 << depth;
- } else {
- if (numColors > 256)
- numColors = 256;
+ static ImageData parseIcon(RandomAccessFile raf, int offset, int size) throws IOException {
+ raf.seek(offset);
+ BITMAPINFO bitmapInfo = new BITMAPINFO();
+ read(raf, bitmapInfo);
+ bitmapInfo.bmiHeader.biHeight /= 2;
+ int width = bitmapInfo.bmiHeader.biWidth;
+ int height = bitmapInfo.bmiHeader.biHeight;
+ int depth = bitmapInfo.bmiHeader.biBitCount;
+
+ PaletteData palette = loadPalette(bitmapInfo.bmiHeader, raf);
+ byte[] shapeData = loadData(bitmapInfo.bmiHeader, raf);
+ bitmapInfo.bmiHeader.biBitCount = 1;
+ byte[] maskData = loadData(bitmapInfo.bmiHeader, raf);
+ maskData = convertPad(maskData, width, height, 1, 4, 2);
+ bitInvertData(maskData, 0, maskData.length);
+ return ImageData.internal_new(width, height, depth, palette, 4, shapeData, 2, maskData, null, -1, -1, SWT.IMAGE_ICO, 0, 0, 0, 0);
+ }
+
+ static byte[] bitInvertData(byte[] data, int startIndex, int endIndex) {
+ // Destructively bit invert data in the given byte array.
+ for (int i = startIndex; i < endIndex; i++) {
+ data[i] = (byte) (255 - data[i - startIndex]);
}
- byte[] buf = new byte[numColors * 4];
- raf.read(buf);
- return paletteFromBytes(buf, numColors);
- }
- if (depth == 16) return new PaletteData(0x7C00, 0x3E0, 0x1F);
- if (depth == 24) return new PaletteData(0xFF, 0xFF00, 0xFF0000);
- return new PaletteData(0xFF00, 0xFF0000, 0xFF000000);
-}
-static PaletteData paletteFromBytes(byte[] bytes, int numColors) {
- int bytesOffset = 0;
- RGB[] colors = new RGB[numColors];
- for (int i = 0; i < numColors; i++) {
- colors[i] = new RGB(bytes[bytesOffset + 2] & 0xFF,
- bytes[bytesOffset + 1] & 0xFF,
- bytes[bytesOffset] & 0xFF);
- bytesOffset += 4;
- }
- return new PaletteData(colors);
-}
-static byte[] loadData(BITMAPINFOHEADER bih, RandomAccessFile raf) throws IOException {
- int stride = (bih.biWidth * bih.biBitCount + 7) / 8;
- stride = (stride + 3) / 4 * 4; // Round up to 4 byte multiple
- byte[] data = loadData(bih, raf, stride);
- flipScanLines(data, stride, bih.biHeight);
- return data;
-}
-static void flipScanLines(byte[] data, int stride, int height) {
- int i1 = 0;
- int i2 = (height - 1) * stride;
- for (int i = 0; i < height / 2; i++) {
- for (int index = 0; index < stride; index++) {
- byte b = data[index + i1];
- data[index + i1] = data[index + i2];
- data[index + i2] = b;
- }
- i1 += stride;
- i2 -= stride;
+ return data;
}
-}
-static byte[] loadData(BITMAPINFOHEADER bih, RandomAccessFile raf, int stride) throws IOException {
- int dataSize = bih.biHeight * stride;
- byte[] data = new byte[dataSize];
- int cmp = bih.biCompression;
- if (cmp == 0) { // BMP_NO_COMPRESSION
- raf.read(data);
- } else {
- if (DEBUG) System.out.println("ICO cannot be compressed?"); //$NON-NLS-1$
- }
- return data;
-}
-static void unloadIcon(RandomAccessFile raf, ImageData icon) throws IOException {
- int sizeImage = (((icon.width * icon.depth + 31) / 32 * 4) +
- ((icon.width + 31) / 32 * 4)) * icon.height;
- write4(raf, BMPHeaderFixedSize);
- write4(raf, icon.width);
- write4(raf, icon.height * 2);
- writeU2(raf, 1);
- writeU2(raf, icon.depth);
- write4(raf, 0);
- write4(raf, sizeImage);
- write4(raf, 0);
- write4(raf, 0);
- write4(raf, icon.palette.colors != null ? icon.palette.colors.length : 0);
- write4(raf, 0);
-
- byte[] rgbs = paletteToBytes(icon.palette);
- raf.write(rgbs);
- unloadShapeData(raf, icon);
- unloadMaskData(raf, icon);
-}
-static byte[] paletteToBytes(PaletteData pal) {
- int n = pal.colors == null ? 0 : (pal.colors.length < 256 ? pal.colors.length : 256);
- byte[] bytes = new byte[n * 4];
- int offset = 0;
- for (int i = 0; i < n; i++) {
- RGB col = pal.colors[i];
- bytes[offset] = (byte)col.blue;
- bytes[offset + 1] = (byte)col.green;
- bytes[offset + 2] = (byte)col.red;
- offset += 4;
- }
- return bytes;
-}
-static void unloadMaskData(RandomAccessFile raf, ImageData icon) {
- ImageData mask = icon.getTransparencyMask();
- int bpl = (icon.width + 7) / 8;
- int pad = mask.scanlinePad;
- int srcBpl = (bpl + pad - 1) / pad * pad;
- int destBpl = (bpl + 3) / 4 * 4;
- byte[] buf = new byte[destBpl];
- int offset = (icon.height - 1) * srcBpl;
- byte[] data = mask.data;
- try {
- for (int i = 0; i < icon.height; i++) {
- System.arraycopy(data, offset, buf, 0, bpl);
- bitInvertData(buf, 0, bpl);
- raf.write(buf, 0, destBpl);
- offset -= srcBpl;
- }
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
-}
-static void unloadShapeData(RandomAccessFile raf, ImageData icon) {
- int bpl = (icon.width * icon.depth + 7) / 8;
- int pad = icon.scanlinePad;
- int srcBpl = (bpl + pad - 1) / pad * pad;
- int destBpl = (bpl + 3) / 4 * 4;
- byte[] buf = new byte[destBpl];
- int offset = (icon.height - 1) * srcBpl;
- byte[] data = icon.data;
- try {
- for (int i = 0; i < icon.height; i++) {
- System.arraycopy(data, offset, buf, 0, bpl);
- raf.write(buf, 0, destBpl);
- offset -= srcBpl;
- }
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
+ static final byte[] convertPad(byte[] data, int width, int height, int depth, int pad, int newPad) {
+ if (pad == newPad)
+ return data;
+ int stride = (width * depth + 7) / 8;
+ int bpl = (stride + (pad - 1)) / pad * pad;
+ int newBpl = (stride + (newPad - 1)) / newPad * newPad;
+ byte[] newData = new byte[height * newBpl];
+ int srcIndex = 0, destIndex = 0;
+ for (int y = 0; y < height; y++) {
+ System.arraycopy(data, srcIndex, newData, destIndex, newBpl);
+ srcIndex += bpl;
+ destIndex += newBpl;
+ }
+ return newData;
}
-}
-static boolean readIconGroup(RandomAccessFile raf, int offset, int size) throws IOException {
- raf.seek(offset);
- NEWHEADER newHeader = new NEWHEADER();
- read(raf, newHeader);
- if (newHeader.ResType != RES_ICON) return false;
- RESDIR[] resDir = new RESDIR[newHeader.ResCount];
- for (int i = 0; i < newHeader.ResCount; i++) {
- resDir[i] = new RESDIR();
- read(raf, resDir[i]);
- }
- return true;
-}
-
-static void copyFile(String src, String dst) throws FileNotFoundException, IOException {
- File srcFile = new File(src);
- File dstFile = new File(dst);
- InputStream in = new BufferedInputStream(new FileInputStream(srcFile));
- OutputStream out = new BufferedOutputStream(new FileOutputStream(dstFile));
- int c;
- while ((c = in.read()) != -1) out.write(c);
- in.close();
- out.close();
-}
-
-/* IO utilities to parse Windows executable */
-static final int IMAGE_DOS_SIGNATURE = 0x5a4d;
-static final int IMAGE_NT_SIGNATURE = 0x00004550;
-static final int IMAGE_DIRECTORY_ENTRY_RESOURCE = 2;
-static final int RES_ICON = 1;
-static final int RT_ICON = 3;
-static final int RT_GROUP_ICON = 14;
-static final int BMPHeaderFixedSize = 40;
-static final int IMAGE_NT_OPTIONAL_HDR64_MAGIC = 0x20b;
-static final int IMAGE_NT_OPTIONAL_HDR32_MAGIC = 0x10b;
-
-public static class IMAGE_DOS_HEADER {
- int e_magic; // WORD
- int e_cblp; // WORD
- int e_cp; // WORD
- int e_crlc; // WORD
- int e_cparhdr; // WORD
- int e_minalloc; // WORD
- int e_maxalloc; // WORD
- int e_ss; // WORD
- int e_sp; // WORD
- int e_csum; // WORD
- int e_ip; // WORD
- int e_cs; // WORD
- int e_lfarlc; // WORD
- int e_ovno; // WORD
- int[] e_res = new int[4]; // WORD[4]
- int e_oemid; // WORD
- int e_oeminfo; // WORD
- int[] e_res2 = new int[10]; // WORD[10]
- int e_lfanew; // LONG
-}
-
-public static class IMAGE_FILE_HEADER {
- int Machine; // WORD
- int NumberOfSections; // WORD
- int TimeDateStamp; // DWORD
- int PointerToSymbolTable; // DWORD
- int NumberOfSymbols; // DWORD
- int SizeOfOptionalHeader; // WORD
- int Characteristics; // WORD
-}
-
-public static class IMAGE_DATA_DIRECTORY {
- int VirtualAddress; // DWORD
- int Size; // DWORD
-}
-
-public static class IMAGE_OPTIONAL_HEADER {
- // Allocate enough storage for the 64 bit version of the header.
- int Magic; // WORD
- int MajorLinkerVersion; // BYTE
- int MinorLinkerVersion; // BYTE
- int SizeOfCode; // DWORD
- int SizeOfInitializedData; // DWORD
- int SizeOfUninitializedData; // DWORD
- int AddressOfEntryPoint; // DWORD
- int BaseOfCode; // DWORD
- int BaseOfData; // DWORD
- long ImageBase; // ULONGLONG
- int SectionAlignment; // DWORD
- int FileAlignment; // DWORD
- int MajorOperatingSystemVersion; // WORD
- int MinorOperatingSystemVersion; // WORD
- int MajorImageVersion; // WORD
- int MinorImageVersion; // WORD
- int MajorSubsystemVersion; // WORD
- int MinorSubsystemVersion; // WORD
- int Win32VersionValue; // DWORD
- int SizeOfImage; // DWORD
- int SizeOfHeaders; // DWORD
- int CheckSum; // DWORD
- int Subsystem; // WORD
- int DllCharacteristics; // WORD
- long SizeOfStackReserve; // ULONGLONG
- long SizeOfStackCommit; // ULONGLONG
- long SizeOfHeapReserve; // ULONGLONG
- long SizeOfHeapCommit; // ULONGLONG
- int LoaderFlags; // DWORD
- int NumberOfRvaAndSizes; // DWORD
- IMAGE_DATA_DIRECTORY[] DataDirectory = new IMAGE_DATA_DIRECTORY[16];
-}
-
-public static class IMAGE_NT_HEADERS {
- int Signature; // DWORD
- IMAGE_FILE_HEADER FileHeader = new IMAGE_FILE_HEADER();
- IMAGE_OPTIONAL_HEADER OptionalHeader = new IMAGE_OPTIONAL_HEADER();
- final static int FIELD_OFFSET_OptionalHeader = 24;
-}
-
-public static class IMAGE_SECTION_HEADER {
- int[] Name = new int[8]; // BYTE[8]
- int Misc_VirtualSize; // DWORD (union Misc { DWORD PhysicalAddress; DWORD VirtualSize }
- int VirtualAddress; // DWORD
- int SizeOfRawData; // DWORD
- int PointerToRawData; // DWORD
- int PointerToRelocations; // DWORD
- int PointerToLinenumbers; // DWORD
- int NumberOfRelocations; // WORD
- int NumberOfLinenumbers; // WORD
- int Characteristics; // DWORD
-}
-
-public static class IMAGE_RESOURCE_DIRECTORY {
- int Characteristics; // DWORD
- int TimeDateStamp; // DWORD
- int MajorVersion; // WORD
- int MinorVersion; // WORD
- int NumberOfNamedEntries; // WORD - used
- int NumberOfIdEntries; // WORD - used
- final static int SIZEOF = 16;
-}
-
-public static class IMAGE_RESOURCE_DIRECTORY_ENTRY {
- // union
- int NameOffset; // DWORD 31 bits
- boolean NameIsString; // DWORD 1 bit
- int Name; // DWORD
- int Id; // WORD
- // union
- int OffsetToData; // DWORD
- int OffsetToDirectory; // DWORD 31 bits
- boolean DataIsDirectory; // DWORD 1 bit
-}
-
-public static class IMAGE_RESOURCE_DATA_ENTRY {
- int OffsetToData; // DWORD
- int Size; // DWORD
- int CodePage; // DWORD
- int Reserved; // DWORD
-}
-
-public static class NEWHEADER {
- int Reserved; // WORD
- int ResType; // WORD
- int ResCount; // WORD
-}
-public static class ICONRESDIR {
- int Width; // BYTE
- int Height; // BYTE
- int ColorCount; // BYTE
- int reserved; // BYTE
-}
-
-public static class CURSORDIR {
- int Width; // WORD
- int Height; // WORD
-}
-
-public static class RESDIR {
- // union
- ICONRESDIR Icon = new ICONRESDIR();
- CURSORDIR Cursor = new CURSORDIR();
- int Planes; // WORD
- int BitCount; // WORD
- int BytesInRes; // DWORD
- int IconCursorId; // WORD
-}
-
-public static class BITMAPINFOHEADER {
- int biSize; // DWORD
- int biWidth; // LONG
- int biHeight; // LONG
- int biPlanes; // WORD
- int biBitCount; // WORD
- int biCompression; // DWORD
- int biSizeImage; // DWORD
- int biXPelsPerMeter; // LONG
- int biYPelsPerMeter; // LONG
- int biClrUsed; // DWORD
- int biClrImportant; // DWORD
-}
+ static PaletteData loadPalette(BITMAPINFOHEADER bih, RandomAccessFile raf) throws IOException {
+ int depth = bih.biBitCount;
+ if (depth <= 8) {
+ int numColors = bih.biClrUsed;
+ if (numColors == 0) {
+ numColors = 1 << depth;
+ } else {
+ if (numColors > 256)
+ numColors = 256;
+ }
+ byte[] buf = new byte[numColors * 4];
+ raf.read(buf);
+ return paletteFromBytes(buf, numColors);
+ }
+ if (depth == 16)
+ return new PaletteData(0x7C00, 0x3E0, 0x1F);
+ if (depth == 24)
+ return new PaletteData(0xFF, 0xFF00, 0xFF0000);
+ return new PaletteData(0xFF00, 0xFF0000, 0xFF000000);
+ }
+
+ static PaletteData paletteFromBytes(byte[] bytes, int numColors) {
+ int bytesOffset = 0;
+ RGB[] colors = new RGB[numColors];
+ for (int i = 0; i < numColors; i++) {
+ colors[i] = new RGB(bytes[bytesOffset + 2] & 0xFF, bytes[bytesOffset + 1] & 0xFF, bytes[bytesOffset] & 0xFF);
+ bytesOffset += 4;
+ }
+ return new PaletteData(colors);
+ }
-static class RGBQUAD {
- int rgBlue; // BYTE
- int rgbGreen; // BYTE
- int rgbRed; // BYTE
- int rgbReserved; // BYTE
-}
-static class BITMAPINFO {
- BITMAPINFOHEADER bmiHeader = new BITMAPINFOHEADER();
- RGBQUAD[] bmiColors = null;
-}
-static void read(RandomAccessFile raf, BITMAPINFOHEADER bih) throws IOException {
- bih.biSize = read4(raf);
- bih.biWidth = read4(raf);
- bih.biHeight = read4(raf);
- bih.biPlanes = readU2(raf);
- bih.biBitCount = readU2(raf);
- bih.biCompression = read4(raf);
- bih.biSizeImage = read4(raf);
- bih.biXPelsPerMeter = read4(raf);
- bih.biYPelsPerMeter = read4(raf);
- bih.biClrUsed = read4(raf);
- bih.biClrImportant = read4(raf);
-}
-static void read(RandomAccessFile raf, BITMAPINFO bi) throws IOException {
- read(raf, bi.bmiHeader);
-}
-/* Little Endian helpers */
-static int readU2(RandomAccessFile raf) throws IOException {
- int b0 = raf.readByte() & 0xFF;
- int b1 = raf.readByte() & 0xFF;
- return (b1 << 8 | b0);
-}
-static int read4(RandomAccessFile raf) throws IOException {
- int b0 = raf.readByte() & 0xFF;
- int b1 = raf.readByte() & 0xFF;
- int b2 = raf.readByte() & 0xFF;
- int b3 = raf.readByte() & 0xFF;
- return b3 << 24 | b2 << 16 | b1 << 8 | b0;
-}
-static long read8(RandomAccessFile raf) throws IOException {
- int b0 = raf.readByte() & 0xFF;
- int b1 = raf.readByte() & 0xFF;
- int b2 = raf.readByte() & 0xFF;
- int b3 = raf.readByte() & 0xFF;
- int b4 = raf.readByte() & 0xFF;
- int b5 = raf.readByte() & 0xFF;
- int b6 = raf.readByte() & 0xFF;
- int b7 = raf.readByte() & 0xFF;
- return b7 << 56 | b6 << 48 | b5 << 40 | b4 << 32 | b3 << 24 | b2 << 16 | b1 << 8 | b0;
-}
-static void write4(RandomAccessFile raf, int value) throws IOException {
- raf.write(value & 0xFF);
- raf.write((value >> 8) & 0xFF);
- raf.write((value >> 16) & 0xFF);
- raf.write((value >> 24) & 0xFF);
-}
-static void writeU2(RandomAccessFile raf, int value) throws IOException {
- raf.write(value & 0xFF);
- raf.write((value >> 8) & 0xFF);
-}
-static void read(RandomAccessFile raf, IMAGE_DOS_HEADER idh) throws IOException {
- idh.e_magic = readU2(raf);
- idh.e_cblp = readU2(raf);
- idh.e_cp = readU2(raf);
- idh.e_crlc = readU2(raf);
- idh.e_cparhdr = readU2(raf);
- idh.e_minalloc = readU2(raf);
- idh.e_maxalloc = readU2(raf);
- idh.e_ss = readU2(raf);
- idh.e_sp = readU2(raf);
- idh.e_csum = readU2(raf);
- idh.e_ip = readU2(raf);
- idh.e_cs = readU2(raf);
- idh.e_lfarlc = readU2(raf);
- idh.e_ovno = readU2(raf);
- for (int i = 0; i < idh.e_res.length; i++) idh.e_res[i] = readU2(raf);
- idh.e_oemid = readU2(raf);
- idh.e_oeminfo = readU2(raf);
- for (int i = 0; i < idh.e_res2.length; i++) idh.e_res2[i] = readU2(raf);
- idh.e_lfanew = read4(raf);
-}
-static void read(RandomAccessFile raf, IMAGE_FILE_HEADER ifh) throws IOException {
- ifh.Machine = readU2(raf);
- ifh.NumberOfSections = readU2(raf);
- ifh.TimeDateStamp = read4(raf);
- ifh.PointerToSymbolTable = read4(raf);
- ifh.NumberOfSymbols = read4(raf);
- ifh.SizeOfOptionalHeader = readU2(raf);
- ifh.Characteristics = readU2(raf);
-}
-static void read(RandomAccessFile raf, IMAGE_DATA_DIRECTORY idd) throws IOException {
- idd.VirtualAddress = read4(raf);
- idd.Size = read4(raf);
-}
-static void read(RandomAccessFile raf, IMAGE_OPTIONAL_HEADER ioh) throws IOException {
- ioh.Magic = readU2(raf);
-
- // Assume file is 32bit executable unless x64 magic is present
- boolean is32 = !(ioh.Magic == IMAGE_NT_OPTIONAL_HDR64_MAGIC);
-
- ioh.MajorLinkerVersion = raf.read();
- ioh.MinorLinkerVersion = raf.read();
- ioh.SizeOfCode = read4(raf);
- ioh.SizeOfInitializedData = read4(raf);
- ioh.SizeOfUninitializedData = read4(raf);
- ioh.AddressOfEntryPoint = read4(raf);
- ioh.BaseOfCode = read4(raf);
-
- if (is32)
- {
- ioh.BaseOfData = read4(raf);
- ioh.ImageBase = read4(raf);
- }
- else
- {
- // BaseOfData deleted in the 64 bit version PE32+
- ioh.ImageBase = read8(raf);
- }
-
- ioh.SectionAlignment = read4(raf);
- ioh.FileAlignment = read4(raf);
- ioh.MajorOperatingSystemVersion = readU2(raf);
- ioh.MinorOperatingSystemVersion = readU2(raf);
- ioh.MajorImageVersion = readU2(raf);
- ioh.MinorImageVersion = readU2(raf);
- ioh.MajorSubsystemVersion = readU2(raf);
- ioh.MinorSubsystemVersion = readU2(raf);
- ioh.Win32VersionValue = read4(raf);
- ioh.SizeOfImage = read4(raf);
- ioh.SizeOfHeaders = read4(raf);
- ioh.CheckSum = read4(raf);
- ioh.Subsystem = readU2(raf);
- ioh.DllCharacteristics = readU2(raf);
-
- if (is32)
- {
- ioh.SizeOfStackReserve = read4(raf);
- ioh.SizeOfStackCommit = read4(raf);
- ioh.SizeOfHeapReserve = read4(raf);
- ioh.SizeOfHeapCommit = read4(raf);
- }
- else
- {
- ioh.SizeOfStackReserve = read8(raf);
- ioh.SizeOfStackCommit = read8(raf);
- ioh.SizeOfHeapReserve = read8(raf);
- ioh.SizeOfHeapCommit = read8(raf);
- }
-
- ioh.LoaderFlags = read4(raf);
- ioh.NumberOfRvaAndSizes = read4(raf);
- for (int i = 0 ; i < ioh.DataDirectory.length; i++) {
- ioh.DataDirectory[i] = new IMAGE_DATA_DIRECTORY();
- read(raf, ioh.DataDirectory[i]);
+ static byte[] loadData(BITMAPINFOHEADER bih, RandomAccessFile raf) throws IOException {
+ int stride = (bih.biWidth * bih.biBitCount + 7) / 8;
+ stride = (stride + 3) / 4 * 4; // Round up to 4 byte multiple
+ byte[] data = loadData(bih, raf, stride);
+ flipScanLines(data, stride, bih.biHeight);
+ return data;
}
-}
-static void read(RandomAccessFile raf, IMAGE_NT_HEADERS inh) throws IOException {
- inh.Signature = read4(raf);
- read(raf, inh.FileHeader);
- read(raf, inh.OptionalHeader);
-}
-static void read(RandomAccessFile raf, IMAGE_SECTION_HEADER ish) throws IOException {
- for (int i = 0 ; i < ish.Name.length; i++) ish.Name[i] = raf.read();
- ish.Misc_VirtualSize = read4(raf);
- ish.VirtualAddress = read4(raf);
- ish.SizeOfRawData = read4(raf);
- ish.PointerToRawData = read4(raf);
- ish.PointerToRelocations = read4(raf);
- ish.PointerToLinenumbers = read4(raf);
- ish.NumberOfRelocations = readU2(raf);
- ish.NumberOfLinenumbers = readU2(raf);
- ish.Characteristics = read4(raf);
-}
-static void read(RandomAccessFile raf, IMAGE_RESOURCE_DIRECTORY ird) throws IOException {
- ird.Characteristics = read4(raf);
- ird.TimeDateStamp = read4(raf);
- ird.MajorVersion = readU2(raf);
- ird.MinorVersion = readU2(raf);
- ird.NumberOfNamedEntries = readU2(raf);
- ird.NumberOfIdEntries = readU2(raf);
-}
-static void read(RandomAccessFile raf, IMAGE_RESOURCE_DIRECTORY_ENTRY irde) throws IOException {
- irde.Name = read4(raf);
- irde.OffsetToData = read4(raf);
- // construct other union members
- irde.NameOffset = irde.Name & ~ (1 << 31);
- irde.NameIsString = (irde.Name & (1 << 31)) != 0;
- irde.Id = irde.Name & 0xFFFF;
- irde.OffsetToDirectory = irde.OffsetToData & ~ (1 << 31);
- irde.DataIsDirectory = (irde.OffsetToData & (1 << 31)) != 0;
-}
-static void read(RandomAccessFile raf, IMAGE_RESOURCE_DATA_ENTRY irde) throws IOException {
- irde.OffsetToData = read4(raf);
- irde.Size = read4(raf);
- irde.CodePage = read4(raf);
- irde.Reserved = read4(raf);
-}
-static void read(RandomAccessFile raf, NEWHEADER nh) throws IOException {
- nh.Reserved = readU2(raf);
- nh.ResType = readU2(raf);
- nh.ResCount = readU2(raf);
-}
-static void read(RandomAccessFile raf, ICONRESDIR i) throws IOException {
- i.Width = raf.read();
- i.Height = raf.read();
- i.ColorCount = raf.read();
- i.reserved = raf.read();
-}
-static void read(RandomAccessFile raf, CURSORDIR c) throws IOException {
- c.Width = readU2(raf);
- c.Height = readU2(raf);
-}
-static void read(RandomAccessFile raf, RESDIR rs) throws IOException {
- long start = raf.getFilePointer();
- read(raf, rs.Icon);
- raf.seek(start);
- read(raf, rs.Cursor);
- rs.Planes = readU2(raf);
- rs.BitCount = readU2(raf);
- rs.BytesInRes = read4(raf);
- rs.IconCursorId = readU2(raf);
-}
-/* ImageData and Image Decoder inlining to avoid dependency on SWT
- * The following section can be entirely removed if SWT can be used.
- */
+ static void flipScanLines(byte[] data, int stride, int height) {
+ int i1 = 0;
+ int i2 = (height - 1) * stride;
+ for (int i = 0; i < height / 2; i++) {
+ for (int index = 0; index < stride; index++) {
+ byte b = data[index + i1];
+ data[index + i1] = data[index + i2];
+ data[index + i2] = b;
+ }
+ i1 += stride;
+ i2 -= stride;
+ }
+ }
-static class RGB {
-
- /**
- * the red component of the RGB
- */
- public int red;
-
- /**
- * the green component of the RGB
- */
- public int green;
-
- /**
- * the blue component of the RGB
- */
- public int blue;
-
- static final long serialVersionUID = 3258415023461249074L;
-
-/**
- * Constructs an instance of this class with the given
- * red, green and blue values.
- *
- * @param red the red component of the new instance
- * @param green the green component of the new instance
- * @param blue the blue component of the new instance
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the red, green or blue argument is not between 0 and 255</li>
- * </ul>
- */
-public RGB(int red, int green, int blue) {
- if ((red > 255) || (red < 0) ||
- (green > 255) || (green < 0) ||
- (blue > 255) || (blue < 0))
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- this.red = red;
- this.green = green;
- this.blue = blue;
-}
+ static byte[] loadData(BITMAPINFOHEADER bih, RandomAccessFile raf, int stride) throws IOException {
+ int dataSize = bih.biHeight * stride;
+ byte[] data = new byte[dataSize];
+ int cmp = bih.biCompression;
+ if (cmp == 0) { // BMP_NO_COMPRESSION
+ raf.read(data);
+ } else {
+ if (DEBUG)
+ System.out.println("ICO cannot be compressed?"); //$NON-NLS-1$
+ }
+ return data;
+ }
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the <em>same</em> object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
- *
- * @see #hashCode()
- */
-public boolean equals (Object object) {
- if (object == this) return true;
- if (!(object instanceof RGB)) return false;
- RGB rgb = (RGB)object;
- return (rgb.red == this.red) && (rgb.green == this.green) && (rgb.blue == this.blue);
-}
+ static void unloadIcon(RandomAccessFile raf, ImageData icon) throws IOException {
+ int sizeImage = (((icon.width * icon.depth + 31) / 32 * 4) + ((icon.width + 31) / 32 * 4)) * icon.height;
+ write4(raf, BMPHeaderFixedSize);
+ write4(raf, icon.width);
+ write4(raf, icon.height * 2);
+ writeU2(raf, 1);
+ writeU2(raf, icon.depth);
+ write4(raf, 0);
+ write4(raf, sizeImage);
+ write4(raf, 0);
+ write4(raf, 0);
+ write4(raf, icon.palette.colors != null ? icon.palette.colors.length : 0);
+ write4(raf, 0);
+
+ byte[] rgbs = paletteToBytes(icon.palette);
+ raf.write(rgbs);
+ unloadShapeData(raf, icon);
+ unloadMaskData(raf, icon);
+ }
+
+ static byte[] paletteToBytes(PaletteData pal) {
+ int n = pal.colors == null ? 0 : (pal.colors.length < 256 ? pal.colors.length : 256);
+ byte[] bytes = new byte[n * 4];
+ int offset = 0;
+ for (int i = 0; i < n; i++) {
+ RGB col = pal.colors[i];
+ bytes[offset] = (byte) col.blue;
+ bytes[offset + 1] = (byte) col.green;
+ bytes[offset + 2] = (byte) col.red;
+ offset += 4;
+ }
+ return bytes;
+ }
+
+ static void unloadMaskData(RandomAccessFile raf, ImageData icon) {
+ ImageData mask = icon.getTransparencyMask();
+ int bpl = (icon.width + 7) / 8;
+ int pad = mask.scanlinePad;
+ int srcBpl = (bpl + pad - 1) / pad * pad;
+ int destBpl = (bpl + 3) / 4 * 4;
+ byte[] buf = new byte[destBpl];
+ int offset = (icon.height - 1) * srcBpl;
+ byte[] data = mask.data;
+ try {
+ for (int i = 0; i < icon.height; i++) {
+ System.arraycopy(data, offset, buf, 0, bpl);
+ bitInvertData(buf, 0, bpl);
+ raf.write(buf, 0, destBpl);
+ offset -= srcBpl;
+ }
+ } catch (IOException e) {
+ SWT.error(SWT.ERROR_IO, e);
+ }
+ }
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects which return <code>true</code> when passed to
- * <code>equals</code> must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals(Object)
- */
-public int hashCode () {
- return (blue << 16) | (green << 8) | red;
-}
+ static void unloadShapeData(RandomAccessFile raf, ImageData icon) {
+ int bpl = (icon.width * icon.depth + 7) / 8;
+ int pad = icon.scanlinePad;
+ int srcBpl = (bpl + pad - 1) / pad * pad;
+ int destBpl = (bpl + 3) / 4 * 4;
+ byte[] buf = new byte[destBpl];
+ int offset = (icon.height - 1) * srcBpl;
+ byte[] data = icon.data;
+ try {
+ for (int i = 0; i < icon.height; i++) {
+ System.arraycopy(data, offset, buf, 0, bpl);
+ raf.write(buf, 0, destBpl);
+ offset -= srcBpl;
+ }
+ } catch (IOException e) {
+ SWT.error(SWT.ERROR_IO, e);
+ }
+ }
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the <code>RGB</code>
- */
-public String toString () {
- return "RGB {" + red + ", " + green + ", " + blue + "}"; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ static boolean readIconGroup(RandomAccessFile raf, int offset, int size) throws IOException {
+ raf.seek(offset);
+ NEWHEADER newHeader = new NEWHEADER();
+ read(raf, newHeader);
+ if (newHeader.ResType != RES_ICON)
+ return false;
+ RESDIR[] resDir = new RESDIR[newHeader.ResCount];
+ for (int i = 0; i < newHeader.ResCount; i++) {
+ resDir[i] = new RESDIR();
+ read(raf, resDir[i]);
+ }
+ return true;
+ }
+
+ static void copyFile(String src, String dst) throws FileNotFoundException, IOException {
+ File srcFile = new File(src);
+ File dstFile = new File(dst);
+ InputStream in = new BufferedInputStream(new FileInputStream(srcFile));
+ OutputStream out = new BufferedOutputStream(new FileOutputStream(dstFile));
+ int c;
+ while ((c = in.read()) != -1)
+ out.write(c);
+ in.close();
+ out.close();
+ }
+
+ /* IO utilities to parse Windows executable */
+ static final int IMAGE_DOS_SIGNATURE = 0x5a4d;
+ static final int IMAGE_NT_SIGNATURE = 0x00004550;
+ static final int IMAGE_DIRECTORY_ENTRY_RESOURCE = 2;
+ static final int RES_ICON = 1;
+ static final int RT_ICON = 3;
+ static final int RT_GROUP_ICON = 14;
+ static final int BMPHeaderFixedSize = 40;
+ static final int IMAGE_NT_OPTIONAL_HDR64_MAGIC = 0x20b;
+ static final int IMAGE_NT_OPTIONAL_HDR32_MAGIC = 0x10b;
+
+ public static class IMAGE_DOS_HEADER {
+ int e_magic; // WORD
+ int e_cblp; // WORD
+ int e_cp; // WORD
+ int e_crlc; // WORD
+ int e_cparhdr; // WORD
+ int e_minalloc; // WORD
+ int e_maxalloc; // WORD
+ int e_ss; // WORD
+ int e_sp; // WORD
+ int e_csum; // WORD
+ int e_ip; // WORD
+ int e_cs; // WORD
+ int e_lfarlc; // WORD
+ int e_ovno; // WORD
+ int[] e_res = new int[4]; // WORD[4]
+ int e_oemid; // WORD
+ int e_oeminfo; // WORD
+ int[] e_res2 = new int[10]; // WORD[10]
+ int e_lfanew; // LONG
+ }
+
+ public static class IMAGE_FILE_HEADER {
+ int Machine; // WORD
+ int NumberOfSections; // WORD
+ int TimeDateStamp; // DWORD
+ int PointerToSymbolTable; // DWORD
+ int NumberOfSymbols; // DWORD
+ int SizeOfOptionalHeader; // WORD
+ int Characteristics; // WORD
+ }
+
+ public static class IMAGE_DATA_DIRECTORY {
+ int VirtualAddress; // DWORD
+ int Size; // DWORD
+ }
+
+ public static class IMAGE_OPTIONAL_HEADER {
+ // Allocate enough storage for the 64 bit version of the header.
+ int Magic; // WORD
+ int MajorLinkerVersion; // BYTE
+ int MinorLinkerVersion; // BYTE
+ int SizeOfCode; // DWORD
+ int SizeOfInitializedData; // DWORD
+ int SizeOfUninitializedData; // DWORD
+ int AddressOfEntryPoint; // DWORD
+ int BaseOfCode; // DWORD
+ int BaseOfData; // DWORD
+ long ImageBase; // ULONGLONG
+ int SectionAlignment; // DWORD
+ int FileAlignment; // DWORD
+ int MajorOperatingSystemVersion; // WORD
+ int MinorOperatingSystemVersion; // WORD
+ int MajorImageVersion; // WORD
+ int MinorImageVersion; // WORD
+ int MajorSubsystemVersion; // WORD
+ int MinorSubsystemVersion; // WORD
+ int Win32VersionValue; // DWORD
+ int SizeOfImage; // DWORD
+ int SizeOfHeaders; // DWORD
+ int CheckSum; // DWORD
+ int Subsystem; // WORD
+ int DllCharacteristics; // WORD
+ long SizeOfStackReserve; // ULONGLONG
+ long SizeOfStackCommit; // ULONGLONG
+ long SizeOfHeapReserve; // ULONGLONG
+ long SizeOfHeapCommit; // ULONGLONG
+ int LoaderFlags; // DWORD
+ int NumberOfRvaAndSizes; // DWORD
+ IMAGE_DATA_DIRECTORY[] DataDirectory = new IMAGE_DATA_DIRECTORY[16];
+ }
+
+ public static class IMAGE_NT_HEADERS {
+ int Signature; // DWORD
+ IMAGE_FILE_HEADER FileHeader = new IMAGE_FILE_HEADER();
+ IMAGE_OPTIONAL_HEADER OptionalHeader = new IMAGE_OPTIONAL_HEADER();
+ final static int FIELD_OFFSET_OptionalHeader = 24;
+ }
+
+ public static class IMAGE_SECTION_HEADER {
+ int[] Name = new int[8]; // BYTE[8]
+ int Misc_VirtualSize; // DWORD (union Misc { DWORD PhysicalAddress; DWORD VirtualSize }
+ int VirtualAddress; // DWORD
+ int SizeOfRawData; // DWORD
+ int PointerToRawData; // DWORD
+ int PointerToRelocations; // DWORD
+ int PointerToLinenumbers; // DWORD
+ int NumberOfRelocations; // WORD
+ int NumberOfLinenumbers; // WORD
+ int Characteristics; // DWORD
+ }
+
+ public static class IMAGE_RESOURCE_DIRECTORY {
+ int Characteristics; // DWORD
+ int TimeDateStamp; // DWORD
+ int MajorVersion; // WORD
+ int MinorVersion; // WORD
+ int NumberOfNamedEntries; // WORD - used
+ int NumberOfIdEntries; // WORD - used
+ final static int SIZEOF = 16;
+ }
+
+ public static class IMAGE_RESOURCE_DIRECTORY_ENTRY {
+ // union
+ int NameOffset; // DWORD 31 bits
+ boolean NameIsString; // DWORD 1 bit
+ int Name; // DWORD
+ int Id; // WORD
+ // union
+ int OffsetToData; // DWORD
+ int OffsetToDirectory; // DWORD 31 bits
+ boolean DataIsDirectory; // DWORD 1 bit
+ }
+
+ public static class IMAGE_RESOURCE_DATA_ENTRY {
+ int OffsetToData; // DWORD
+ int Size; // DWORD
+ int CodePage; // DWORD
+ int Reserved; // DWORD
+ }
+
+ public static class NEWHEADER {
+ int Reserved; // WORD
+ int ResType; // WORD
+ int ResCount; // WORD
+ }
+
+ public static class ICONRESDIR {
+ int Width; // BYTE
+ int Height; // BYTE
+ int ColorCount; // BYTE
+ int reserved; // BYTE
+ }
+
+ public static class CURSORDIR {
+ int Width; // WORD
+ int Height; // WORD
+ }
+
+ public static class RESDIR {
+ // union
+ ICONRESDIR Icon = new ICONRESDIR();
+ CURSORDIR Cursor = new CURSORDIR();
+ int Planes; // WORD
+ int BitCount; // WORD
+ int BytesInRes; // DWORD
+ int IconCursorId; // WORD
+ }
+
+ public static class BITMAPINFOHEADER {
+ int biSize; // DWORD
+ int biWidth; // LONG
+ int biHeight; // LONG
+ int biPlanes; // WORD
+ int biBitCount; // WORD
+ int biCompression; // DWORD
+ int biSizeImage; // DWORD
+ int biXPelsPerMeter; // LONG
+ int biYPelsPerMeter; // LONG
+ int biClrUsed; // DWORD
+ int biClrImportant; // DWORD
+ }
+
+ static class RGBQUAD {
+ int rgBlue; // BYTE
+ int rgbGreen; // BYTE
+ int rgbRed; // BYTE
+ int rgbReserved; // BYTE
+ }
+
+ static class BITMAPINFO {
+ BITMAPINFOHEADER bmiHeader = new BITMAPINFOHEADER();
+ RGBQUAD[] bmiColors = null;
+ }
+
+ static void read(RandomAccessFile raf, BITMAPINFOHEADER bih) throws IOException {
+ bih.biSize = read4(raf);
+ bih.biWidth = read4(raf);
+ bih.biHeight = read4(raf);
+ bih.biPlanes = readU2(raf);
+ bih.biBitCount = readU2(raf);
+ bih.biCompression = read4(raf);
+ bih.biSizeImage = read4(raf);
+ bih.biXPelsPerMeter = read4(raf);
+ bih.biYPelsPerMeter = read4(raf);
+ bih.biClrUsed = read4(raf);
+ bih.biClrImportant = read4(raf);
+ }
+
+ static void read(RandomAccessFile raf, BITMAPINFO bi) throws IOException {
+ read(raf, bi.bmiHeader);
+ }
+
+ /* Little Endian helpers */
+ static int readU2(RandomAccessFile raf) throws IOException {
+ int b0 = raf.readByte() & 0xFF;
+ int b1 = raf.readByte() & 0xFF;
+ return (b1 << 8 | b0);
+ }
+
+ static int read4(RandomAccessFile raf) throws IOException {
+ int b0 = raf.readByte() & 0xFF;
+ int b1 = raf.readByte() & 0xFF;
+ int b2 = raf.readByte() & 0xFF;
+ int b3 = raf.readByte() & 0xFF;
+ return b3 << 24 | b2 << 16 | b1 << 8 | b0;
+ }
+
+ static long read8(RandomAccessFile raf) throws IOException {
+ int b0 = raf.readByte() & 0xFF;
+ int b1 = raf.readByte() & 0xFF;
+ int b2 = raf.readByte() & 0xFF;
+ int b3 = raf.readByte() & 0xFF;
+ int b4 = raf.readByte() & 0xFF;
+ int b5 = raf.readByte() & 0xFF;
+ int b6 = raf.readByte() & 0xFF;
+ int b7 = raf.readByte() & 0xFF;
+ return b7 << 56 | b6 << 48 | b5 << 40 | b4 << 32 | b3 << 24 | b2 << 16 | b1 << 8 | b0;
+ }
+
+ static void write4(RandomAccessFile raf, int value) throws IOException {
+ raf.write(value & 0xFF);
+ raf.write((value >> 8) & 0xFF);
+ raf.write((value >> 16) & 0xFF);
+ raf.write((value >> 24) & 0xFF);
+ }
+
+ static void writeU2(RandomAccessFile raf, int value) throws IOException {
+ raf.write(value & 0xFF);
+ raf.write((value >> 8) & 0xFF);
+ }
+
+ static void read(RandomAccessFile raf, IMAGE_DOS_HEADER idh) throws IOException {
+ idh.e_magic = readU2(raf);
+ idh.e_cblp = readU2(raf);
+ idh.e_cp = readU2(raf);
+ idh.e_crlc = readU2(raf);
+ idh.e_cparhdr = readU2(raf);
+ idh.e_minalloc = readU2(raf);
+ idh.e_maxalloc = readU2(raf);
+ idh.e_ss = readU2(raf);
+ idh.e_sp = readU2(raf);
+ idh.e_csum = readU2(raf);
+ idh.e_ip = readU2(raf);
+ idh.e_cs = readU2(raf);
+ idh.e_lfarlc = readU2(raf);
+ idh.e_ovno = readU2(raf);
+ for (int i = 0; i < idh.e_res.length; i++)
+ idh.e_res[i] = readU2(raf);
+ idh.e_oemid = readU2(raf);
+ idh.e_oeminfo = readU2(raf);
+ for (int i = 0; i < idh.e_res2.length; i++)
+ idh.e_res2[i] = readU2(raf);
+ idh.e_lfanew = read4(raf);
+ }
+
+ static void read(RandomAccessFile raf, IMAGE_FILE_HEADER ifh) throws IOException {
+ ifh.Machine = readU2(raf);
+ ifh.NumberOfSections = readU2(raf);
+ ifh.TimeDateStamp = read4(raf);
+ ifh.PointerToSymbolTable = read4(raf);
+ ifh.NumberOfSymbols = read4(raf);
+ ifh.SizeOfOptionalHeader = readU2(raf);
+ ifh.Characteristics = readU2(raf);
+ }
+
+ static void read(RandomAccessFile raf, IMAGE_DATA_DIRECTORY idd) throws IOException {
+ idd.VirtualAddress = read4(raf);
+ idd.Size = read4(raf);
+ }
+
+ static void read(RandomAccessFile raf, IMAGE_OPTIONAL_HEADER ioh) throws IOException {
+ ioh.Magic = readU2(raf);
+
+ // Assume file is 32bit executable unless x64 magic is present
+ boolean is32 = !(ioh.Magic == IMAGE_NT_OPTIONAL_HDR64_MAGIC);
+
+ ioh.MajorLinkerVersion = raf.read();
+ ioh.MinorLinkerVersion = raf.read();
+ ioh.SizeOfCode = read4(raf);
+ ioh.SizeOfInitializedData = read4(raf);
+ ioh.SizeOfUninitializedData = read4(raf);
+ ioh.AddressOfEntryPoint = read4(raf);
+ ioh.BaseOfCode = read4(raf);
+
+ if (is32) {
+ ioh.BaseOfData = read4(raf);
+ ioh.ImageBase = read4(raf);
+ } else {
+ // BaseOfData deleted in the 64 bit version PE32+
+ ioh.ImageBase = read8(raf);
+ }
-//$NON-NLS-4$
-}
+ ioh.SectionAlignment = read4(raf);
+ ioh.FileAlignment = read4(raf);
+ ioh.MajorOperatingSystemVersion = readU2(raf);
+ ioh.MinorOperatingSystemVersion = readU2(raf);
+ ioh.MajorImageVersion = readU2(raf);
+ ioh.MinorImageVersion = readU2(raf);
+ ioh.MajorSubsystemVersion = readU2(raf);
+ ioh.MinorSubsystemVersion = readU2(raf);
+ ioh.Win32VersionValue = read4(raf);
+ ioh.SizeOfImage = read4(raf);
+ ioh.SizeOfHeaders = read4(raf);
+ ioh.CheckSum = read4(raf);
+ ioh.Subsystem = readU2(raf);
+ ioh.DllCharacteristics = readU2(raf);
+
+ if (is32) {
+ ioh.SizeOfStackReserve = read4(raf);
+ ioh.SizeOfStackCommit = read4(raf);
+ ioh.SizeOfHeapReserve = read4(raf);
+ ioh.SizeOfHeapCommit = read4(raf);
+ } else {
+ ioh.SizeOfStackReserve = read8(raf);
+ ioh.SizeOfStackCommit = read8(raf);
+ ioh.SizeOfHeapReserve = read8(raf);
+ ioh.SizeOfHeapCommit = read8(raf);
+ }
-}
-static class PaletteData {
-
- /**
- * true if the receiver is a direct palette,
- * and false otherwise
- */
- public boolean isDirect;
-
- /**
- * the RGB values for an indexed palette, where the
- * indices of the array correspond to pixel values
- */
- public RGB[] colors;
-
- /**
- * the red mask for a direct palette
- */
- public int redMask;
-
- /**
- * the green mask for a direct palette
- */
- public int greenMask;
-
- /**
- * the blue mask for a direct palette
- */
- public int blueMask;
-
- /**
- * the red shift for a direct palette
- */
- public int redShift;
-
- /**
- * the green shift for a direct palette
- */
- public int greenShift;
-
- /**
- * the blue shift for a direct palette
- */
- public int blueShift;
+ ioh.LoaderFlags = read4(raf);
+ ioh.NumberOfRvaAndSizes = read4(raf);
+ for (int i = 0; i < ioh.DataDirectory.length; i++) {
+ ioh.DataDirectory[i] = new IMAGE_DATA_DIRECTORY();
+ read(raf, ioh.DataDirectory[i]);
+ }
+ }
-/**
- * Constructs a new indexed palette given an array of RGB values.
- *
- * @param colors the array of <code>RGB</code>s for the palette
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * </ul>
- */
-public PaletteData(RGB[] colors) {
- if (colors == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- this.colors = colors;
- this.isDirect = false;
-}
+ static void read(RandomAccessFile raf, IMAGE_NT_HEADERS inh) throws IOException {
+ inh.Signature = read4(raf);
+ read(raf, inh.FileHeader);
+ read(raf, inh.OptionalHeader);
+ }
-/**
- * Constructs a new direct palette given the red, green and blue masks.
- *
- * @param redMask the red mask
- * @param greenMask the green mask
- * @param blueMask the blue mask
- */
-public PaletteData(int redMask, int greenMask, int blueMask) {
- this.redMask = redMask;
- this.greenMask = greenMask;
- this.blueMask = blueMask;
- this.isDirect = true;
- this.redShift = shiftForMask(redMask);
- this.greenShift = shiftForMask(greenMask);
- this.blueShift = shiftForMask(blueMask);
-}
+ static void read(RandomAccessFile raf, IMAGE_SECTION_HEADER ish) throws IOException {
+ for (int i = 0; i < ish.Name.length; i++)
+ ish.Name[i] = raf.read();
+ ish.Misc_VirtualSize = read4(raf);
+ ish.VirtualAddress = read4(raf);
+ ish.SizeOfRawData = read4(raf);
+ ish.PointerToRawData = read4(raf);
+ ish.PointerToRelocations = read4(raf);
+ ish.PointerToLinenumbers = read4(raf);
+ ish.NumberOfRelocations = readU2(raf);
+ ish.NumberOfLinenumbers = readU2(raf);
+ ish.Characteristics = read4(raf);
+ }
-/**
- * Returns the pixel value corresponding to the given <code>RBG</code>.
- *
- * @param rgb the RGB to get the pixel value for
- * @return the pixel value for the given RGB
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the RGB is not found in the palette</li>
- * </ul>
- */
-public int getPixel(RGB rgb) {
- if (rgb == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (isDirect) {
- int pixel = 0;
- pixel |= (redShift < 0 ? rgb.red << -redShift : rgb.red >>> redShift) & redMask;
- pixel |= (greenShift < 0 ? rgb.green << -greenShift : rgb.green >>> greenShift) & greenMask;
- pixel |= (blueShift < 0 ? rgb.blue << -blueShift : rgb.blue >>> blueShift) & blueMask;
- return pixel;
- }
-
- for (int i = 0; i < colors.length; i++) {
- if (colors[i].equals(rgb)) return i;
- }
- /* The RGB did not exist in the palette */
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- return 0;
-}
+ static void read(RandomAccessFile raf, IMAGE_RESOURCE_DIRECTORY ird) throws IOException {
+ ird.Characteristics = read4(raf);
+ ird.TimeDateStamp = read4(raf);
+ ird.MajorVersion = readU2(raf);
+ ird.MinorVersion = readU2(raf);
+ ird.NumberOfNamedEntries = readU2(raf);
+ ird.NumberOfIdEntries = readU2(raf);
+ }
-/**
- * Returns an <code>RGB</code> corresponding to the given pixel value.
- *
- * @param pixel the pixel to get the RGB value for
- * @return the RGB value for the given pixel
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the pixel does not exist in the palette</li>
- * </ul>
- */
-public RGB getRGB(int pixel) {
- if (isDirect) {
- int r = pixel & redMask;
- r = (redShift < 0) ? r >>> -redShift : r << redShift;
- int g = pixel & greenMask;
- g = (greenShift < 0) ? g >>> -greenShift : g << greenShift;
- int b = pixel & blueMask;
- b = (blueShift < 0) ? b >>> -blueShift : b << blueShift;
- return new RGB(r, g, b);
- }
- if (pixel < 0 || pixel >= colors.length) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- return colors[pixel];
-}
+ static void read(RandomAccessFile raf, IMAGE_RESOURCE_DIRECTORY_ENTRY irde) throws IOException {
+ irde.Name = read4(raf);
+ irde.OffsetToData = read4(raf);
+ // construct other union members
+ irde.NameOffset = irde.Name & ~(1 << 31);
+ irde.NameIsString = (irde.Name & (1 << 31)) != 0;
+ irde.Id = irde.Name & 0xFFFF;
+ irde.OffsetToDirectory = irde.OffsetToData & ~(1 << 31);
+ irde.DataIsDirectory = (irde.OffsetToData & (1 << 31)) != 0;
+ }
-/**
- * Returns all the RGB values in the receiver if it is an
- * indexed palette, or null if it is a direct palette.
- *
- * @return the <code>RGB</code>s for the receiver or null
- */
-public RGB[] getRGBs() {
- return colors;
-}
+ static void read(RandomAccessFile raf, IMAGE_RESOURCE_DATA_ENTRY irde) throws IOException {
+ irde.OffsetToData = read4(raf);
+ irde.Size = read4(raf);
+ irde.CodePage = read4(raf);
+ irde.Reserved = read4(raf);
+ }
-/**
- * Computes the shift value for a given mask.
- *
- * @param mask the mask to compute the shift for
- * @return the shift amount
- *
- * @see IconExe.PaletteData
- */
-int shiftForMask(int mask) {
- for (int i = 31; i >= 0; i--) {
- if (((mask >> i) & 0x1) != 0) return 7 - i;
+ static void read(RandomAccessFile raf, NEWHEADER nh) throws IOException {
+ nh.Reserved = readU2(raf);
+ nh.ResType = readU2(raf);
+ nh.ResCount = readU2(raf);
}
- return 32;
-}
-}
-static class ImageLoader {
-
- /**
- * the array of ImageData objects in this ImageLoader.
- * This array is read in when the load method is called,
- * and it is written out when the save method is called
- */
- public ImageData[] data;
-
- /**
- * the width of the logical screen on which the images
- * reside, in pixels (this corresponds to the GIF89a
- * Logical Screen Width value)
- */
- public int logicalScreenWidth;
+ static void read(RandomAccessFile raf, ICONRESDIR i) throws IOException {
+ i.Width = raf.read();
+ i.Height = raf.read();
+ i.ColorCount = raf.read();
+ i.reserved = raf.read();
+ }
- /**
- * the height of the logical screen on which the images
- * reside, in pixels (this corresponds to the GIF89a
- * Logical Screen Height value)
- */
- public int logicalScreenHeight;
+ static void read(RandomAccessFile raf, CURSORDIR c) throws IOException {
+ c.Width = readU2(raf);
+ c.Height = readU2(raf);
+ }
- /**
- * the background pixel for the logical screen (this
- * corresponds to the GIF89a Background Color Index value).
- * The default is -1 which means 'unspecified background'
- *
- */
- public int backgroundPixel;
+ static void read(RandomAccessFile raf, RESDIR rs) throws IOException {
+ long start = raf.getFilePointer();
+ read(raf, rs.Icon);
+ raf.seek(start);
+ read(raf, rs.Cursor);
+ rs.Planes = readU2(raf);
+ rs.BitCount = readU2(raf);
+ rs.BytesInRes = read4(raf);
+ rs.IconCursorId = readU2(raf);
+ }
- /**
- * the number of times to repeat the display of a sequence
- * of animated images (this corresponds to the commonly-used
- * GIF application extension for "NETSCAPE 2.0 01")
+ /* ImageData and Image Decoder inlining to avoid dependency on SWT
+ * The following section can be entirely removed if SWT can be used.
*/
- public int repeatCount;
-
- /*
- * the set of ImageLoader event listeners, created on demand
- */
- Vector imageLoaderListeners;
-
-/**
- * Construct a new empty ImageLoader.
- */
-public ImageLoader() {
- reset();
-}
-/**
- * Resets the fields of the ImageLoader, except for the
- * <code>imageLoaderListeners</code> field.
- */
-void reset() {
- data = null;
- logicalScreenWidth = 0;
- logicalScreenHeight = 0;
- backgroundPixel = -1;
- repeatCount = 1;
-}
+ static class RGB {
+
+ /**
+ * the red component of the RGB
+ */
+ public int red;
+
+ /**
+ * the green component of the RGB
+ */
+ public int green;
+
+ /**
+ * the blue component of the RGB
+ */
+ public int blue;
+
+ static final long serialVersionUID = 3258415023461249074L;
+
+ /**
+ * Constructs an instance of this class with the given
+ * red, green and blue values.
+ *
+ * @param red the red component of the new instance
+ * @param green the green component of the new instance
+ * @param blue the blue component of the new instance
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the red, green or blue argument is not between 0 and 255</li>
+ * </ul>
+ */
+ public RGB(int red, int green, int blue) {
+ if ((red > 255) || (red < 0) || (green > 255) || (green < 0) || (blue > 255) || (blue < 0))
+ SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ this.red = red;
+ this.green = green;
+ this.blue = blue;
+ }
-/**
- * Loads an array of <code>ImageData</code> objects from the
- * specified input stream. Throws an error if either an error
- * occurs while loading the images, or if the images are not
- * of a supported type. Returns the loaded image data array.
- *
- * @param stream the input stream to load the images from
- * @return an array of <code>ImageData</code> objects loaded from the specified input stream
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the stream is null</li>
- * </ul>
- * @exception RuntimeException <ul>
- * <li>ERROR_INVALID_IMAGE - if the image file contains invalid data</li>
- * <li>ERROR_IO - if an input/output error occurs while reading data</li>
- * <li>ERROR_UNSUPPORTED_FORMAT - if the image file contains an unrecognized format</li>
- * </ul>
- */
-public ImageData[] load(InputStream stream) {
- if (stream == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- reset();
- data = FileFormat.load(stream, this);
- return data;
-}
+ /**
+ * Compares the argument to the receiver, and returns true
+ * if they represent the <em>same</em> object using a class
+ * specific comparison.
+ *
+ * @param object the object to compare with this object
+ * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
+ *
+ * @see #hashCode()
+ */
+ public boolean equals(Object object) {
+ if (object == this)
+ return true;
+ if (!(object instanceof RGB))
+ return false;
+ RGB rgb = (RGB) object;
+ return (rgb.red == this.red) && (rgb.green == this.green) && (rgb.blue == this.blue);
+ }
-/**
- * Loads an array of <code>ImageData</code> objects from the
- * file with the specified name. Throws an error if either
- * an error occurs while loading the images, or if the images are
- * not of a supported type. Returns the loaded image data array.
- *
- * @param filename the name of the file to load the images from
- * @return an array of <code>ImageData</code> objects loaded from the specified file
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the file name is null</li>
- * </ul>
- * @exception RuntimeException <ul>
- * <li>ERROR_INVALID_IMAGE - if the image file contains invalid data</li>
- * <li>ERROR_IO - if an IO error occurs while reading data</li>
- * <li>ERROR_UNSUPPORTED_FORMAT - if the image file contains an unrecognized format</li>
- * </ul>
- */
-public ImageData[] load(String filename) {
- if (filename == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- InputStream stream = null;
- try {
- stream = new BufferedInputStream(new FileInputStream(filename));
- return load(stream);
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- } finally {
- try {
- if (stream != null) stream.close();
- } catch (IOException e) {
- // Ignore error
+ /**
+ * Returns an integer hash code for the receiver. Any two
+ * objects which return <code>true</code> when passed to
+ * <code>equals</code> must return the same value for this
+ * method.
+ *
+ * @return the receiver's hash
+ *
+ * @see #equals(Object)
+ */
+ public int hashCode() {
+ return (blue << 16) | (green << 8) | red;
}
- }
- return null;
-}
-}
-static class ImageData {
-
- /**
- * The width of the image, in pixels.
- */
- public int width;
- /**
- * The height of the image, in pixels.
- */
- public int height;
+ /**
+ * Returns a string containing a concise, human-readable
+ * description of the receiver.
+ *
+ * @return a string representation of the <code>RGB</code>
+ */
+ public String toString() {
+ return "RGB {" + red + ", " + green + ", " + blue + "}"; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- /**
- * The color depth of the image, in bits per pixel.
- * <p>
- * Note that a depth of 8 or less does not necessarily
- * mean that the image is palette indexed, or
- * conversely that a depth greater than 8 means that
- * the image is direct color. Check the associated
- * PaletteData's isDirect field for such determinations.
- */
- public int depth;
+ //$NON-NLS-4$
+ }
- /**
- * The scanline padding.
- * <p>
- * If one scanline of the image is not a multiple of
- * this number, it will be padded with zeros until it is.
- * </p>
- */
- public int scanlinePad;
+ }
- /**
- * The number of bytes per scanline.
- * <p>
- * This is a multiple of the scanline padding.
- * </p>
- */
- public int bytesPerLine;
+ static class PaletteData {
+
+ /**
+ * true if the receiver is a direct palette,
+ * and false otherwise
+ */
+ public boolean isDirect;
+
+ /**
+ * the RGB values for an indexed palette, where the
+ * indices of the array correspond to pixel values
+ */
+ public RGB[] colors;
+
+ /**
+ * the red mask for a direct palette
+ */
+ public int redMask;
+
+ /**
+ * the green mask for a direct palette
+ */
+ public int greenMask;
+
+ /**
+ * the blue mask for a direct palette
+ */
+ public int blueMask;
+
+ /**
+ * the red shift for a direct palette
+ */
+ public int redShift;
+
+ /**
+ * the green shift for a direct palette
+ */
+ public int greenShift;
+
+ /**
+ * the blue shift for a direct palette
+ */
+ public int blueShift;
+
+ /**
+ * Constructs a new indexed palette given an array of RGB values.
+ *
+ * @param colors the array of <code>RGB</code>s for the palette
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
+ * </ul>
+ */
+ public PaletteData(RGB[] colors) {
+ if (colors == null)
+ SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ this.colors = colors;
+ this.isDirect = false;
+ }
- /**
- * The pixel data of the image.
- * <p>
- * Note that for 16 bit depth images the pixel data is stored
- * in least significant byte order; however, for 24bit and
- * 32bit depth images the pixel data is stored in most
- * significant byte order.
- * </p>
- */
- public byte[] data;
+ /**
+ * Constructs a new direct palette given the red, green and blue masks.
+ *
+ * @param redMask the red mask
+ * @param greenMask the green mask
+ * @param blueMask the blue mask
+ */
+ public PaletteData(int redMask, int greenMask, int blueMask) {
+ this.redMask = redMask;
+ this.greenMask = greenMask;
+ this.blueMask = blueMask;
+ this.isDirect = true;
+ this.redShift = shiftForMask(redMask);
+ this.greenShift = shiftForMask(greenMask);
+ this.blueShift = shiftForMask(blueMask);
+ }
- /**
- * The color table for the image.
- */
- public PaletteData palette;
+ /**
+ * Returns the pixel value corresponding to the given <code>RBG</code>.
+ *
+ * @param rgb the RGB to get the pixel value for
+ * @return the pixel value for the given RGB
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the RGB is not found in the palette</li>
+ * </ul>
+ */
+ public int getPixel(RGB rgb) {
+ if (rgb == null)
+ SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (isDirect) {
+ int pixel = 0;
+ pixel |= (redShift < 0 ? rgb.red << -redShift : rgb.red >>> redShift) & redMask;
+ pixel |= (greenShift < 0 ? rgb.green << -greenShift : rgb.green >>> greenShift) & greenMask;
+ pixel |= (blueShift < 0 ? rgb.blue << -blueShift : rgb.blue >>> blueShift) & blueMask;
+ return pixel;
+ }
- /**
- * The transparent pixel.
- * <p>
- * Pixels with this value are transparent.
- * </p><p>
- * The default is -1 which means 'no transparent pixel'.
- * </p>
- */
- public int transparentPixel;
+ for (int i = 0; i < colors.length; i++) {
+ if (colors[i].equals(rgb))
+ return i;
+ }
+ /* The RGB did not exist in the palette */
+ SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ return 0;
+ }
- /**
- * An icon-specific field containing the data from the icon mask.
- * <p>
- * This is a 1 bit bitmap stored with the most significant
- * bit first. The number of bytes per scanline is
- * '((width + 7) / 8 + (maskPad - 1)) / maskPad * maskPad'.
- * </p><p>
- * The default is null which means 'no transparency mask'.
- * </p>
- */
- public byte[] maskData;
+ /**
+ * Returns an <code>RGB</code> corresponding to the given pixel value.
+ *
+ * @param pixel the pixel to get the RGB value for
+ * @return the RGB value for the given pixel
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the pixel does not exist in the palette</li>
+ * </ul>
+ */
+ public RGB getRGB(int pixel) {
+ if (isDirect) {
+ int r = pixel & redMask;
+ r = (redShift < 0) ? r >>> -redShift : r << redShift;
+ int g = pixel & greenMask;
+ g = (greenShift < 0) ? g >>> -greenShift : g << greenShift;
+ int b = pixel & blueMask;
+ b = (blueShift < 0) ? b >>> -blueShift : b << blueShift;
+ return new RGB(r, g, b);
+ }
+ if (pixel < 0 || pixel >= colors.length) {
+ SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ }
+ return colors[pixel];
+ }
- /**
- * An icon-specific field containing the scanline pad of the mask.
- * <p>
- * If one scanline of the transparency mask is not a
- * multiple of this number, it will be padded with zeros until
- * it is.
- * </p>
- */
- public int maskPad;
-
- /**
- * The alpha data of the image.
- * <p>
- * Every pixel can have an <em>alpha blending</em> value that
- * varies from 0, meaning fully transparent, to 255 meaning
- * fully opaque. The number of bytes per scanline is
- * 'width'.
- * </p>
- */
- public byte[] alphaData;
-
- /**
- * The global alpha value to be used for every pixel.
- * <p>
- * If this value is set, the <code>alphaData</code> field
- * is ignored and when the image is rendered each pixel
- * will be blended with the background an amount
- * proportional to this value.
- * </p><p>
- * The default is -1 which means 'no global alpha value'
- * </p>
- */
- public int alpha;
+ /**
+ * Returns all the RGB values in the receiver if it is an
+ * indexed palette, or null if it is a direct palette.
+ *
+ * @return the <code>RGB</code>s for the receiver or null
+ */
+ public RGB[] getRGBs() {
+ return colors;
+ }
- /**
- * The type of file from which the image was read.
- *
- * It is expressed as one of the following values:
- * <dl>
- * <dt><code>IMAGE_BMP</code></dt>
- * <dd>Windows BMP file format, no compression</dd>
- * <dt><code>IMAGE_BMP_RLE</code></dt>
- * <dd>Windows BMP file format, RLE compression if appropriate</dd>
- * <dt><code>IMAGE_GIF</code></dt>
- * <dd>GIF file format</dd>
- * <dt><code>IMAGE_ICO</code></dt>
- * <dd>Windows ICO file format</dd>
- * <dt><code>IMAGE_JPEG</code></dt>
- * <dd>JPEG file format</dd>
- * <dt><code>IMAGE_PNG</code></dt>
- * <dd>PNG file format</dd>
- * </dl>
- */
- public int type;
+ /**
+ * Computes the shift value for a given mask.
+ *
+ * @param mask the mask to compute the shift for
+ * @return the shift amount
+ *
+ * @see IconExe.PaletteData
+ */
+ int shiftForMask(int mask) {
+ for (int i = 31; i >= 0; i--) {
+ if (((mask >> i) & 0x1) != 0)
+ return 7 - i;
+ }
+ return 32;
+ }
- /**
- * The x coordinate of the top left corner of the image
- * within the logical screen (this field corresponds to
- * the GIF89a Image Left Position value).
- */
- public int x;
+ }
- /**
- * The y coordinate of the top left corner of the image
- * within the logical screen (this field corresponds to
- * the GIF89a Image Top Position value).
- */
- public int y;
+ static class ImageLoader {
+
+ /**
+ * the array of ImageData objects in this ImageLoader.
+ * This array is read in when the load method is called,
+ * and it is written out when the save method is called
+ */
+ public ImageData[] data;
+
+ /**
+ * the width of the logical screen on which the images
+ * reside, in pixels (this corresponds to the GIF89a
+ * Logical Screen Width value)
+ */
+ public int logicalScreenWidth;
+
+ /**
+ * the height of the logical screen on which the images
+ * reside, in pixels (this corresponds to the GIF89a
+ * Logical Screen Height value)
+ */
+ public int logicalScreenHeight;
+
+ /**
+ * the background pixel for the logical screen (this
+ * corresponds to the GIF89a Background Color Index value).
+ * The default is -1 which means 'unspecified background'
+ *
+ */
+ public int backgroundPixel;
+
+ /**
+ * the number of times to repeat the display of a sequence
+ * of animated images (this corresponds to the commonly-used
+ * GIF application extension for "NETSCAPE 2.0 01")
+ */
+ public int repeatCount;
+
+ /*
+ * the set of ImageLoader event listeners, created on demand
+ */
+ Vector<?> imageLoaderListeners;
+
+ /**
+ * Construct a new empty ImageLoader.
+ */
+ public ImageLoader() {
+ reset();
+ }
- /**
- * A description of how to dispose of the current image
- * before displaying the next.
- *
- * It is expressed as one of the following values:
- * <dl>
- * <dt><code>DM_UNSPECIFIED</code></dt>
- * <dd>disposal method not specified</dd>
- * <dt><code>DM_FILL_NONE</code></dt>
- * <dd>do nothing - leave the image in place</dd>
- * <dt><code>DM_FILL_BACKGROUND</code></dt>
- * <dd>fill with the background color</dd>
- * <dt><code>DM_FILL_PREVIOUS</code></dt>
- * <dd>restore the previous picture</dd>
- * </dl>
- * (this field corresponds to the GIF89a Disposal Method value)
- */
- public int disposalMethod;
+ /**
+ * Resets the fields of the ImageLoader, except for the
+ * <code>imageLoaderListeners</code> field.
+ */
+ void reset() {
+ data = null;
+ logicalScreenWidth = 0;
+ logicalScreenHeight = 0;
+ backgroundPixel = -1;
+ repeatCount = 1;
+ }
- /**
- * The time to delay before displaying the next image
- * in an animation (this field corresponds to the GIF89a
- * Delay Time value).
- */
- public int delayTime;
+ /**
+ * Loads an array of <code>ImageData</code> objects from the
+ * specified input stream. Throws an error if either an error
+ * occurs while loading the images, or if the images are not
+ * of a supported type. Returns the loaded image data array.
+ *
+ * @param stream the input stream to load the images from
+ * @return an array of <code>ImageData</code> objects loaded from the specified input stream
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the stream is null</li>
+ * </ul>
+ * @exception RuntimeException <ul>
+ * <li>ERROR_INVALID_IMAGE - if the image file contains invalid data</li>
+ * <li>ERROR_IO - if an input/output error occurs while reading data</li>
+ * <li>ERROR_UNSUPPORTED_FORMAT - if the image file contains an unrecognized format</li>
+ * </ul>
+ */
+ public ImageData[] load(InputStream stream) {
+ if (stream == null)
+ SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ reset();
+ data = FileFormat.load(stream, this);
+ return data;
+ }
- /**
- * Arbitrary channel width data to 8-bit conversion table.
- */
- static final byte[][] ANY_TO_EIGHT = new byte[9][];
- static {
- for (int b = 0; b < 9; ++b) {
- byte[] data = ANY_TO_EIGHT[b] = new byte[1 << b];
- if (b == 0) continue;
- int inc = 0;
- for (int bit = 0x10000; (bit >>= b) != 0;) inc |= bit;
- for (int v = 0, p = 0; v < 0x10000; v+= inc) data[p++] = (byte)(v >> 8);
+ /**
+ * Loads an array of <code>ImageData</code> objects from the
+ * file with the specified name. Throws an error if either
+ * an error occurs while loading the images, or if the images are
+ * not of a supported type. Returns the loaded image data array.
+ *
+ * @param filename the name of the file to load the images from
+ * @return an array of <code>ImageData</code> objects loaded from the specified file
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the file name is null</li>
+ * </ul>
+ * @exception RuntimeException <ul>
+ * <li>ERROR_INVALID_IMAGE - if the image file contains invalid data</li>
+ * <li>ERROR_IO - if an IO error occurs while reading data</li>
+ * <li>ERROR_UNSUPPORTED_FORMAT - if the image file contains an unrecognized format</li>
+ * </ul>
+ */
+ public ImageData[] load(String filename) {
+ if (filename == null)
+ SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ InputStream stream = null;
+ try {
+ stream = new BufferedInputStream(new FileInputStream(filename));
+ return load(stream);
+ } catch (IOException e) {
+ SWT.error(SWT.ERROR_IO, e);
+ } finally {
+ try {
+ if (stream != null)
+ stream.close();
+ } catch (IOException e) {
+ // Ignore error
+ }
+ }
+ return null;
}
}
- static final byte[] ONE_TO_ONE_MAPPING = ANY_TO_EIGHT[8];
- /**
- * Scaled 8x8 Bayer dither matrix.
- */
- static final int[][] DITHER_MATRIX = {
- { 0xfc0000, 0x7c0000, 0xdc0000, 0x5c0000, 0xf40000, 0x740000, 0xd40000, 0x540000 },
- { 0x3c0000, 0xbc0000, 0x1c0000, 0x9c0000, 0x340000, 0xb40000, 0x140000, 0x940000 },
- { 0xcc0000, 0x4c0000, 0xec0000, 0x6c0000, 0xc40000, 0x440000, 0xe40000, 0x640000 },
- { 0x0c0000, 0x8c0000, 0x2c0000, 0xac0000, 0x040000, 0x840000, 0x240000, 0xa40000 },
- { 0xf00000, 0x700000, 0xd00000, 0x500000, 0xf80000, 0x780000, 0xd80000, 0x580000 },
- { 0x300000, 0xb00000, 0x100000, 0x900000, 0x380000, 0xb80000, 0x180000, 0x980000 },
- { 0xc00000, 0x400000, 0xe00000, 0x600000, 0xc80000, 0x480000, 0xe80000, 0x680000 },
- { 0x000000, 0x800000, 0x200000, 0xa00000, 0x080000, 0x880000, 0x280000, 0xa80000 }
- };
+ static class ImageData {
+
+ /**
+ * The width of the image, in pixels.
+ */
+ public int width;
+
+ /**
+ * The height of the image, in pixels.
+ */
+ public int height;
+
+ /**
+ * The color depth of the image, in bits per pixel.
+ * <p>
+ * Note that a depth of 8 or less does not necessarily
+ * mean that the image is palette indexed, or
+ * conversely that a depth greater than 8 means that
+ * the image is direct color. Check the associated
+ * PaletteData's isDirect field for such determinations.
+ */
+ public int depth;
+
+ /**
+ * The scanline padding.
+ * <p>
+ * If one scanline of the image is not a multiple of
+ * this number, it will be padded with zeros until it is.
+ * </p>
+ */
+ public int scanlinePad;
+
+ /**
+ * The number of bytes per scanline.
+ * <p>
+ * This is a multiple of the scanline padding.
+ * </p>
+ */
+ public int bytesPerLine;
+
+ /**
+ * The pixel data of the image.
+ * <p>
+ * Note that for 16 bit depth images the pixel data is stored
+ * in least significant byte order; however, for 24bit and
+ * 32bit depth images the pixel data is stored in most
+ * significant byte order.
+ * </p>
+ */
+ public byte[] data;
+
+ /**
+ * The color table for the image.
+ */
+ public PaletteData palette;
+
+ /**
+ * The transparent pixel.
+ * <p>
+ * Pixels with this value are transparent.
+ * </p><p>
+ * The default is -1 which means 'no transparent pixel'.
+ * </p>
+ */
+ public int transparentPixel;
+
+ /**
+ * An icon-specific field containing the data from the icon mask.
+ * <p>
+ * This is a 1 bit bitmap stored with the most significant
+ * bit first. The number of bytes per scanline is
+ * '((width + 7) / 8 + (maskPad - 1)) / maskPad * maskPad'.
+ * </p><p>
+ * The default is null which means 'no transparency mask'.
+ * </p>
+ */
+ public byte[] maskData;
+
+ /**
+ * An icon-specific field containing the scanline pad of the mask.
+ * <p>
+ * If one scanline of the transparency mask is not a
+ * multiple of this number, it will be padded with zeros until
+ * it is.
+ * </p>
+ */
+ public int maskPad;
+
+ /**
+ * The alpha data of the image.
+ * <p>
+ * Every pixel can have an <em>alpha blending</em> value that
+ * varies from 0, meaning fully transparent, to 255 meaning
+ * fully opaque. The number of bytes per scanline is
+ * 'width'.
+ * </p>
+ */
+ public byte[] alphaData;
+
+ /**
+ * The global alpha value to be used for every pixel.
+ * <p>
+ * If this value is set, the <code>alphaData</code> field
+ * is ignored and when the image is rendered each pixel
+ * will be blended with the background an amount
+ * proportional to this value.
+ * </p><p>
+ * The default is -1 which means 'no global alpha value'
+ * </p>
+ */
+ public int alpha;
+
+ /**
+ * The type of file from which the image was read.
+ *
+ * It is expressed as one of the following values:
+ * <dl>
+ * <dt><code>IMAGE_BMP</code></dt>
+ * <dd>Windows BMP file format, no compression</dd>
+ * <dt><code>IMAGE_BMP_RLE</code></dt>
+ * <dd>Windows BMP file format, RLE compression if appropriate</dd>
+ * <dt><code>IMAGE_GIF</code></dt>
+ * <dd>GIF file format</dd>
+ * <dt><code>IMAGE_ICO</code></dt>
+ * <dd>Windows ICO file format</dd>
+ * <dt><code>IMAGE_JPEG</code></dt>
+ * <dd>JPEG file format</dd>
+ * <dt><code>IMAGE_PNG</code></dt>
+ * <dd>PNG file format</dd>
+ * </dl>
+ */
+ public int type;
+
+ /**
+ * The x coordinate of the top left corner of the image
+ * within the logical screen (this field corresponds to
+ * the GIF89a Image Left Position value).
+ */
+ public int x;
+
+ /**
+ * The y coordinate of the top left corner of the image
+ * within the logical screen (this field corresponds to
+ * the GIF89a Image Top Position value).
+ */
+ public int y;
+
+ /**
+ * A description of how to dispose of the current image
+ * before displaying the next.
+ *
+ * It is expressed as one of the following values:
+ * <dl>
+ * <dt><code>DM_UNSPECIFIED</code></dt>
+ * <dd>disposal method not specified</dd>
+ * <dt><code>DM_FILL_NONE</code></dt>
+ * <dd>do nothing - leave the image in place</dd>
+ * <dt><code>DM_FILL_BACKGROUND</code></dt>
+ * <dd>fill with the background color</dd>
+ * <dt><code>DM_FILL_PREVIOUS</code></dt>
+ * <dd>restore the previous picture</dd>
+ * </dl>
+ * (this field corresponds to the GIF89a Disposal Method value)
+ */
+ public int disposalMethod;
+
+ /**
+ * The time to delay before displaying the next image
+ * in an animation (this field corresponds to the GIF89a
+ * Delay Time value).
+ */
+ public int delayTime;
+
+ /**
+ * Arbitrary channel width data to 8-bit conversion table.
+ */
+ static final byte[][] ANY_TO_EIGHT = new byte[9][];
+ static {
+ for (int b = 0; b < 9; ++b) {
+ byte[] data = ANY_TO_EIGHT[b] = new byte[1 << b];
+ if (b == 0)
+ continue;
+ int inc = 0;
+ for (int bit = 0x10000; (bit >>= b) != 0;)
+ inc |= bit;
+ for (int v = 0, p = 0; v < 0x10000; v += inc)
+ data[p++] = (byte) (v >> 8);
+ }
+ }
+ static final byte[] ONE_TO_ONE_MAPPING = ANY_TO_EIGHT[8];
+
+ /**
+ * Scaled 8x8 Bayer dither matrix.
+ */
+ static final int[][] DITHER_MATRIX = { {0xfc0000, 0x7c0000, 0xdc0000, 0x5c0000, 0xf40000, 0x740000, 0xd40000, 0x540000}, {0x3c0000, 0xbc0000, 0x1c0000, 0x9c0000, 0x340000, 0xb40000, 0x140000, 0x940000}, {0xcc0000, 0x4c0000, 0xec0000, 0x6c0000, 0xc40000, 0x440000, 0xe40000, 0x640000}, {0x0c0000, 0x8c0000, 0x2c0000, 0xac0000, 0x040000, 0x840000, 0x240000, 0xa40000}, {0xf00000, 0x700000, 0xd00000, 0x500000, 0xf80000, 0x780000, 0xd80000, 0x580000}, {0x300000, 0xb00000, 0x100000, 0x900000, 0x380000, 0xb80000, 0x180000, 0x980000}, {0xc00000, 0x400000, 0xe00000, 0x600000, 0xc80000, 0x480000, 0xe80000, 0x680000}, {0x000000, 0x800000, 0x200000, 0xa00000, 0x080000, 0x880000, 0x280000, 0xa80000}};
+
+ /**
+ * Constructs a new, empty ImageData with the given width, height,
+ * depth and palette. The data will be initialized to an (all zero)
+ * array of the appropriate size.
+ *
+ * @param width the width of the image
+ * @param height the height of the image
+ * @param depth the depth of the image
+ * @param palette the palette of the image (must not be null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the width or height is negative, or if the depth is not
+ * one of 1, 2, 4, 8, 16, 24 or 32</li>
+ * <li>ERROR_NULL_ARGUMENT - if the palette is null</li>
+ * </ul>
+ */
+ public ImageData(int width, int height, int depth, PaletteData palette) {
+ this(width, height, depth, palette, 4, null, 0, null, null, -1, -1, SWT.IMAGE_UNDEFINED, 0, 0, 0, 0);
+ }
-/**
- * Constructs a new, empty ImageData with the given width, height,
- * depth and palette. The data will be initialized to an (all zero)
- * array of the appropriate size.
- *
- * @param width the width of the image
- * @param height the height of the image
- * @param depth the depth of the image
- * @param palette the palette of the image (must not be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the width or height is negative, or if the depth is not
- * one of 1, 2, 4, 8, 16, 24 or 32</li>
- * <li>ERROR_NULL_ARGUMENT - if the palette is null</li>
- * </ul>
- */
-public ImageData(int width, int height, int depth, PaletteData palette) {
- this(width, height, depth, palette,
- 4, null, 0, null,
- null, -1, -1, SWT.IMAGE_UNDEFINED,
- 0, 0, 0, 0);
-}
+ /**
+ * Constructs a new, empty ImageData with the given width, height,
+ * depth, palette, scanlinePad and data.
+ *
+ * @param width the width of the image
+ * @param height the height of the image
+ * @param depth the depth of the image
+ * @param palette the palette of the image
+ * @param scanlinePad the padding of each line, in bytes
+ * @param data the data of the image
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the width or height is negative, or if the depth is not
+ * one of 1, 2, 4, 8, 16, 24 or 32</li>
+ * <li>ERROR_NULL_ARGUMENT - if the palette or data is null</li>
+ * <li>ERROR_CANNOT_BE_ZERO - if the scanlinePad is zero</li>
+ * </ul>
+ */
+ public ImageData(int width, int height, int depth, PaletteData palette, int scanlinePad, byte[] data) {
+ this(width, height, depth, palette, scanlinePad, checkData(data), 0, null, null, -1, -1, SWT.IMAGE_UNDEFINED, 0, 0, 0, 0);
+ }
-/**
- * Constructs a new, empty ImageData with the given width, height,
- * depth, palette, scanlinePad and data.
- *
- * @param width the width of the image
- * @param height the height of the image
- * @param depth the depth of the image
- * @param palette the palette of the image
- * @param scanlinePad the padding of each line, in bytes
- * @param data the data of the image
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the width or height is negative, or if the depth is not
- * one of 1, 2, 4, 8, 16, 24 or 32</li>
- * <li>ERROR_NULL_ARGUMENT - if the palette or data is null</li>
- * <li>ERROR_CANNOT_BE_ZERO - if the scanlinePad is zero</li>
- * </ul>
- */
-public ImageData(int width, int height, int depth, PaletteData palette, int scanlinePad, byte[] data) {
- this(width, height, depth, palette,
- scanlinePad, checkData(data), 0, null,
- null, -1, -1, SWT.IMAGE_UNDEFINED,
- 0, 0, 0, 0);
-}
+ /**
+ * Constructs an <code>ImageData</code> loaded from a file with the
+ * specified name. Throws an error if an error occurs loading the
+ * image, or if the image has an unsupported type.
+ * <p>
+ * This constructor is provided for convenience when loading a single
+ * image only. If the file contains multiple images, only the first
+ * one will be loaded. To load multiple images, use
+ * <code>ImageLoader.load()</code>.
+ * </p>
+ *
+ * @param filename the name of the file to load the image from (must not be null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the file name is null</li>
+ * </ul>
+ * @exception RuntimeException <ul>
+ * <li>ERROR_INVALID_IMAGE - if the image file contains invalid data</li>
+ * <li>ERROR_IO if an IO error occurs while reading data</li>
+ * <li>ERROR_UNSUPPORTED_FORMAT - if the image file contains an unrecognized format</li>
+ * </ul>
+ */
+ public ImageData(String filename) {
+ ImageData[] data = new ImageLoader().load(filename);
+ if (data.length < 1)
+ SWT.error(SWT.ERROR_INVALID_IMAGE);
+ ImageData i = data[0];
+ setAllFields(i.width, i.height, i.depth, i.scanlinePad, i.bytesPerLine, i.data, i.palette, i.transparentPixel, i.maskData, i.maskPad, i.alphaData, i.alpha, i.type, i.x, i.y, i.disposalMethod, i.delayTime);
+ }
-/**
- * Constructs an <code>ImageData</code> loaded from a file with the
- * specified name. Throws an error if an error occurs loading the
- * image, or if the image has an unsupported type.
- * <p>
- * This constructor is provided for convenience when loading a single
- * image only. If the file contains multiple images, only the first
- * one will be loaded. To load multiple images, use
- * <code>ImageLoader.load()</code>.
- * </p>
- *
- * @param filename the name of the file to load the image from (must not be null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the file name is null</li>
- * </ul>
- * @exception RuntimeException <ul>
- * <li>ERROR_INVALID_IMAGE - if the image file contains invalid data</li>
- * <li>ERROR_IO if an IO error occurs while reading data</li>
- * <li>ERROR_UNSUPPORTED_FORMAT - if the image file contains an unrecognized format</li>
- * </ul>
- */
-public ImageData(String filename) {
- ImageData[] data = new ImageLoader().load(filename);
- if (data.length < 1) SWT.error(SWT.ERROR_INVALID_IMAGE);
- ImageData i = data[0];
- setAllFields(
- i.width,
- i.height,
- i.depth,
- i.scanlinePad,
- i.bytesPerLine,
- i.data,
- i.palette,
- i.transparentPixel,
- i.maskData,
- i.maskPad,
- i.alphaData,
- i.alpha,
- i.type,
- i.x,
- i.y,
- i.disposalMethod,
- i.delayTime);
-}
+ /**
+ * Prevents uninitialized instances from being created outside the package.
+ */
+ ImageData() {
+ //empty constructor
+ }
-/**
- * Prevents uninitialized instances from being created outside the package.
- */
-ImageData() {
- //empty constructor
-}
+ /**
+ * Constructs an image data by giving values for all non-computable fields.
+ * <p>
+ * This method is for internal use, and is not described further.
+ * </p>
+ */
+ ImageData(int width, int height, int depth, PaletteData palette, int scanlinePad, byte[] data, int maskPad, byte[] maskData, byte[] alphaData, int alpha, int transparentPixel, int type, int x, int y, int disposalMethod, int delayTime) {
+
+ if (palette == null)
+ SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (!(depth == 1 || depth == 2 || depth == 4 || depth == 8 || depth == 16 || depth == 24 || depth == 32)) {
+ SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ }
+ if (width <= 0 || height <= 0) {
+ SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ }
+ if (scanlinePad == 0)
+ SWT.error(SWT.ERROR_CANNOT_BE_ZERO);
-/**
- * Constructs an image data by giving values for all non-computable fields.
- * <p>
- * This method is for internal use, and is not described further.
- * </p>
- */
-ImageData(
- int width, int height, int depth, PaletteData palette,
- int scanlinePad, byte[] data, int maskPad, byte[] maskData,
- byte[] alphaData, int alpha, int transparentPixel, int type,
- int x, int y, int disposalMethod, int delayTime)
-{
-
- if (palette == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (!(depth == 1 || depth == 2 || depth == 4 || depth == 8
- || depth == 16 || depth == 24 || depth == 32)) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- if (width <= 0 || height <= 0) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- if (scanlinePad == 0) SWT.error (SWT.ERROR_CANNOT_BE_ZERO);
-
- int bytesPerLine = (((width * depth + 7) / 8) + (scanlinePad - 1))
- / scanlinePad * scanlinePad;
- setAllFields(
- width,
- height,
- depth,
- scanlinePad,
- bytesPerLine,
- data != null ? data : new byte[bytesPerLine * height],
- palette,
- transparentPixel,
- maskData,
- maskPad,
- alphaData,
- alpha,
- type,
- x,
- y,
- disposalMethod,
- delayTime);
-}
+ int bytesPerLine = (((width * depth + 7) / 8) + (scanlinePad - 1)) / scanlinePad * scanlinePad;
+ setAllFields(width, height, depth, scanlinePad, bytesPerLine, data != null ? data : new byte[bytesPerLine * height], palette, transparentPixel, maskData, maskPad, alphaData, alpha, type, x, y, disposalMethod, delayTime);
+ }
-/**
- * Initializes all fields in the receiver. This method must be called
- * by all public constructors to ensure that all fields are initialized
- * for a new ImageData object. If a new field is added to the class,
- * then it must be added to this method.
- * <p>
- * This method is for internal use, and is not described further.
- * </p>
- */
-void setAllFields(int width, int height, int depth, int scanlinePad,
- int bytesPerLine, byte[] data, PaletteData palette, int transparentPixel,
- byte[] maskData, int maskPad, byte[] alphaData, int alpha,
- int type, int x, int y, int disposalMethod, int delayTime) {
-
- this.width = width;
- this.height = height;
- this.depth = depth;
- this.scanlinePad = scanlinePad;
- this.bytesPerLine = bytesPerLine;
- this.data = data;
- this.palette = palette;
- this.transparentPixel = transparentPixel;
- this.maskData = maskData;
- this.maskPad = maskPad;
- this.alphaData = alphaData;
- this.alpha = alpha;
- this.type = type;
- this.x = x;
- this.y = y;
- this.disposalMethod = disposalMethod;
- this.delayTime = delayTime;
-}
+ /**
+ * Initializes all fields in the receiver. This method must be called
+ * by all public constructors to ensure that all fields are initialized
+ * for a new ImageData object. If a new field is added to the class,
+ * then it must be added to this method.
+ * <p>
+ * This method is for internal use, and is not described further.
+ * </p>
+ */
+ void setAllFields(int width, int height, int depth, int scanlinePad, int bytesPerLine, byte[] data, PaletteData palette, int transparentPixel, byte[] maskData, int maskPad, byte[] alphaData, int alpha, int type, int x, int y, int disposalMethod, int delayTime) {
+
+ this.width = width;
+ this.height = height;
+ this.depth = depth;
+ this.scanlinePad = scanlinePad;
+ this.bytesPerLine = bytesPerLine;
+ this.data = data;
+ this.palette = palette;
+ this.transparentPixel = transparentPixel;
+ this.maskData = maskData;
+ this.maskPad = maskPad;
+ this.alphaData = alphaData;
+ this.alpha = alpha;
+ this.type = type;
+ this.x = x;
+ this.y = y;
+ this.disposalMethod = disposalMethod;
+ this.delayTime = delayTime;
+ }
-/**
- * Invokes internal SWT functionality to create a new instance of
- * this class.
- * <p>
- * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
- * API for <code>ImageData</code>. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is subject
- * to change without notice, and should never be called from
- * application code.
- * </p>
- * <p>
- * This method is for internal use, and is not described further.
- * </p>
- */
-public static ImageData internal_new(
- int width, int height, int depth, PaletteData palette,
- int scanlinePad, byte[] data, int maskPad, byte[] maskData,
- byte[] alphaData, int alpha, int transparentPixel, int type,
- int x, int y, int disposalMethod, int delayTime)
-{
- return new ImageData(
- width, height, depth, palette, scanlinePad, data, maskPad, maskData,
- alphaData, alpha, transparentPixel, type, x, y, disposalMethod, delayTime);
-}
+ /**
+ * Invokes internal SWT functionality to create a new instance of
+ * this class.
+ * <p>
+ * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
+ * API for <code>ImageData</code>. It is marked public only so that it
+ * can be shared within the packages provided by SWT. It is subject
+ * to change without notice, and should never be called from
+ * application code.
+ * </p>
+ * <p>
+ * This method is for internal use, and is not described further.
+ * </p>
+ */
+ public static ImageData internal_new(int width, int height, int depth, PaletteData palette, int scanlinePad, byte[] data, int maskPad, byte[] maskData, byte[] alphaData, int alpha, int transparentPixel, int type, int x, int y, int disposalMethod, int delayTime) {
+ return new ImageData(width, height, depth, palette, scanlinePad, data, maskPad, maskData, alphaData, alpha, transparentPixel, type, x, y, disposalMethod, delayTime);
+ }
-ImageData colorMaskImage(int pixel) {
- ImageData mask = new ImageData(width, height, 1, bwPalette(),
- 2, null, 0, null, null, -1, -1, SWT.IMAGE_UNDEFINED,
- 0, 0, 0, 0);
- int[] row = new int[width];
- for (int y = 0; y < height; y++) {
- getPixels(0, y, width, row, 0);
- for (int i = 0; i < width; i++) {
- if (pixel != -1 && row[i] == pixel) {
- row[i] = 0;
- } else {
- row[i] = 1;
+ ImageData colorMaskImage(int pixel) {
+ ImageData mask = new ImageData(width, height, 1, bwPalette(), 2, null, 0, null, null, -1, -1, SWT.IMAGE_UNDEFINED, 0, 0, 0, 0);
+ int[] row = new int[width];
+ for (int y = 0; y < height; y++) {
+ getPixels(0, y, width, row, 0);
+ for (int i = 0; i < width; i++) {
+ if (pixel != -1 && row[i] == pixel) {
+ row[i] = 0;
+ } else {
+ row[i] = 1;
+ }
+ }
+ mask.setPixels(0, y, width, row, 0);
}
+ return mask;
}
- mask.setPixels(0, y, width, row, 0);
- }
- return mask;
-}
-static byte[] checkData(byte [] data) {
- if (data == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- return data;
-}
+ static byte[] checkData(byte[] data) {
+ if (data == null)
+ SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ return data;
+ }
-/**
- * Returns <code>getWidth</code> pixel values starting at offset
- * <code>x</code> in scanline <code>y</code> in the receiver's
- * data starting at <code>startIndex</code>.
- *
- * @param x the x position of the first pixel to get
- * @param y the y position of the first pixel to get
- * @param getWidth the width of the data to get
- * @param pixels the buffer in which to put the pixels
- * @param startIndex the offset into the byte array to begin storing pixels
- *
- * @exception IndexOutOfBoundsException if getWidth is too large
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if pixels is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if x or y is out of bounds</li>
- * <li>ERROR_INVALID_ARGUMENT - if getWidth is negative</li>
- * </ul>
- * @exception RuntimeException <ul>
- * <li>ERROR_UNSUPPORTED_DEPTH - if the depth is not one of 1, 2, 4 or 8
- * (For higher depths, use the int[] version of this method.)</li>
- * </ul>
- */
-public void getPixels(int x, int y, int getWidth, byte[] pixels, int startIndex) {
- if (pixels == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (getWidth < 0 || x >= width || y >= height || x < 0 || y < 0) SWT.error
-
-(SWT.ERROR_INVALID_ARGUMENT);
- if (getWidth == 0) return;
- int index;
- int theByte;
- int mask = 0;
- int n = getWidth;
- int i = startIndex;
- int srcX = x, srcY = y;
- if (depth == 1) {
- index = (y * bytesPerLine) + (x >> 3);
- theByte = data[index] & 0xFF;
- while (n > 0) {
- mask = 1 << (7 - (srcX & 0x7));
- if ((theByte & mask) == 0) {
- pixels[i] = 0;
- } else {
- pixels[i] = 1;
- }
- i++;
- n--;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- if (n > 0) theByte = data[index] & 0xFF;
- srcX = 0;
- } else {
- if (mask == 1) {
- index++;
- if (n > 0) theByte = data[index] & 0xFF;
+ /**
+ * Returns <code>getWidth</code> pixel values starting at offset
+ * <code>x</code> in scanline <code>y</code> in the receiver's
+ * data starting at <code>startIndex</code>.
+ *
+ * @param x the x position of the first pixel to get
+ * @param y the y position of the first pixel to get
+ * @param getWidth the width of the data to get
+ * @param pixels the buffer in which to put the pixels
+ * @param startIndex the offset into the byte array to begin storing pixels
+ *
+ * @exception IndexOutOfBoundsException if getWidth is too large
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if pixels is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if x or y is out of bounds</li>
+ * <li>ERROR_INVALID_ARGUMENT - if getWidth is negative</li>
+ * </ul>
+ * @exception RuntimeException <ul>
+ * <li>ERROR_UNSUPPORTED_DEPTH - if the depth is not one of 1, 2, 4 or 8
+ * (For higher depths, use the int[] version of this method.)</li>
+ * </ul>
+ */
+ public void getPixels(int x, int y, int getWidth, byte[] pixels, int startIndex) {
+ if (pixels == null)
+ SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (getWidth < 0 || x >= width || y >= height || x < 0 || y < 0)
+ SWT.error
+
+ (SWT.ERROR_INVALID_ARGUMENT);
+ if (getWidth == 0)
+ return;
+ int index;
+ int theByte;
+ int mask = 0;
+ int n = getWidth;
+ int i = startIndex;
+ int srcX = x, srcY = y;
+ if (depth == 1) {
+ index = (y * bytesPerLine) + (x >> 3);
+ theByte = data[index] & 0xFF;
+ while (n > 0) {
+ mask = 1 << (7 - (srcX & 0x7));
+ if ((theByte & mask) == 0) {
+ pixels[i] = 0;
+ } else {
+ pixels[i] = 1;
+ }
+ i++;
+ n--;
+ srcX++;
+ if (srcX >= width) {
+ srcY++;
+ index = srcY * bytesPerLine;
+ if (n > 0)
+ theByte = data[index] & 0xFF;
+ srcX = 0;
+ } else {
+ if (mask == 1) {
+ index++;
+ if (n > 0)
+ theByte = data[index] & 0xFF;
+ }
+ }
}
+ return;
}
- }
- return;
- }
- if (depth == 2) {
- index = (y * bytesPerLine) + (x >> 2);
- theByte = data[index] & 0xFF;
- int offset;
- while (n > 0) {
- offset = 3 - (srcX % 4);
- mask = 3 << (offset * 2);
- pixels[i] = (byte)((theByte & mask) >> (offset * 2));
- i++;
- n--;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- if (n > 0) theByte = data[index] & 0xFF;
- srcX = 0;
- } else {
- if (offset == 0) {
- index++;
- theByte = data[index] & 0xFF;
+ if (depth == 2) {
+ index = (y * bytesPerLine) + (x >> 2);
+ theByte = data[index] & 0xFF;
+ int offset;
+ while (n > 0) {
+ offset = 3 - (srcX % 4);
+ mask = 3 << (offset * 2);
+ pixels[i] = (byte) ((theByte & mask) >> (offset * 2));
+ i++;
+ n--;
+ srcX++;
+ if (srcX >= width) {
+ srcY++;
+ index = srcY * bytesPerLine;
+ if (n > 0)
+ theByte = data[index] & 0xFF;
+ srcX = 0;
+ } else {
+ if (offset == 0) {
+ index++;
+ theByte = data[index] & 0xFF;
+ }
+ }
}
+ return;
}
- }
- return;
- }
- if (depth == 4) {
- index = (y * bytesPerLine) + (x >> 1);
- if ((x & 0x1) == 1) {
- theByte = data[index] & 0xFF;
- pixels[i] = (byte)(theByte & 0x0F);
- i++;
- n--;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- srcX = 0;
- } else {
- index++;
- }
- }
- while (n > 1) {
- theByte = data[index] & 0xFF;
- pixels[i] = (byte)(theByte >> 4);
- i++;
- n--;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- srcX = 0;
- } else {
- pixels[i] = (byte)(theByte & 0x0F);
- i++;
- n--;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- srcX = 0;
- } else {
- index++;
+ if (depth == 4) {
+ index = (y * bytesPerLine) + (x >> 1);
+ if ((x & 0x1) == 1) {
+ theByte = data[index] & 0xFF;
+ pixels[i] = (byte) (theByte & 0x0F);
+ i++;
+ n--;
+ srcX++;
+ if (srcX >= width) {
+ srcY++;
+ index = srcY * bytesPerLine;
+ srcX = 0;
+ } else {
+ index++;
+ }
+ }
+ while (n > 1) {
+ theByte = data[index] & 0xFF;
+ pixels[i] = (byte) (theByte >> 4);
+ i++;
+ n--;
+ srcX++;
+ if (srcX >= width) {
+ srcY++;
+ index = srcY * bytesPerLine;
+ srcX = 0;
+ } else {
+ pixels[i] = (byte) (theByte & 0x0F);
+ i++;
+ n--;
+ srcX++;
+ if (srcX >= width) {
+ srcY++;
+ index = srcY * bytesPerLine;
+ srcX = 0;
+ } else {
+ index++;
+ }
+ }
+ }
+ if (n > 0) {
+ theByte = data[index] & 0xFF;
+ pixels[i] = (byte) (theByte >> 4);
}
+ return;
}
- }
- if (n > 0) {
- theByte = data[index] & 0xFF;
- pixels[i] = (byte)(theByte >> 4);
- }
- return;
- }
- if (depth == 8) {
- index = (y * bytesPerLine) + x;
- for (int j = 0; j < getWidth; j++) {
- pixels[i] = data[index];
- i++;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- srcX = 0;
- } else {
- index++;
+ if (depth == 8) {
+ index = (y * bytesPerLine) + x;
+ for (int j = 0; j < getWidth; j++) {
+ pixels[i] = data[index];
+ i++;
+ srcX++;
+ if (srcX >= width) {
+ srcY++;
+ index = srcY * bytesPerLine;
+ srcX = 0;
+ } else {
+ index++;
+ }
+ }
+ return;
}
+ SWT.error(SWT.ERROR_UNSUPPORTED_DEPTH);
}
- return;
- }
- SWT.error(SWT.ERROR_UNSUPPORTED_DEPTH);
-}
-/**
- * Returns <code>getWidth</code> pixel values starting at offset
- * <code>x</code> in scanline <code>y</code> in the receiver's
- * data starting at <code>startIndex</code>.
- *
- * @param x the x position of the first pixel to get
- * @param y the y position of the first pixel to get
- * @param getWidth the width of the data to get
- * @param pixels the buffer in which to put the pixels
- * @param startIndex the offset into the buffer to begin storing pixels
- *
- * @exception IndexOutOfBoundsException if getWidth is too large
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if pixels is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if x or y is out of bounds</li>
- * <li>ERROR_INVALID_ARGUMENT - if getWidth is negative</li>
- * </ul>
- * @exception RuntimeException <ul>
- * <li>ERROR_UNSUPPORTED_DEPTH - if the depth is not one of 1, 2, 4, 8, 16, 24 or 32</li>
- * </ul>
- */
-public void getPixels(int x, int y, int getWidth, int[] pixels, int startIndex) {
- if (pixels == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (getWidth < 0 || x >= width || y >= height || x < 0 || y < 0) SWT.error
-
-(SWT.ERROR_INVALID_ARGUMENT);
- if (getWidth == 0) return;
- int index;
- int theByte;
- int mask;
- int n = getWidth;
- int i = startIndex;
- int srcX = x, srcY = y;
- if (depth == 1) {
- index = (y * bytesPerLine) + (x >> 3);
- theByte = data[index] & 0xFF;
- while (n > 0) {
- mask = 1 << (7 - (srcX & 0x7));
- if ((theByte & mask) == 0) {
- pixels[i] = 0;
- } else {
- pixels[i] = 1;
- }
- i++;
- n--;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- if (n > 0) theByte = data[index] & 0xFF;
- srcX = 0;
- } else {
- if (mask == 1) {
- index++;
- if (n > 0) theByte = data[index] & 0xFF;
+ /**
+ * Returns <code>getWidth</code> pixel values starting at offset
+ * <code>x</code> in scanline <code>y</code> in the receiver's
+ * data starting at <code>startIndex</code>.
+ *
+ * @param x the x position of the first pixel to get
+ * @param y the y position of the first pixel to get
+ * @param getWidth the width of the data to get
+ * @param pixels the buffer in which to put the pixels
+ * @param startIndex the offset into the buffer to begin storing pixels
+ *
+ * @exception IndexOutOfBoundsException if getWidth is too large
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if pixels is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if x or y is out of bounds</li>
+ * <li>ERROR_INVALID_ARGUMENT - if getWidth is negative</li>
+ * </ul>
+ * @exception RuntimeException <ul>
+ * <li>ERROR_UNSUPPORTED_DEPTH - if the depth is not one of 1, 2, 4, 8, 16, 24 or 32</li>
+ * </ul>
+ */
+ public void getPixels(int x, int y, int getWidth, int[] pixels, int startIndex) {
+ if (pixels == null)
+ SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (getWidth < 0 || x >= width || y >= height || x < 0 || y < 0)
+ SWT.error
+
+ (SWT.ERROR_INVALID_ARGUMENT);
+ if (getWidth == 0)
+ return;
+ int index;
+ int theByte;
+ int mask;
+ int n = getWidth;
+ int i = startIndex;
+ int srcX = x, srcY = y;
+ if (depth == 1) {
+ index = (y * bytesPerLine) + (x >> 3);
+ theByte = data[index] & 0xFF;
+ while (n > 0) {
+ mask = 1 << (7 - (srcX & 0x7));
+ if ((theByte & mask) == 0) {
+ pixels[i] = 0;
+ } else {
+ pixels[i] = 1;
+ }
+ i++;
+ n--;
+ srcX++;
+ if (srcX >= width) {
+ srcY++;
+ index = srcY * bytesPerLine;
+ if (n > 0)
+ theByte = data[index] & 0xFF;
+ srcX = 0;
+ } else {
+ if (mask == 1) {
+ index++;
+ if (n > 0)
+ theByte = data[index] & 0xFF;
+ }
+ }
}
+ return;
}
- }
- return;
- }
- if (depth == 2) {
- index = (y * bytesPerLine) + (x >> 2);
- theByte = data[index] & 0xFF;
- int offset;
- while (n > 0) {
- offset = 3 - (srcX % 4);
- mask = 3 << (offset * 2);
- pixels[i] = (byte)((theByte & mask) >> (offset * 2));
- i++;
- n--;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- if (n > 0) theByte = data[index] & 0xFF;
- srcX = 0;
- } else {
- if (offset == 0) {
- index++;
+ if (depth == 2) {
+ index = (y * bytesPerLine) + (x >> 2);
+ theByte = data[index] & 0xFF;
+ int offset;
+ while (n > 0) {
+ offset = 3 - (srcX % 4);
+ mask = 3 << (offset * 2);
+ pixels[i] = (byte) ((theByte & mask) >> (offset * 2));
+ i++;
+ n--;
+ srcX++;
+ if (srcX >= width) {
+ srcY++;
+ index = srcY * bytesPerLine;
+ if (n > 0)
+ theByte = data[index] & 0xFF;
+ srcX = 0;
+ } else {
+ if (offset == 0) {
+ index++;
+ theByte = data[index] & 0xFF;
+ }
+ }
+ }
+ return;
+ }
+ if (depth == 4) {
+ index = (y * bytesPerLine) + (x >> 1);
+ if ((x & 0x1) == 1) {
theByte = data[index] & 0xFF;
+ pixels[i] = theByte & 0x0F;
+ i++;
+ n--;
+ srcX++;
+ if (srcX >= width) {
+ srcY++;
+ index = srcY * bytesPerLine;
+ srcX = 0;
+ } else {
+ index++;
+ }
}
+ while (n > 1) {
+ theByte = data[index] & 0xFF;
+ pixels[i] = theByte >> 4;
+ i++;
+ n--;
+ srcX++;
+ if (srcX >= width) {
+ srcY++;
+ index = srcY * bytesPerLine;
+ srcX = 0;
+ } else {
+ pixels[i] = theByte & 0x0F;
+ i++;
+ n--;
+ srcX++;
+ if (srcX >= width) {
+ srcY++;
+ index = srcY * bytesPerLine;
+ srcX = 0;
+ } else {
+ index++;
+ }
+ }
+ }
+ if (n > 0) {
+ theByte = data[index] & 0xFF;
+ pixels[i] = theByte >> 4;
+ }
+ return;
}
- }
- return;
- }
- if (depth == 4) {
- index = (y * bytesPerLine) + (x >> 1);
- if ((x & 0x1) == 1) {
- theByte = data[index] & 0xFF;
- pixels[i] = theByte & 0x0F;
- i++;
- n--;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- srcX = 0;
- } else {
- index++;
- }
- }
- while (n > 1) {
- theByte = data[index] & 0xFF;
- pixels[i] = theByte >> 4;
- i++;
- n--;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- srcX = 0;
- } else {
- pixels[i] = theByte & 0x0F;
- i++;
- n--;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- srcX = 0;
- } else {
- index++;
+ if (depth == 8) {
+ index = (y * bytesPerLine) + x;
+ for (int j = 0; j < getWidth; j++) {
+ pixels[i] = data[index] & 0xFF;
+ i++;
+ srcX++;
+ if (srcX >= width) {
+ srcY++;
+ index = srcY * bytesPerLine;
+ srcX = 0;
+ } else {
+ index++;
+ }
+ }
+ return;
+ }
+ if (depth == 16) {
+ index = (y * bytesPerLine) + (x * 2);
+ for (int j = 0; j < getWidth; j++) {
+ pixels[i] = ((data[index + 1] & 0xFF) << 8) + (data[index] & 0xFF);
+ i++;
+ srcX++;
+ if (srcX >= width) {
+ srcY++;
+ index = srcY * bytesPerLine;
+ srcX = 0;
+ } else {
+ index += 2;
+ }
+ }
+ return;
+ }
+ if (depth == 24) {
+ index = (y * bytesPerLine) + (x * 3);
+ for (int j = 0; j < getWidth; j++) {
+ pixels[i] = ((data[index] & 0xFF) << 16) | ((data[index + 1] & 0xFF) << 8) | (data[index + 2] & 0xFF);
+ i++;
+ srcX++;
+ if (srcX >= width) {
+ srcY++;
+ index = srcY * bytesPerLine;
+ srcX = 0;
+ } else {
+ index += 3;
+ }
+ }
+ return;
+ }
+ if (depth == 32) {
+ index = (y * bytesPerLine) + (x * 4);
+ i = startIndex;
+ for (int j = 0; j < getWidth; j++) {
+ pixels[i] = ((data[index] & 0xFF) << 24) | ((data[index + 1] & 0xFF) << 16) | ((data[index + 2] & 0xFF) << 8) | (data[index + 3] & 0xFF);
+ i++;
+ srcX++;
+ if (srcX >= width) {
+ srcY++;
+ index = srcY * bytesPerLine;
+ srcX = 0;
+ } else {
+ index += 4;
+ }
}
+ return;
}
+ SWT.error(SWT.ERROR_UNSUPPORTED_DEPTH);
}
- if (n > 0) {
- theByte = data[index] & 0xFF;
- pixels[i] = theByte >> 4;
+
+ /**
+ * Returns an array of <code>RGB</code>s which comprise the
+ * indexed color table of the receiver, or null if the receiver
+ * has a direct color model.
+ *
+ * @return the RGB values for the image or null if direct color
+ *
+ * @see IconExe.PaletteData#getRGBs()
+ */
+ public RGB[] getRGBs() {
+ return palette.getRGBs();
}
- return;
- }
- if (depth == 8) {
- index = (y * bytesPerLine) + x;
- for (int j = 0; j < getWidth; j++) {
- pixels[i] = data[index] & 0xFF;
- i++;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- srcX = 0;
- } else {
- index++;
+
+ /**
+ * Returns an <code>ImageData</code> which specifies the
+ * transparency mask information for the receiver, or null if the
+ * receiver has no transparency and is not an icon.
+ *
+ * @return the transparency mask or null if none exists
+ */
+ public ImageData getTransparencyMask() {
+ if (getTransparencyType() == SWT.TRANSPARENCY_MASK) {
+ return new ImageData(width, height, 1, bwPalette(), maskPad, maskData);
}
+ return colorMaskImage(transparentPixel);
}
- return;
- }
- if (depth == 16) {
- index = (y * bytesPerLine) + (x * 2);
- for (int j = 0; j < getWidth; j++) {
- pixels[i] = ((data[index+1] & 0xFF) << 8) + (data[index] & 0xFF);
- i++;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- srcX = 0;
- } else {
- index += 2;
- }
- }
- return;
- }
- if (depth == 24) {
- index = (y * bytesPerLine) + (x * 3);
- for (int j = 0; j < getWidth; j++) {
- pixels[i] = ((data[index] & 0xFF) << 16) | ((data[index+1] & 0xFF) << 8)
- | (data[index+2] & 0xFF);
- i++;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- srcX = 0;
- } else {
- index += 3;
- }
- }
- return;
- }
- if (depth == 32) {
- index = (y * bytesPerLine) + (x * 4);
- i = startIndex;
- for (int j = 0; j < getWidth; j++) {
- pixels[i] = ((data[index] & 0xFF) << 24) | ((data[index+1] & 0xFF) << 16)
- | ((data[index+2] & 0xFF) << 8) | (data[index+3] & 0xFF);
- i++;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- srcX = 0;
- } else {
- index += 4;
+
+ /**
+ * Returns the image transparency type.
+ *
+ * @return the receiver's transparency type
+ */
+ public int getTransparencyType() {
+ if (maskData != null)
+ return SWT.TRANSPARENCY_MASK;
+ if (transparentPixel != -1)
+ return SWT.TRANSPARENCY_PIXEL;
+ if (alphaData != null)
+ return SWT.TRANSPARENCY_ALPHA;
+ return SWT.TRANSPARENCY_NONE;
+ }
+
+ /**
+ * Returns the byte order of the receiver.
+ *
+ * @return MSB_FIRST or LSB_FIRST
+ */
+ int getByteOrder() {
+ return depth != 16 ? MSB_FIRST : LSB_FIRST;
+ }
+
+ /**
+ * Sets the pixel values starting at offset <code>x</code> in
+ * scanline <code>y</code> in the receiver's data to the
+ * values from the array <code>pixels</code> starting at
+ * <code>startIndex</code>.
+ *
+ * @param x the x position of the pixel to set
+ * @param y the y position of the pixel to set
+ * @param putWidth the width of the pixels to set
+ * @param pixels the pixels to set
+ * @param startIndex the index at which to begin setting
+ *
+ * @exception IndexOutOfBoundsException if putWidth is too large
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if pixels is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if x or y is out of bounds</li>
+ * <li>ERROR_INVALID_ARGUMENT - if putWidth is negative</li>
+ * </ul>
+ * @exception RuntimeException <ul>
+ * <li>ERROR_UNSUPPORTED_DEPTH if the depth is not one of 1, 2, 4, 8
+ * (For higher depths, use the int[] version of this method.)</li>
+ * </ul>
+ */
+ public void setPixels(int x, int y, int putWidth, byte[] pixels, int startIndex) {
+ if (pixels == null)
+ SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (putWidth < 0 || x >= width || y >= height || x < 0 || y < 0)
+ SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ if (putWidth == 0)
+ return;
+ int index;
+ int theByte;
+ int mask;
+ int n = putWidth;
+ int i = startIndex;
+ int srcX = x, srcY = y;
+ if (depth == 1) {
+ index = (y * bytesPerLine) + (x >> 3);
+ while (n > 0) {
+ mask = 1 << (7 - (srcX & 0x7));
+ if ((pixels[i] & 0x1) == 1) {
+ data[index] = (byte) ((data[index] & 0xFF) | mask);
+ } else {
+ data[index] = (byte) ((data[index] & 0xFF) & (mask ^ -1));
+ }
+ i++;
+ n--;
+ srcX++;
+ if (srcX >= width) {
+ srcY++;
+ index = srcY * bytesPerLine;
+ srcX = 0;
+ } else {
+ if (mask == 1) {
+ index++;
+ }
+ }
+ }
+ return;
+ }
+ if (depth == 2) {
+ byte[] masks = {(byte) 0xFC, (byte) 0xF3, (byte) 0xCF, (byte) 0x3F};
+ index = (y * bytesPerLine) + (x >> 2);
+ int offset = 3 - (x % 4);
+ while (n > 0) {
+ theByte = pixels[i] & 0x3;
+ data[index] = (byte) ((data[index] & masks[offset]) | (theByte << (offset * 2)));
+ i++;
+ n--;
+ srcX++;
+ if (srcX >= width) {
+ srcY++;
+ index = srcY * bytesPerLine;
+ offset = 0;
+ srcX = 0;
+ } else {
+ if (offset == 0) {
+ index++;
+ offset = 3;
+ } else {
+ offset--;
+ }
+ }
+ }
+ return;
+ }
+ if (depth == 4) {
+ index = (y * bytesPerLine) + (x >> 1);
+ boolean high = (x & 0x1) == 0;
+ while (n > 0) {
+ theByte = pixels[i] & 0x0F;
+ if (high) {
+ data[index] = (byte) ((data[index] & 0x0F) | (theByte << 4));
+ } else {
+ data[index] = (byte) ((data[index] & 0xF0) | theByte);
+ }
+ i++;
+ n--;
+ srcX++;
+ if (srcX >= width) {
+ srcY++;
+ index = srcY * bytesPerLine;
+ high = true;
+ srcX = 0;
+ } else {
+ if (!high)
+ index++;
+ high = !high;
+ }
+ }
+ return;
+ }
+ if (depth == 8) {
+ index = (y * bytesPerLine) + x;
+ for (int j = 0; j < putWidth; j++) {
+ data[index] = (byte) (pixels[i] & 0xFF);
+ i++;
+ srcX++;
+ if (srcX >= width) {
+ srcY++;
+ index = srcY * bytesPerLine;
+ srcX = 0;
+ } else {
+ index++;
+ }
+ }
+ return;
}
+ SWT.error(SWT.ERROR_UNSUPPORTED_DEPTH);
}
- return;
- }
- SWT.error(SWT.ERROR_UNSUPPORTED_DEPTH);
-}
-/**
- * Returns an array of <code>RGB</code>s which comprise the
- * indexed color table of the receiver, or null if the receiver
- * has a direct color model.
- *
- * @return the RGB values for the image or null if direct color
- *
- * @see IconExe.PaletteData#getRGBs()
- */
-public RGB[] getRGBs() {
- return palette.getRGBs();
-}
+ /**
+ * Sets the pixel values starting at offset <code>x</code> in
+ * scanline <code>y</code> in the receiver's data to the
+ * values from the array <code>pixels</code> starting at
+ * <code>startIndex</code>.
+ *
+ * @param x the x position of the pixel to set
+ * @param y the y position of the pixel to set
+ * @param putWidth the width of the pixels to set
+ * @param pixels the pixels to set
+ * @param startIndex the index at which to begin setting
+ *
+ * @exception IndexOutOfBoundsException if putWidth is too large
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if pixels is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if x or y is out of bounds</li>
+ * <li>ERROR_INVALID_ARGUMENT - if putWidth is negative</li>
+ * </ul>
+ * @exception RuntimeException <ul>
+ * <li>ERROR_UNSUPPORTED_DEPTH if the depth is not one of 1, 2, 4, 8, 16, 24 or 32</li>
+ * </ul>
+ */
+ public void setPixels(int x, int y, int putWidth, int[] pixels, int startIndex) {
+ if (pixels == null)
+ SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (putWidth < 0 || x >= width || y >= height || x < 0 || y < 0)
+ SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ if (putWidth == 0)
+ return;
+ int index;
+ int theByte;
+ int mask;
+ int n = putWidth;
+ int i = startIndex;
+ int pixel;
+ int srcX = x, srcY = y;
+ if (depth == 1) {
+ index = (y * bytesPerLine) + (x >> 3);
+ while (n > 0) {
+ mask = 1 << (7 - (srcX & 0x7));
+ if ((pixels[i] & 0x1) == 1) {
+ data[index] = (byte) ((data[index] & 0xFF) | mask);
+ } else {
+ data[index] = (byte) ((data[index] & 0xFF) & (mask ^ -1));
+ }
+ i++;
+ n--;
+ srcX++;
+ if (srcX >= width) {
+ srcY++;
+ index = srcY * bytesPerLine;
+ srcX = 0;
+ } else {
+ if (mask == 1) {
+ index++;
+ }
+ }
+ }
+ return;
+ }
+ if (depth == 2) {
+ byte[] masks = {(byte) 0xFC, (byte) 0xF3, (byte) 0xCF, (byte) 0x3F};
+ index = (y * bytesPerLine) + (x >> 2);
+ int offset = 3 - (x % 4);
+ while (n > 0) {
+ theByte = pixels[i] & 0x3;
+ data[index] = (byte) ((data[index] & masks[offset]) | (theByte << (offset * 2)));
+ i++;
+ n--;
+ srcX++;
+ if (srcX >= width) {
+ srcY++;
+ index = srcY * bytesPerLine;
+ offset = 3;
+ srcX = 0;
+ } else {
+ if (offset == 0) {
+ index++;
+ offset = 3;
+ } else {
+ offset--;
+ }
+ }
+ }
+ return;
+ }
+ if (depth == 4) {
+ index = (y * bytesPerLine) + (x >> 1);
+ boolean high = (x & 0x1) == 0;
+ while (n > 0) {
+ theByte = pixels[i] & 0x0F;
+ if (high) {
+ data[index] = (byte) ((data[index] & 0x0F) | (theByte << 4));
+ } else {
+ data[index] = (byte) ((data[index] & 0xF0) | theByte);
+ }
+ i++;
+ n--;
+ srcX++;
+ if (srcX >= width) {
+ srcY++;
+ index = srcY * bytesPerLine;
+ high = true;
+ srcX = 0;
+ } else {
+ if (!high)
+ index++;
+ high = !high;
+ }
+ }
+ return;
+ }
+ if (depth == 8) {
+ index = (y * bytesPerLine) + x;
+ for (int j = 0; j < putWidth; j++) {
+ data[index] = (byte) (pixels[i] & 0xFF);
+ i++;
+ srcX++;
+ if (srcX >= width) {
+ srcY++;
+ index = srcY * bytesPerLine;
+ srcX = 0;
+ } else {
+ index++;
+ }
+ }
+ return;
-/**
- * Returns an <code>ImageData</code> which specifies the
- * transparency mask information for the receiver, or null if the
- * receiver has no transparency and is not an icon.
- *
- * @return the transparency mask or null if none exists
- */
-public ImageData getTransparencyMask() {
- if (getTransparencyType() == SWT.TRANSPARENCY_MASK) {
- return new ImageData(width, height, 1, bwPalette(), maskPad, maskData);
- }
- return colorMaskImage(transparentPixel);
-}
+ }
+ if (depth == 16) {
+ index = (y * bytesPerLine) + (x * 2);
+ for (int j = 0; j < putWidth; j++) {
+ pixel = pixels[i];
+ data[index] = (byte) (pixel & 0xFF);
+ data[index + 1] = (byte) ((pixel >> 8) & 0xFF);
+ i++;
+ srcX++;
+ if (srcX >= width) {
+ srcY++;
+ index = srcY * bytesPerLine;
+ srcX = 0;
+ } else {
+ index += 2;
+ }
+ }
+ return;
+ }
+ if (depth == 24) {
+ index = (y * bytesPerLine) + (x * 3);
+ for (int j = 0; j < putWidth; j++) {
+ pixel = pixels[i];
+ data[index] = (byte) ((pixel >> 16) & 0xFF);
+ data[index + 1] = (byte) ((pixel >> 8) & 0xFF);
+ data[index + 2] = (byte) (pixel & 0xFF);
+ i++;
+ srcX++;
+ if (srcX >= width) {
+ srcY++;
+ index = srcY * bytesPerLine;
+ srcX = 0;
+ } else {
+ index += 3;
+ }
+ }
+ return;
+ }
+ if (depth == 32) {
+ index = (y * bytesPerLine) + (x * 4);
+ for (int j = 0; j < putWidth; j++) {
+ pixel = pixels[i];
+ data[index] = (byte) ((pixel >> 24) & 0xFF);
+ data[index + 1] = (byte) ((pixel >> 16) & 0xFF);
+ data[index + 2] = (byte) ((pixel >> 8) & 0xFF);
+ data[index + 3] = (byte) (pixel & 0xFF);
+ i++;
+ srcX++;
+ if (srcX >= width) {
+ srcY++;
+ index = srcY * bytesPerLine;
+ srcX = 0;
+ } else {
+ index += 4;
+ }
+ }
+ return;
+ }
+ SWT.error(SWT.ERROR_UNSUPPORTED_DEPTH);
+ }
-/**
- * Returns the image transparency type.
- *
- * @return the receiver's transparency type
- */
-public int getTransparencyType() {
- if (maskData != null) return SWT.TRANSPARENCY_MASK;
- if (transparentPixel != -1) return SWT.TRANSPARENCY_PIXEL;
- if (alphaData != null) return SWT.TRANSPARENCY_ALPHA;
- return SWT.TRANSPARENCY_NONE;
-}
+ /**
+ * Returns a palette with 2 colors: black & white.
+ */
+ static PaletteData bwPalette() {
+ return new PaletteData(new RGB[] {new RGB(0, 0, 0), new RGB(255, 255, 255)});
+ }
-/**
- * Returns the byte order of the receiver.
- *
- * @return MSB_FIRST or LSB_FIRST
- */
-int getByteOrder() {
- return depth != 16 ? MSB_FIRST : LSB_FIRST;
-}
+ /**
+ * Gets the offset of the most significant bit for
+ * the given mask.
+ */
+ static int getMSBOffset(int mask) {
+ for (int i = 31; i >= 0; i--) {
+ if (((mask >> i) & 0x1) != 0)
+ return i + 1;
+ }
+ return 0;
+ }
-/**
- * Sets the pixel values starting at offset <code>x</code> in
- * scanline <code>y</code> in the receiver's data to the
- * values from the array <code>pixels</code> starting at
- * <code>startIndex</code>.
- *
- * @param x the x position of the pixel to set
- * @param y the y position of the pixel to set
- * @param putWidth the width of the pixels to set
- * @param pixels the pixels to set
- * @param startIndex the index at which to begin setting
- *
- * @exception IndexOutOfBoundsException if putWidth is too large
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if pixels is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if x or y is out of bounds</li>
- * <li>ERROR_INVALID_ARGUMENT - if putWidth is negative</li>
- * </ul>
- * @exception RuntimeException <ul>
- * <li>ERROR_UNSUPPORTED_DEPTH if the depth is not one of 1, 2, 4, 8
- * (For higher depths, use the int[] version of this method.)</li>
- * </ul>
- */
-public void setPixels(int x, int y, int putWidth, byte[] pixels, int startIndex) {
- if (pixels == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (putWidth < 0 || x >= width || y >= height || x < 0 || y < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- if (putWidth == 0) return;
- int index;
- int theByte;
- int mask;
- int n = putWidth;
- int i = startIndex;
- int srcX = x, srcY = y;
- if (depth == 1) {
- index = (y * bytesPerLine) + (x >> 3);
- while (n > 0) {
- mask = 1 << (7 - (srcX & 0x7));
- if ((pixels[i] & 0x1) == 1) {
- data[index] = (byte)((data[index] & 0xFF) | mask);
- } else {
- data[index] = (byte)((data[index] & 0xFF) & (mask ^ -1));
- }
- i++;
- n--;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- srcX = 0;
- } else {
- if (mask == 1) {
- index++;
+ /**
+ * Finds the closest match.
+ */
+ static int closestMatch(int depth, byte red, byte green, byte blue, int redMask, int greenMask, int blueMask, byte[] reds, byte[] greens, byte[] blues) {
+ if (depth > 8) {
+ int rshift = 32 - getMSBOffset(redMask);
+ int gshift = 32 - getMSBOffset(greenMask);
+ int bshift = 32 - getMSBOffset(blueMask);
+ return (((red << 24) >>> rshift) & redMask) | (((green << 24) >>> gshift) & greenMask) | (((blue << 24) >>> bshift) & blueMask);
+ }
+ int r, g, b;
+ int minDistance = 0x7fffffff;
+ int nearestPixel = 0;
+ int n = reds.length;
+ for (int j = 0; j < n; j++) {
+ r = (reds[j] & 0xFF) - (red & 0xFF);
+ g = (greens[j] & 0xFF) - (green & 0xFF);
+ b = (blues[j] & 0xFF) - (blue & 0xFF);
+ int distance = r * r + g * g + b * b;
+ if (distance < minDistance) {
+ nearestPixel = j;
+ if (distance == 0)
+ break;
+ minDistance = distance;
}
}
+ return nearestPixel;
}
- return;
- }
- if (depth == 2) {
- byte [] masks = { (byte)0xFC, (byte)0xF3, (byte)0xCF, (byte)0x3F };
- index = (y * bytesPerLine) + (x >> 2);
- int offset = 3 - (x % 4);
- while (n > 0) {
- theByte = pixels[i] & 0x3;
- data[index] = (byte)((data[index] & masks[offset]) | (theByte << (offset * 2)));
- i++;
- n--;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- offset = 0;
- srcX = 0;
- } else {
- if (offset == 0) {
- index++;
- offset = 3;
- } else {
- offset--;
+
+ static final ImageData convertMask(ImageData mask) {
+ if (mask.depth == 1)
+ return mask;
+ PaletteData palette = new PaletteData(new RGB[] {new RGB(0, 0, 0), new RGB(255, 255, 255)});
+ ImageData newMask = new ImageData(mask.width, mask.height, 1, palette);
+ /* Find index of black in mask palette */
+ int blackIndex = 0;
+ RGB[] rgbs = mask.getRGBs();
+ if (rgbs != null) {
+ while (blackIndex < rgbs.length) {
+ if (rgbs[blackIndex].equals(palette.colors[0]))
+ break;
+ blackIndex++;
+ }
+ }
+ int[] pixels = new int[mask.width];
+ for (int y = 0; y < mask.height; y++) {
+ mask.getPixels(0, y, mask.width, pixels, 0);
+ for (int i = 0; i < pixels.length; i++) {
+ if (pixels[i] == blackIndex) {
+ pixels[i] = 0;
+ } else {
+ pixels[i] = 1;
+ }
}
+ newMask.setPixels(0, y, mask.width, pixels, 0);
}
+ return newMask;
}
- return;
- }
- if (depth == 4) {
- index = (y * bytesPerLine) + (x >> 1);
- boolean high = (x & 0x1) == 0;
- while (n > 0) {
- theByte = pixels[i] & 0x0F;
- if (high) {
- data[index] = (byte)((data[index] & 0x0F) | (theByte << 4));
- } else {
- data[index] = (byte)((data[index] & 0xF0) | theByte);
- }
- i++;
- n--;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- high = true;
- srcX = 0;
- } else {
- if (!high) index++;
- high = !high;
- }
- }
- return;
- }
- if (depth == 8) {
- index = (y * bytesPerLine) + x;
- for (int j = 0; j < putWidth; j++) {
- data[index] = (byte)(pixels[i] & 0xFF);
- i++;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- srcX = 0;
- } else {
- index++;
+
+ static final byte[] convertPad(byte[] data, int width, int height, int depth, int pad, int newPad) {
+ if (pad == newPad)
+ return data;
+ int stride = (width * depth + 7) / 8;
+ int bpl = (stride + (pad - 1)) / pad * pad;
+ int newBpl = (stride + (newPad - 1)) / newPad * newPad;
+ byte[] newData = new byte[height * newBpl];
+ int srcIndex = 0, destIndex = 0;
+ for (int y = 0; y < height; y++) {
+ System.arraycopy(data, srcIndex, newData, destIndex, stride);
+ srcIndex += bpl;
+ destIndex += newBpl;
}
+ return newData;
}
- return;
- }
- SWT.error(SWT.ERROR_UNSUPPORTED_DEPTH);
-}
-/**
- * Sets the pixel values starting at offset <code>x</code> in
- * scanline <code>y</code> in the receiver's data to the
- * values from the array <code>pixels</code> starting at
- * <code>startIndex</code>.
- *
- * @param x the x position of the pixel to set
- * @param y the y position of the pixel to set
- * @param putWidth the width of the pixels to set
- * @param pixels the pixels to set
- * @param startIndex the index at which to begin setting
- *
- * @exception IndexOutOfBoundsException if putWidth is too large
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if pixels is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if x or y is out of bounds</li>
- * <li>ERROR_INVALID_ARGUMENT - if putWidth is negative</li>
- * </ul>
- * @exception RuntimeException <ul>
- * <li>ERROR_UNSUPPORTED_DEPTH if the depth is not one of 1, 2, 4, 8, 16, 24 or 32</li>
- * </ul>
- */
-public void setPixels(int x, int y, int putWidth, int[] pixels, int startIndex) {
- if (pixels == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (putWidth < 0 || x >= width || y >= height || x < 0 || y < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- if (putWidth == 0) return;
- int index;
- int theByte;
- int mask;
- int n = putWidth;
- int i = startIndex;
- int pixel;
- int srcX = x, srcY = y;
- if (depth == 1) {
- index = (y * bytesPerLine) + (x >> 3);
- while (n > 0) {
- mask = 1 << (7 - (srcX & 0x7));
- if ((pixels[i] & 0x1) == 1) {
- data[index] = (byte)((data[index] & 0xFF) | mask);
- } else {
- data[index] = (byte)((data[index] & 0xFF) & (mask ^ -1));
- }
- i++;
- n--;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- srcX = 0;
- } else {
- if (mask == 1) {
- index++;
- }
+ /**
+ * Blit operation bits to be OR'ed together to specify the desired operation.
+ */
+ static final int BLIT_SRC = 1, // copy source directly, else applies logic operations
+ BLIT_ALPHA = 2, // enable alpha blending
+ BLIT_DITHER = 4; // enable dithering in low color modes
+
+ /**
+ * Alpha mode, values 0 - 255 specify global alpha level
+ */
+ static final int ALPHA_OPAQUE = 255, // Fully opaque (ignores any alpha data)
+ ALPHA_TRANSPARENT = 0, // Fully transparent (ignores any alpha data)
+ ALPHA_CHANNEL_SEPARATE = -1, // Use alpha channel from separate alphaData
+ ALPHA_CHANNEL_SOURCE = -2, // Use alpha channel embedded in sourceData
+ ALPHA_MASK_UNPACKED = -3, // Use transparency mask formed by bytes in alphaData (non-zero is opaque)
+ ALPHA_MASK_PACKED = -4, // Use transparency mask formed by packed bits in alphaData
+ ALPHA_MASK_INDEX = -5, // Consider source palette indices transparent if in alphaData array
+ ALPHA_MASK_RGB = -6; // Consider source RGBs transparent if in RGB888 format alphaData array
+
+ /**
+ * Byte and bit order constants.
+ */
+ static final int LSB_FIRST = 0;
+ static final int MSB_FIRST = 1;
+
+ /**
+ * Data types (internal)
+ */
+ /*
+ private static final int
+ // direct / true color formats with arbitrary masks & shifts
+ TYPE_GENERIC_8 = 0,
+ TYPE_GENERIC_16_MSB = 1,
+ TYPE_GENERIC_16_LSB = 2,
+ TYPE_GENERIC_24 = 3,
+ TYPE_GENERIC_32_MSB = 4,
+ TYPE_GENERIC_32_LSB = 5,
+ // palette indexed color formats
+ TYPE_INDEX_8 = 6,
+ TYPE_INDEX_4 = 7,
+ TYPE_INDEX_2 = 8,
+ TYPE_INDEX_1_MSB = 9,
+ TYPE_INDEX_1_LSB = 10;
+ */
+ /**
+ * Computes the required channel shift from a mask.
+ */
+ static int getChannelShift(int mask) {
+ if (mask == 0)
+ return 0;
+ int i;
+ for (i = 0; ((mask & 1) == 0) && (i < 32); ++i) {
+ mask >>>= 1;
+ }
+ return i;
+ }
+
+ /**
+ * Computes the required channel width (depth) from a mask.
+ */
+ static int getChannelWidth(int mask, int shift) {
+ if (mask == 0)
+ return 0;
+ int i;
+ mask >>>= shift;
+ for (i = shift; ((mask & 1) != 0) && (i < 32); ++i) {
+ mask >>>= 1;
}
+ return i - shift;
+ }
+
+ /**
+ * Extracts a field from packed RGB data given a mask for that field.
+ */
+ static byte getChannelField(int data, int mask) {
+ final int shift = getChannelShift(mask);
+ return ANY_TO_EIGHT[getChannelWidth(mask, shift)][(data & mask) >>> shift];
}
- return;
- }
- if (depth == 2) {
- byte [] masks = { (byte)0xFC, (byte)0xF3, (byte)0xCF, (byte)0x3F };
- index = (y * bytesPerLine) + (x >> 2);
- int offset = 3 - (x % 4);
- while (n > 0) {
- theByte = pixels[i] & 0x3;
- data[index] = (byte)((data[index] & masks[offset]) | (theByte << (offset * 2)));
- i++;
- n--;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- offset = 3;
- srcX = 0;
+
+ /*
+ * Fill in dithered gradated values for a color channel
+ */
+ static final void buildDitheredGradientChannel(int from, int to, int steps, int bandWidth, int bandHeight, boolean vertical, byte[] bitmapData, int dp, int bytesPerLine, int bits) {
+ final int mask = 0xff00 >>> bits;
+ int val = from << 16;
+ final int inc = ((to << 16) - val) / steps + 1;
+ if (vertical) {
+ for (int dy = 0; dy < bandHeight; ++dy, dp += bytesPerLine) {
+ for (int dx = 0, dptr = dp; dx < bandWidth; ++dx, dptr += 4) {
+ final int thresh = DITHER_MATRIX[dy & 7][dx] >>> bits;
+ int temp = val + thresh;
+ if (temp > 0xffffff)
+ bitmapData[dptr] = -1;
+ else
+ bitmapData[dptr] = (byte) ((temp >>> 16) & mask);
+ }
+ val += inc;
+ }
} else {
- if (offset == 0) {
- index++;
- offset = 3;
- } else {
- offset--;
+ for (int dx = 0; dx < bandWidth; ++dx, dp += 4) {
+ for (int dy = 0, dptr = dp; dy < bandHeight; ++dy, dptr += bytesPerLine) {
+ final int thresh = DITHER_MATRIX[dy][dx & 7] >>> bits;
+ int temp = val + thresh;
+ if (temp > 0xffffff)
+ bitmapData[dptr] = -1;
+ else
+ bitmapData[dptr] = (byte) ((temp >>> 16) & mask);
+ }
+ val += inc;
}
}
}
- return;
}
- if (depth == 4) {
- index = (y * bytesPerLine) + (x >> 1);
- boolean high = (x & 0x1) == 0;
- while (n > 0) {
- theByte = pixels[i] & 0x0F;
- if (high) {
- data[index] = (byte)((data[index] & 0x0F) | (theByte << 4));
- } else {
- data[index] = (byte)((data[index] & 0xF0) | theByte);
- }
- i++;
- n--;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- high = true;
- srcX = 0;
- } else {
- if (!high) index++;
- high = !high;
- }
- }
- return;
- }
- if (depth == 8) {
- index = (y * bytesPerLine) + x;
- for (int j = 0; j < putWidth; j++) {
- data[index] = (byte)(pixels[i] & 0xFF);
- i++;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- srcX = 0;
- } else {
- index++;
- }
+
+ static class LEDataInputStream extends InputStream {
+ int position;
+ InputStream in;
+
+ /**
+ * The byte array containing the bytes to read.
+ */
+ protected byte[] buf;
+
+ /**
+ * The current position within the byte array <code>buf</code>. A value
+ * equal to buf.length indicates no bytes available. A value of
+ * 0 indicates the buffer is full.
+ */
+ protected int pos;
+
+ public LEDataInputStream(InputStream input) {
+ this(input, 512);
}
- return;
- }
- if (depth == 16) {
- index = (y * bytesPerLine) + (x * 2);
- for (int j = 0; j < putWidth; j++) {
- pixel = pixels[i];
- data[index] = (byte)(pixel & 0xFF);
- data[index + 1] = (byte)((pixel >> 8) & 0xFF);
- i++;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- srcX = 0;
- } else {
- index += 2;
- }
- }
- return;
- }
- if (depth == 24) {
- index = (y * bytesPerLine) + (x * 3);
- for (int j = 0; j < putWidth; j++) {
- pixel = pixels[i];
- data[index] = (byte)((pixel >> 16) & 0xFF);
- data[index + 1] = (byte)((pixel >> 8) & 0xFF);
- data[index + 2] = (byte)(pixel & 0xFF);
- i++;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- srcX = 0;
- } else {
- index += 3;
- }
- }
- return;
- }
- if (depth == 32) {
- index = (y * bytesPerLine) + (x * 4);
- for (int j = 0; j < putWidth; j++) {
- pixel = pixels[i];
- data[index] = (byte)((pixel >> 24) & 0xFF);
- data[index + 1] = (byte)((pixel >> 16) & 0xFF);
- data[index + 2] = (byte)((pixel >> 8) & 0xFF);
- data[index + 3] = (byte)(pixel & 0xFF);
- i++;
- srcX++;
- if (srcX >= width) {
- srcY++;
- index = srcY * bytesPerLine;
- srcX = 0;
- } else {
- index += 4;
+ public LEDataInputStream(InputStream input, int bufferSize) {
+ this.in = input;
+ if (bufferSize > 0) {
+ buf = new byte[bufferSize];
+ pos = bufferSize;
+ } else
+ throw new IllegalArgumentException();
+ }
+
+ public void close() throws IOException {
+ buf = null;
+ if (in != null) {
+ in.close();
+ in = null;
}
}
- return;
- }
- SWT.error(SWT.ERROR_UNSUPPORTED_DEPTH);
-}
-/**
- * Returns a palette with 2 colors: black & white.
- */
-static PaletteData bwPalette() {
- return new PaletteData(new RGB[] {new RGB(0, 0, 0), new RGB(255, 255, 255)});
-}
+ /**
+ * Answer how many bytes were read.
+ */
+ public int getPosition() {
+ return position;
+ }
-/**
- * Gets the offset of the most significant bit for
- * the given mask.
- */
-static int getMSBOffset(int mask) {
- for (int i = 31; i >= 0; i--) {
- if (((mask >> i) & 0x1) != 0) return i + 1;
- }
- return 0;
-}
+ /**
+ * Answers how many bytes are available for reading without blocking
+ */
+ public int available() throws IOException {
+ if (buf == null)
+ throw new IOException();
+ return (buf.length - pos) + in.available();
+ }
-/**
- * Finds the closest match.
- */
-static int closestMatch(int depth, byte red, byte green, byte blue, int redMask, int greenMask, int blueMask, byte[] reds, byte[] greens, byte[] blues) {
- if (depth > 8) {
- int rshift = 32 - getMSBOffset(redMask);
- int gshift = 32 - getMSBOffset(greenMask);
- int bshift = 32 - getMSBOffset(blueMask);
- return (((red << 24) >>> rshift) & redMask) |
- (((green << 24) >>> gshift) & greenMask) |
- (((blue << 24) >>> bshift) & blueMask);
- }
- int r, g, b;
- int minDistance = 0x7fffffff;
- int nearestPixel = 0;
- int n = reds.length;
- for (int j = 0; j < n; j++) {
- r = (reds[j] & 0xFF) - (red & 0xFF);
- g = (greens[j] & 0xFF) - (green & 0xFF);
- b = (blues[j] & 0xFF) - (blue & 0xFF);
- int distance = r*r + g*g + b*b;
- if (distance < minDistance) {
- nearestPixel = j;
- if (distance == 0) break;
- minDistance = distance;
- }
- }
- return nearestPixel;
-}
+ /**
+ * Answer the next byte of the input stream.
+ */
+ public int read() throws IOException {
+ if (buf == null)
+ throw new IOException();
+ position++;
+ if (pos < buf.length)
+ return (buf[pos++] & 0xFF);
+ return in.read();
+ }
-static final ImageData convertMask(ImageData mask) {
- if (mask.depth == 1) return mask;
- PaletteData palette = new PaletteData(new RGB[] {new RGB(0, 0, 0), new RGB(255,255,255)});
- ImageData newMask = new ImageData(mask.width, mask.height, 1, palette);
- /* Find index of black in mask palette */
- int blackIndex = 0;
- RGB[] rgbs = mask.getRGBs();
- if (rgbs != null) {
- while (blackIndex < rgbs.length) {
- if (rgbs[blackIndex].equals(palette.colors[0])) break;
- blackIndex++;
- }
- }
- int[] pixels = new int[mask.width];
- for (int y = 0; y < mask.height; y++) {
- mask.getPixels(0, y, mask.width, pixels, 0);
- for (int i = 0; i < pixels.length; i++) {
- if (pixels[i] == blackIndex) {
- pixels[i] = 0;
- } else {
- pixels[i] = 1;
+ /**
+ * Don't imitate the JDK behaviour of reading a random number
+ * of bytes when you can actually read them all.
+ */
+ public int read(byte b[], int off, int len) throws IOException {
+ int result;
+ int left = len;
+ result = readData(b, off, len);
+ while (true) {
+ if (result == -1)
+ return -1;
+ position += result;
+ if (result == left)
+ return len;
+ left -= result;
+ off += result;
+ result = readData(b, off, left);
}
}
- newMask.setPixels(0, y, mask.width, pixels, 0);
- }
- return newMask;
-}
-static final byte[] convertPad(byte[] data, int width, int height, int depth, int pad, int newPad) {
- if (pad == newPad) return data;
- int stride = (width * depth + 7) / 8;
- int bpl = (stride + (pad - 1)) / pad * pad;
- int newBpl = (stride + (newPad - 1)) / newPad * newPad;
- byte[] newData = new byte[height * newBpl];
- int srcIndex = 0, destIndex = 0;
- for (int y = 0; y < height; y++) {
- System.arraycopy(data, srcIndex, newData, destIndex, stride);
- srcIndex += bpl;
- destIndex += newBpl;
- }
- return newData;
-}
+ /**
+ * Reads at most <code>length</code> bytes from this LEDataInputStream and
+ * stores them in byte array <code>buffer</code> starting at <code>offset</code>.
+ * <p>
+ * Answer the number of bytes actually read or -1 if no bytes were read and
+ * end of stream was encountered. This implementation reads bytes from
+ * the pushback buffer first, then the target stream if more bytes are required
+ * to satisfy <code>count</code>.
+ * </p>
+ * @param buffer the byte array in which to store the read bytes.
+ * @param offset the offset in <code>buffer</code> to store the read bytes.
+ * @param length the maximum number of bytes to store in <code>buffer</code>.
+ *
+ * @return int the number of bytes actually read or -1 if end of stream.
+ *
+ * @exception java.io.IOException if an IOException occurs.
+ */
+ private int readData(byte[] buffer, int offset, int length) throws IOException {
+ if (buf == null)
+ throw new IOException();
+ if (offset < 0 || offset > buffer.length || length < 0 || (length > buffer.length - offset)) {
+ throw new ArrayIndexOutOfBoundsException();
+ }
-/**
- * Blit operation bits to be OR'ed together to specify the desired operation.
- */
-static final int
- BLIT_SRC = 1, // copy source directly, else applies logic operations
- BLIT_ALPHA = 2, // enable alpha blending
- BLIT_DITHER = 4; // enable dithering in low color modes
+ int cacheCopied = 0;
+ int newOffset = offset;
-/**
- * Alpha mode, values 0 - 255 specify global alpha level
- */
-static final int
- ALPHA_OPAQUE = 255, // Fully opaque (ignores any alpha data)
- ALPHA_TRANSPARENT = 0, // Fully transparent (ignores any alpha data)
- ALPHA_CHANNEL_SEPARATE = -1, // Use alpha channel from separate alphaData
- ALPHA_CHANNEL_SOURCE = -2, // Use alpha channel embedded in sourceData
- ALPHA_MASK_UNPACKED = -3, // Use transparency mask formed by bytes in alphaData (non-zero is opaque)
- ALPHA_MASK_PACKED = -4, // Use transparency mask formed by packed bits in alphaData
- ALPHA_MASK_INDEX = -5, // Consider source palette indices transparent if in alphaData array
- ALPHA_MASK_RGB = -6; // Consider source RGBs transparent if in RGB888 format alphaData array
+ // Are there pushback bytes available?
+ int available = buf.length - pos;
+ if (available > 0) {
+ cacheCopied = (available >= length) ? length : available;
+ System.arraycopy(buf, pos, buffer, newOffset, cacheCopied);
+ newOffset += cacheCopied;
+ pos += cacheCopied;
+ }
-/**
- * Byte and bit order constants.
- */
-static final int LSB_FIRST = 0;
-static final int MSB_FIRST = 1;
+ // Have we copied enough?
+ if (cacheCopied == length)
+ return length;
-/**
- * Data types (internal)
- */
-/*
-private static final int
- // direct / true color formats with arbitrary masks & shifts
- TYPE_GENERIC_8 = 0,
- TYPE_GENERIC_16_MSB = 1,
- TYPE_GENERIC_16_LSB = 2,
- TYPE_GENERIC_24 = 3,
- TYPE_GENERIC_32_MSB = 4,
- TYPE_GENERIC_32_LSB = 5,
- // palette indexed color formats
- TYPE_INDEX_8 = 6,
- TYPE_INDEX_4 = 7,
- TYPE_INDEX_2 = 8,
- TYPE_INDEX_1_MSB = 9,
- TYPE_INDEX_1_LSB = 10;
-*/
-/**
- * Computes the required channel shift from a mask.
- */
-static int getChannelShift(int mask) {
- if (mask == 0) return 0;
- int i;
- for (i = 0; ((mask & 1) == 0) && (i < 32); ++i) {
- mask >>>= 1;
- }
- return i;
-}
+ int inCopied = in.read(buffer, newOffset, length - cacheCopied);
-/**
- * Computes the required channel width (depth) from a mask.
- */
-static int getChannelWidth(int mask, int shift) {
- if (mask == 0) return 0;
- int i;
- mask >>>= shift;
- for (i = shift; ((mask & 1) != 0) && (i < 32); ++i) {
- mask >>>= 1;
- }
- return i - shift;
-}
+ if (inCopied > 0)
+ return inCopied + cacheCopied;
+ if (cacheCopied == 0)
+ return inCopied;
+ return cacheCopied;
+ }
-/**
- * Extracts a field from packed RGB data given a mask for that field.
- */
-static byte getChannelField(int data, int mask) {
- final int shift = getChannelShift(mask);
- return ANY_TO_EIGHT[getChannelWidth(mask, shift)][(data & mask) >>> shift];
-}
+ /**
+ * Answer an integer comprised of the next
+ * four bytes of the input stream.
+ */
+ public int readInt() throws IOException {
+ byte[] buf = new byte[4];
+ read(buf);
+ return ((((((buf[3] & 0xFF) << 8) | (buf[2] & 0xFF)) << 8) | (buf[1] & 0xFF)) << 8) | (buf[0] & 0xFF);
+ }
-/*
- * Fill in dithered gradated values for a color channel
- */
-static final void buildDitheredGradientChannel(int from, int to, int steps,
- int bandWidth, int bandHeight, boolean vertical,
- byte[] bitmapData, int dp, int bytesPerLine, int bits) {
- final int mask = 0xff00 >>> bits;
- int val = from << 16;
- final int inc = ((to << 16) - val) / steps + 1;
- if (vertical) {
- for (int dy = 0; dy < bandHeight; ++dy, dp += bytesPerLine) {
- for (int dx = 0, dptr = dp; dx < bandWidth; ++dx, dptr += 4) {
- final int thresh = DITHER_MATRIX[dy & 7][dx] >>> bits;
- int temp = val + thresh;
- if (temp > 0xffffff) bitmapData[dptr] = -1;
- else bitmapData[dptr] = (byte)((temp >>> 16) & mask);
- }
- val += inc;
- }
- } else {
- for (int dx = 0; dx < bandWidth; ++dx, dp += 4) {
- for (int dy = 0, dptr = dp; dy < bandHeight; ++dy, dptr += bytesPerLine) {
- final int thresh = DITHER_MATRIX[dy][dx & 7] >>> bits;
- int temp = val + thresh;
- if (temp > 0xffffff) bitmapData[dptr] = -1;
- else bitmapData[dptr] = (byte)((temp >>> 16) & mask);
- }
- val += inc;
+ /**
+ * Answer a short comprised of the next
+ * two bytes of the input stream.
+ */
+ public short readShort() throws IOException {
+ byte[] buf = new byte[2];
+ read(buf);
+ return (short) (((buf[1] & 0xFF) << 8) | (buf[0] & 0xFF));
+ }
+
+ /**
+ * Push back the entire content of the given buffer <code>b</code>.
+ * <p>
+ * The bytes are pushed so that they would be read back b[0], b[1], etc.
+ * If the push back buffer cannot handle the bytes copied from <code>b</code>,
+ * an IOException will be thrown and no byte will be pushed back.
+ * </p>
+ *
+ * @param b the byte array containing bytes to push back into the stream
+ *
+ * @exception java.io.IOException if the pushback buffer is too small
+ */
+ public void unread(byte[] b) throws IOException {
+ int length = b.length;
+ if (length > pos)
+ throw new IOException();
+ position -= length;
+ pos -= length;
+ System.arraycopy(b, 0, buf, pos, length);
}
}
-}
-}
-static class LEDataInputStream extends InputStream {
- int position;
- InputStream in;
+ public static abstract class FileFormat {
+ LEDataInputStream inputStream;
+ ImageLoader loader;
+ int compression;
- /**
- * The byte array containing the bytes to read.
- */
- protected byte[] buf;
-
- /**
- * The current position within the byte array <code>buf</code>. A value
- * equal to buf.length indicates no bytes available. A value of
- * 0 indicates the buffer is full.
- */
- protected int pos;
-
-
- public LEDataInputStream(InputStream input) {
- this(input, 512);
- }
-
- public LEDataInputStream(InputStream input, int bufferSize) {
- this.in = input;
- if (bufferSize > 0) {
- buf = new byte[bufferSize];
- pos = bufferSize;
- }
- else throw new IllegalArgumentException();
- }
-
- public void close() throws IOException {
- buf = null;
- if (in != null) {
- in.close();
- in = null;
- }
- }
-
- /**
- * Answer how many bytes were read.
- */
- public int getPosition() {
- return position;
- }
-
- /**
- * Answers how many bytes are available for reading without blocking
- */
- public int available() throws IOException {
- if (buf == null) throw new IOException();
- return (buf.length - pos) + in.available();
- }
-
- /**
- * Answer the next byte of the input stream.
- */
- public int read() throws IOException {
- if (buf == null) throw new IOException();
- position++;
- if (pos < buf.length) return (buf[pos++] & 0xFF);
- return in.read();
- }
-
- /**
- * Don't imitate the JDK behaviour of reading a random number
- * of bytes when you can actually read them all.
- */
- public int read(byte b[], int off, int len) throws IOException {
- int result;
- int left = len;
- result = readData(b, off, len);
- while (true) {
- if (result == -1) return -1;
- position += result;
- if (result == left) return len;
- left -= result;
- off += result;
- result = readData(b, off, left);
- }
- }
-
- /**
- * Reads at most <code>length</code> bytes from this LEDataInputStream and
- * stores them in byte array <code>buffer</code> starting at <code>offset</code>.
- * <p>
- * Answer the number of bytes actually read or -1 if no bytes were read and
- * end of stream was encountered. This implementation reads bytes from
- * the pushback buffer first, then the target stream if more bytes are required
- * to satisfy <code>count</code>.
- * </p>
- * @param buffer the byte array in which to store the read bytes.
- * @param offset the offset in <code>buffer</code> to store the read bytes.
- * @param length the maximum number of bytes to store in <code>buffer</code>.
- *
- * @return int the number of bytes actually read or -1 if end of stream.
- *
- * @exception java.io.IOException if an IOException occurs.
- */
- private int readData(byte[] buffer, int offset, int length) throws IOException {
- if (buf == null) throw new IOException();
- if (offset < 0 || offset > buffer.length ||
- length < 0 || (length > buffer.length - offset)) {
- throw new ArrayIndexOutOfBoundsException();
- }
-
- int cacheCopied = 0;
- int newOffset = offset;
-
- // Are there pushback bytes available?
- int available = buf.length - pos;
- if (available > 0) {
- cacheCopied = (available >= length) ? length : available;
- System.arraycopy(buf, pos, buffer, newOffset, cacheCopied);
- newOffset += cacheCopied;
- pos += cacheCopied;
- }
-
- // Have we copied enough?
- if (cacheCopied == length) return length;
-
- int inCopied = in.read(buffer, newOffset, length - cacheCopied);
-
- if (inCopied > 0) return inCopied + cacheCopied;
- if (cacheCopied == 0) return inCopied;
- return cacheCopied;
- }
-
- /**
- * Answer an integer comprised of the next
- * four bytes of the input stream.
- */
- public int readInt() throws IOException {
- byte[] buf = new byte[4];
- read(buf);
- return ((((((buf[3] & 0xFF) << 8) |
- (buf[2] & 0xFF)) << 8) |
- (buf[1] & 0xFF)) << 8) |
- (buf[0] & 0xFF);
- }
-
- /**
- * Answer a short comprised of the next
- * two bytes of the input stream.
- */
- public short readShort() throws IOException {
- byte[] buf = new byte[2];
- read(buf);
- return (short)(((buf[1] & 0xFF) << 8) | (buf[0] & 0xFF));
- }
-
- /**
- * Push back the entire content of the given buffer <code>b</code>.
- * <p>
- * The bytes are pushed so that they would be read back b[0], b[1], etc.
- * If the push back buffer cannot handle the bytes copied from <code>b</code>,
- * an IOException will be thrown and no byte will be pushed back.
- * </p>
- *
- * @param b the byte array containing bytes to push back into the stream
- *
- * @exception java.io.IOException if the pushback buffer is too small
- */
- public void unread(byte[] b) throws IOException {
- int length = b.length;
- if (length > pos) throw new IOException();
- position -= length;
- pos -= length;
- System.arraycopy(b, 0, buf, pos, length);
- }
-}
-public static abstract class FileFormat {
- LEDataInputStream inputStream;
- ImageLoader loader;
- int compression;
+ byte[] bitInvertData(byte[] data, int startIndex, int endIndex) {
+ // Destructively bit invert data in the given byte array.
+ for (int i = startIndex; i < endIndex; i++) {
+ data[i] = (byte) (255 - data[i - startIndex]);
+ }
+ return data;
+ }
-byte[] bitInvertData(byte[] data, int startIndex, int endIndex) {
- // Destructively bit invert data in the given byte array.
- for (int i = startIndex; i < endIndex; i++) {
- data[i] = (byte)(255 - data[i - startIndex]);
- }
- return data;
-}
+ /**
+ * Return whether or not the specified input stream
+ * represents a supported file format.
+ */
+ abstract boolean isFileFormat(LEDataInputStream stream);
-/**
- * Return whether or not the specified input stream
- * represents a supported file format.
- */
-abstract boolean isFileFormat(LEDataInputStream stream);
+ abstract ImageData[] loadFromByteStream();
-abstract ImageData[] loadFromByteStream();
+ public ImageData[] loadFromStream(LEDataInputStream stream) {
+ try {
+ inputStream = stream;
+ return loadFromByteStream();
+ } catch (Exception e) {
+ SWT.error(SWT.ERROR_IO, e);
+ return null;
+ }
+ }
-public ImageData[] loadFromStream(LEDataInputStream stream) {
- try {
- inputStream = stream;
- return loadFromByteStream();
- } catch (Exception e) {
- SWT.error(SWT.ERROR_IO, e);
- return null;
+ public static ImageData[] load(InputStream is, ImageLoader loader) {
+ LEDataInputStream stream = new LEDataInputStream(is);
+ boolean isSupported = false;
+ FileFormat fileFormat = new WinICOFileFormat();
+ if (fileFormat.isFileFormat(stream))
+ isSupported = true;
+ else {
+ fileFormat = new WinBMPFileFormat();
+ if (fileFormat.isFileFormat(stream))
+ isSupported = true;
+ }
+ if (!isSupported)
+ SWT.error(SWT.ERROR_UNSUPPORTED_FORMAT);
+ fileFormat.loader = loader;
+ return fileFormat.loadFromStream(stream);
+ }
}
-}
-public static ImageData[] load(InputStream is, ImageLoader loader) {
- LEDataInputStream stream = new LEDataInputStream(is);
- boolean isSupported = false;
- FileFormat fileFormat = new WinICOFileFormat();
- if (fileFormat.isFileFormat(stream)) isSupported = true;
- else {
- fileFormat = new WinBMPFileFormat();
- if (fileFormat.isFileFormat(stream)) isSupported = true;
- }
- if (!isSupported) SWT.error(SWT.ERROR_UNSUPPORTED_FORMAT);
- fileFormat.loader = loader;
- return fileFormat.loadFromStream(stream);
-}
-}
-static class WinBMPFileFormat extends FileFormat {
- static final int BMPFileHeaderSize = 14;
- static final int BMPHeaderFixedSize = 40;
- int importantColors;
+ static class WinBMPFileFormat extends FileFormat {
+ static final int BMPFileHeaderSize = 14;
+ static final int BMPHeaderFixedSize = 40;
+ int importantColors;
-void decompressData(byte[] src, byte[] dest, int stride, int cmp) {
- if (cmp == 1) { // BMP_RLE8_COMPRESSION
- if (decompressRLE8Data(src, src.length, stride, dest, dest.length) <= 0)
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- return;
- }
- if (cmp == 2) { // BMP_RLE4_COMPRESSION
- if (decompressRLE4Data(src, src.length, stride, dest, dest.length) <= 0)
+ void decompressData(byte[] src, byte[] dest, int stride, int cmp) {
+ if (cmp == 1) { // BMP_RLE8_COMPRESSION
+ if (decompressRLE8Data(src, src.length, stride, dest, dest.length) <= 0)
+ SWT.error(SWT.ERROR_INVALID_IMAGE);
+ return;
+ }
+ if (cmp == 2) { // BMP_RLE4_COMPRESSION
+ if (decompressRLE4Data(src, src.length, stride, dest, dest.length) <= 0)
+ SWT.error(SWT.ERROR_INVALID_IMAGE);
+ return;
+ }
SWT.error(SWT.ERROR_INVALID_IMAGE);
- return;
- }
- SWT.error(SWT.ERROR_INVALID_IMAGE);
-}
-int decompressRLE4Data(byte[] src, int numBytes, int stride, byte[] dest, int destSize) {
- int sp = 0;
- int se = numBytes;
- int dp = 0;
- int de = destSize;
- int x = 0, y = 0;
- while (sp < se) {
- int len = src[sp] & 0xFF;
- sp++;
- if (len == 0) {
- len = src[sp] & 0xFF;
- sp++;
- switch (len) {
- case 0: /* end of line */
- y++;
- x = 0;
- dp = y * stride;
- if (dp >= de)
- return -1;
- break;
- case 1: /* end of bitmap */
- return 1;
- case 2: /* delta */
- x += src[sp] & 0xFF;
- sp++;
- y += src[sp] & 0xFF;
+ }
+
+ int decompressRLE4Data(byte[] src, int numBytes, int stride, byte[] dest, int destSize) {
+ int sp = 0;
+ int se = numBytes;
+ int dp = 0;
+ int de = destSize;
+ int x = 0, y = 0;
+ while (sp < se) {
+ int len = src[sp] & 0xFF;
+ sp++;
+ if (len == 0) {
+ len = src[sp] & 0xFF;
sp++;
- dp = y * stride + x / 2;
- if (dp >= de)
- return -1;
- break;
- default: /* absolute mode run */
- if ((len & 1) != 0) /* odd run lengths not currently supported */
+ switch (len) {
+ case 0 : /* end of line */
+ y++;
+ x = 0;
+ dp = y * stride;
+ if (dp >= de)
+ return -1;
+ break;
+ case 1 : /* end of bitmap */
+ return 1;
+ case 2 : /* delta */
+ x += src[sp] & 0xFF;
+ sp++;
+ y += src[sp] & 0xFF;
+ sp++;
+ dp = y * stride + x / 2;
+ if (dp >= de)
+ return -1;
+ break;
+ default : /* absolute mode run */
+ if ((len & 1) != 0) /* odd run lengths not currently supported */
+ return -1;
+ x += len;
+ len = len / 2;
+ if (len > (se - sp))
+ return -1;
+ if (len > (de - dp))
+ return -1;
+ for (int i = 0; i < len; i++) {
+ dest[dp] = src[sp];
+ dp++;
+ sp++;
+ }
+ if ((sp & 1) != 0)
+ sp++; /* word align sp? */
+ break;
+ }
+ } else {
+ if ((len & 1) != 0)
return -1;
x += len;
len = len / 2;
- if (len > (se - sp))
- return -1;
+ byte theByte = src[sp];
+ sp++;
if (len > (de - dp))
return -1;
for (int i = 0; i < len; i++) {
- dest[dp] = src[sp];
+ dest[dp] = theByte;
dp++;
- sp++;
}
- if ((sp & 1) != 0)
- sp++; /* word align sp? */
- break;
- }
- } else {
- if ((len & 1) != 0)
- return -1;
- x += len;
- len = len / 2;
- byte theByte = src[sp];
- sp++;
- if (len > (de - dp))
- return -1;
- for (int i = 0; i < len; i++) {
- dest[dp] = theByte;
- dp++;
+ }
}
+ return 1;
}
- }
- return 1;
-}
-int decompressRLE8Data(byte[] src, int numBytes, int stride, byte[] dest, int destSize) {
- int sp = 0;
- int se = numBytes;
- int dp = 0;
- int de = destSize;
- int x = 0, y = 0;
- while (sp < se) {
- int len = src[sp] & 0xFF;
- sp++;
- if (len == 0) {
- len = src[sp] & 0xFF;
- sp++;
- switch (len) {
- case 0: /* end of line */
- y++;
- x = 0;
- dp = y * stride;
- if (dp >= de)
- return -1;
- break;
- case 1: /* end of bitmap */
- return 1;
- case 2: /* delta */
- x += src[sp] & 0xFF;
+
+ int decompressRLE8Data(byte[] src, int numBytes, int stride, byte[] dest, int destSize) {
+ int sp = 0;
+ int se = numBytes;
+ int dp = 0;
+ int de = destSize;
+ int x = 0, y = 0;
+ while (sp < se) {
+ int len = src[sp] & 0xFF;
+ sp++;
+ if (len == 0) {
+ len = src[sp] & 0xFF;
sp++;
- y += src[sp] & 0xFF;
+ switch (len) {
+ case 0 : /* end of line */
+ y++;
+ x = 0;
+ dp = y * stride;
+ if (dp >= de)
+ return -1;
+ break;
+ case 1 : /* end of bitmap */
+ return 1;
+ case 2 : /* delta */
+ x += src[sp] & 0xFF;
+ sp++;
+ y += src[sp] & 0xFF;
+ sp++;
+ dp = y * stride + x;
+ if (dp >= de)
+ return -1;
+ break;
+ default : /* absolute mode run */
+ if (len > (se - sp))
+ return -1;
+ if (len > (de - dp))
+ return -1;
+ for (int i = 0; i < len; i++) {
+ dest[dp] = src[sp];
+ dp++;
+ sp++;
+ }
+ if ((sp & 1) != 0)
+ sp++; /* word align sp? */
+ x += len;
+ break;
+ }
+ } else {
+ byte theByte = src[sp];
sp++;
- dp = y * stride + x;
- if (dp >= de)
- return -1;
- break;
- default: /* absolute mode run */
- if (len > (se - sp))
- return -1;
if (len > (de - dp))
return -1;
for (int i = 0; i < len; i++) {
- dest[dp] = src[sp];
+ dest[dp] = theByte;
dp++;
- sp++;
}
- if ((sp & 1) != 0)
- sp++; /* word align sp? */
x += len;
- break;
+ }
}
- } else {
- byte theByte = src[sp];
- sp++;
- if (len > (de - dp))
- return -1;
- for (int i = 0; i < len; i++) {
- dest[dp] = theByte;
- dp++;
+ return 1;
+ }
+
+ boolean isFileFormat(LEDataInputStream stream) {
+ try {
+ byte[] header = new byte[18];
+ stream.read(header);
+ stream.unread(header);
+ int infoHeaderSize = (header[14] & 0xFF) | ((header[15] & 0xFF) << 8) | ((header[16] & 0xFF) << 16) | ((header[17] & 0xFF) << 24);
+ return header[0] == 0x42 && header[1] == 0x4D && infoHeaderSize >= BMPHeaderFixedSize;
+ } catch (Exception e) {
+ return false;
}
- x += len;
}
- }
- return 1;
-}
-boolean isFileFormat(LEDataInputStream stream) {
- try {
- byte[] header = new byte[18];
- stream.read(header);
- stream.unread(header);
- int infoHeaderSize = (header[14] & 0xFF) | ((header[15] & 0xFF) << 8) | ((header[16] & 0xFF) << 16) | ((header[17] & 0xFF) << 24);
- return header[0] == 0x42 && header[1] == 0x4D && infoHeaderSize >= BMPHeaderFixedSize;
- } catch (Exception e) {
- return false;
- }
-}
-byte[] loadData(byte[] infoHeader) {
- int width = (infoHeader[4] & 0xFF) | ((infoHeader[5] & 0xFF) << 8) | ((infoHeader[6] & 0xFF) << 16) | ((infoHeader[7] & 0xFF) << 24);
- int height = (infoHeader[8] & 0xFF) | ((infoHeader[9] & 0xFF) << 8) | ((infoHeader[10] & 0xFF) << 16) | ((infoHeader[11] & 0xFF) << 24);
- int bitCount = (infoHeader[14] & 0xFF) | ((infoHeader[15] & 0xFF) << 8);
- int stride = (width * bitCount + 7) / 8;
- stride = (stride + 3) / 4 * 4; // Round up to 4 byte multiple
- byte[] data = loadData(infoHeader, stride);
- flipScanLines(data, stride, height);
- return data;
-}
-byte[] loadData(byte[] infoHeader, int stride) {
- int height = (infoHeader[8] & 0xFF) | ((infoHeader[9] & 0xFF) << 8) | ((infoHeader[10] & 0xFF) << 16) | ((infoHeader[11] & 0xFF) << 24);
- int dataSize = height * stride;
- byte[] data = new byte[dataSize];
- int cmp = (infoHeader[16] & 0xFF) | ((infoHeader[17] & 0xFF) << 8) | ((infoHeader[18] & 0xFF) << 16) | ((infoHeader[19] & 0xFF) << 24);
- if (cmp == 0) { // BMP_NO_COMPRESSION
- try {
- if (inputStream.read(data) != dataSize)
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
+
+ byte[] loadData(byte[] infoHeader) {
+ int width = (infoHeader[4] & 0xFF) | ((infoHeader[5] & 0xFF) << 8) | ((infoHeader[6] & 0xFF) << 16) | ((infoHeader[7] & 0xFF) << 24);
+ int height = (infoHeader[8] & 0xFF) | ((infoHeader[9] & 0xFF) << 8) | ((infoHeader[10] & 0xFF) << 16) | ((infoHeader[11] & 0xFF) << 24);
+ int bitCount = (infoHeader[14] & 0xFF) | ((infoHeader[15] & 0xFF) << 8);
+ int stride = (width * bitCount + 7) / 8;
+ stride = (stride + 3) / 4 * 4; // Round up to 4 byte multiple
+ byte[] data = loadData(infoHeader, stride);
+ flipScanLines(data, stride, height);
+ return data;
}
- } else {
- int compressedSize = (infoHeader[20] & 0xFF) | ((infoHeader[21] & 0xFF) << 8) | ((infoHeader[22] & 0xFF) << 16) | ((infoHeader[23] & 0xFF) << 24);
- byte[] compressed = new byte[compressedSize];
- try {
- if (inputStream.read(compressed) != compressedSize)
+
+ byte[] loadData(byte[] infoHeader, int stride) {
+ int height = (infoHeader[8] & 0xFF) | ((infoHeader[9] & 0xFF) << 8) | ((infoHeader[10] & 0xFF) << 16) | ((infoHeader[11] & 0xFF) << 24);
+ int dataSize = height * stride;
+ byte[] data = new byte[dataSize];
+ int cmp = (infoHeader[16] & 0xFF) | ((infoHeader[17] & 0xFF) << 8) | ((infoHeader[18] & 0xFF) << 16) | ((infoHeader[19] & 0xFF) << 24);
+ if (cmp == 0) { // BMP_NO_COMPRESSION
+ try {
+ if (inputStream.read(data) != dataSize)
+ SWT.error(SWT.ERROR_INVALID_IMAGE);
+ } catch (IOException e) {
+ SWT.error(SWT.ERROR_IO, e);
+ }
+ } else {
+ int compressedSize = (infoHeader[20] & 0xFF) | ((infoHeader[21] & 0xFF) << 8) | ((infoHeader[22] & 0xFF) << 16) | ((infoHeader[23] & 0xFF) << 24);
+ byte[] compressed = new byte[compressedSize];
+ try {
+ if (inputStream.read(compressed) != compressedSize)
+ SWT.error(SWT.ERROR_INVALID_IMAGE);
+ } catch (IOException e) {
+ SWT.error(SWT.ERROR_IO, e);
+ }
+ decompressData(compressed, data, stride, cmp);
+ }
+ return data;
+ }
+
+ int[] loadFileHeader() {
+ int[] header = new int[5];
+ try {
+ header[0] = inputStream.readShort();
+ header[1] = inputStream.readInt();
+ header[2] = inputStream.readShort();
+ header[3] = inputStream.readShort();
+ header[4] = inputStream.readInt();
+ } catch (IOException e) {
+ SWT.error(SWT.ERROR_IO, e);
+ }
+ if (header[0] != 0x4D42)
SWT.error(SWT.ERROR_INVALID_IMAGE);
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
+ return header;
}
- decompressData(compressed, data, stride, cmp);
- }
- return data;
-}
-int[] loadFileHeader() {
- int[] header = new int[5];
- try {
- header[0] = inputStream.readShort();
- header[1] = inputStream.readInt();
- header[2] = inputStream.readShort();
- header[3] = inputStream.readShort();
- header[4] = inputStream.readInt();
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- if (header[0] != 0x4D42)
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- return header;
-}
-ImageData[] loadFromByteStream() {
- int[] fileHeader = loadFileHeader();
- byte[] infoHeader = new byte[BMPHeaderFixedSize];
- try {
- inputStream.read(infoHeader);
- } catch (Exception e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- int width = (infoHeader[4] & 0xFF) | ((infoHeader[5] & 0xFF) << 8) | ((infoHeader[6] & 0xFF) << 16) | ((infoHeader[7] & 0xFF) << 24);
- int height = (infoHeader[8] & 0xFF) | ((infoHeader[9] & 0xFF) << 8) | ((infoHeader[10] & 0xFF) << 16) | ((infoHeader[11] & 0xFF) << 24);
- int bitCount = (infoHeader[14] & 0xFF) | ((infoHeader[15] & 0xFF) << 8);
- PaletteData palette = loadPalette(infoHeader);
- if (inputStream.getPosition() < fileHeader[4]) {
- // Seek to the specified offset
- try {
- inputStream.skip(fileHeader[4] - inputStream.getPosition());
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
+
+ ImageData[] loadFromByteStream() {
+ int[] fileHeader = loadFileHeader();
+ byte[] infoHeader = new byte[BMPHeaderFixedSize];
+ try {
+ inputStream.read(infoHeader);
+ } catch (Exception e) {
+ SWT.error(SWT.ERROR_IO, e);
+ }
+ int width = (infoHeader[4] & 0xFF) | ((infoHeader[5] & 0xFF) << 8) | ((infoHeader[6] & 0xFF) << 16) | ((infoHeader[7] & 0xFF) << 24);
+ int height = (infoHeader[8] & 0xFF) | ((infoHeader[9] & 0xFF) << 8) | ((infoHeader[10] & 0xFF) << 16) | ((infoHeader[11] & 0xFF) << 24);
+ int bitCount = (infoHeader[14] & 0xFF) | ((infoHeader[15] & 0xFF) << 8);
+ PaletteData palette = loadPalette(infoHeader);
+ if (inputStream.getPosition() < fileHeader[4]) {
+ // Seek to the specified offset
+ try {
+ inputStream.skip(fileHeader[4] - inputStream.getPosition());
+ } catch (IOException e) {
+ SWT.error(SWT.ERROR_IO, e);
+ }
+ }
+ byte[] data = loadData(infoHeader);
+ this.compression = (infoHeader[16] & 0xFF) | ((infoHeader[17] & 0xFF) << 8) | ((infoHeader[18] & 0xFF) << 16) | ((infoHeader[19] & 0xFF) << 24);
+ this.importantColors = (infoHeader[36] & 0xFF) | ((infoHeader[37] & 0xFF) << 8) | ((infoHeader[38] & 0xFF) << 16) | ((infoHeader[39] & 0xFF) << 24);
+ // int xPelsPerMeter = (infoHeader[24] & 0xFF) | ((infoHeader[25] & 0xFF) << 8) | ((infoHeader[26] & 0xFF) << 16) | ((infoHeader[27] & 0xFF) << 24);
+ // int yPelsPerMeter = (infoHeader[28] & 0xFF) | ((infoHeader[29] & 0xFF) << 8) | ((infoHeader[30] & 0xFF) << 16) | ((infoHeader[31] & 0xFF) << 24);
+ int type = (this.compression == 1 /*BMP_RLE8_COMPRESSION*/) || (this.compression == 2 /*BMP_RLE4_COMPRESSION*/) ? SWT.IMAGE_BMP_RLE : SWT.IMAGE_BMP;
+ return new ImageData[] {ImageData.internal_new(width, height, bitCount, palette, 4, data, 0, null, null, -1, -1, type, 0, 0, 0, 0)};
}
+
+ PaletteData loadPalette(byte[] infoHeader) {
+ int depth = (infoHeader[14] & 0xFF) | ((infoHeader[15] & 0xFF) << 8);
+ if (depth <= 8) {
+ int numColors = (infoHeader[32] & 0xFF) | ((infoHeader[33] & 0xFF) << 8) | ((infoHeader[34] & 0xFF) << 16) | ((infoHeader[35] & 0xFF) << 24);
+ if (numColors == 0) {
+ numColors = 1 << depth;
+ } else {
+ if (numColors > 256)
+ numColors = 256;
+ }
+ byte[] buf = new byte[numColors * 4];
+ try {
+ if (inputStream.read(buf) != buf.length)
+ SWT.error(SWT.ERROR_INVALID_IMAGE);
+ } catch (IOException e) {
+ SWT.error(SWT.ERROR_IO, e);
+ }
+ return paletteFromBytes(buf, numColors);
+ }
+ if (depth == 16)
+ return new PaletteData(0x7C00, 0x3E0, 0x1F);
+ if (depth == 24)
+ return new PaletteData(0xFF, 0xFF00, 0xFF0000);
+ return new PaletteData(0xFF00, 0xFF0000, 0xFF000000);
+ }
+
+ PaletteData paletteFromBytes(byte[] bytes, int numColors) {
+ int bytesOffset = 0;
+ RGB[] colors = new RGB[numColors];
+ for (int i = 0; i < numColors; i++) {
+ colors[i] = new RGB(bytes[bytesOffset + 2] & 0xFF, bytes[bytesOffset + 1] & 0xFF, bytes[bytesOffset] & 0xFF);
+ bytesOffset += 4;
+ }
+ return new PaletteData(colors);
+ }
+
+ /**
+ * Answer a byte array containing the BMP representation of
+ * the given device independent palette.
+ */
+ static byte[] paletteToBytes(PaletteData pal) {
+ int n = pal.colors == null ? 0 : (pal.colors.length < 256 ? pal.colors.length : 256);
+ byte[] bytes = new byte[n * 4];
+ int offset = 0;
+ for (int i = 0; i < n; i++) {
+ RGB col = pal.colors[i];
+ bytes[offset] = (byte) col.blue;
+ bytes[offset + 1] = (byte) col.green;
+ bytes[offset + 2] = (byte) col.red;
+ offset += 4;
+ }
+ return bytes;
+ }
+
+ void flipScanLines(byte[] data, int stride, int height) {
+ int i1 = 0;
+ int i2 = (height - 1) * stride;
+ for (int i = 0; i < height / 2; i++) {
+ for (int index = 0; index < stride; index++) {
+ byte b = data[index + i1];
+ data[index + i1] = data[index + i2];
+ data[index + i2] = b;
+ }
+ i1 += stride;
+ i2 -= stride;
+ }
+ }
+
}
- byte[] data = loadData(infoHeader);
- this.compression = (infoHeader[16] & 0xFF) | ((infoHeader[17] & 0xFF) << 8) | ((infoHeader[18] & 0xFF) << 16) | ((infoHeader[19] & 0xFF) << 24);
- this.importantColors = (infoHeader[36] & 0xFF) | ((infoHeader[37] & 0xFF) << 8) | ((infoHeader[38] & 0xFF) << 16) | ((infoHeader[39] & 0xFF) << 24);
-// int xPelsPerMeter = (infoHeader[24] & 0xFF) | ((infoHeader[25] & 0xFF) << 8) | ((infoHeader[26] & 0xFF) << 16) | ((infoHeader[27] & 0xFF) << 24);
-// int yPelsPerMeter = (infoHeader[28] & 0xFF) | ((infoHeader[29] & 0xFF) << 8) | ((infoHeader[30] & 0xFF) << 16) | ((infoHeader[31] & 0xFF) << 24);
- int type = (this.compression == 1 /*BMP_RLE8_COMPRESSION*/) || (this.compression == 2 /*BMP_RLE4_COMPRESSION*/) ? SWT.IMAGE_BMP_RLE : SWT.IMAGE_BMP;
- return new ImageData[] {
- ImageData.internal_new(
- width,
- height,
- bitCount,
- palette,
- 4,
- data,
- 0,
- null,
- null,
- -1,
- -1,
- type,
- 0,
- 0,
- 0,
- 0)
- };
-}
-PaletteData loadPalette(byte[] infoHeader) {
- int depth = (infoHeader[14] & 0xFF) | ((infoHeader[15] & 0xFF) << 8);
- if (depth <= 8) {
- int numColors = (infoHeader[32] & 0xFF) | ((infoHeader[33] & 0xFF) << 8) | ((infoHeader[34] & 0xFF) << 16) | ((infoHeader[35] & 0xFF) << 24);
- if (numColors == 0) {
- numColors = 1 << depth;
- } else {
- if (numColors > 256)
- numColors = 256;
+
+ static class WinICOFileFormat extends FileFormat {
+
+ static final byte[] convertPad(byte[] data, int width, int height, int depth, int pad, int newPad) {
+ if (pad == newPad)
+ return data;
+ int stride = (width * depth + 7) / 8;
+ int bpl = (stride + (pad - 1)) / pad * pad;
+ int newBpl = (stride + (newPad - 1)) / newPad * newPad;
+ byte[] newData = new byte[height * newBpl];
+ int srcIndex = 0, destIndex = 0;
+ for (int y = 0; y < height; y++) {
+ System.arraycopy(data, srcIndex, newData, destIndex, newBpl);
+ srcIndex += bpl;
+ destIndex += newBpl;
+ }
+ return newData;
}
- byte[] buf = new byte[numColors * 4];
- try {
- if (inputStream.read(buf) != buf.length)
+
+ /**
+ * Answer the size in bytes of the file representation of the given
+ * icon
+ */
+ int iconSize(ImageData i) {
+ int shapeDataStride = (i.width * i.depth + 31) / 32 * 4;
+ int maskDataStride = (i.width + 31) / 32 * 4;
+ int dataSize = (shapeDataStride + maskDataStride) * i.height;
+ int paletteSize = i.palette.colors != null ? i.palette.colors.length * 4 : 0;
+ return WinBMPFileFormat.BMPHeaderFixedSize + paletteSize + dataSize;
+ }
+
+ boolean isFileFormat(LEDataInputStream stream) {
+ try {
+ byte[] header = new byte[4];
+ stream.read(header);
+ stream.unread(header);
+ return header[0] == 0 && header[1] == 0 && header[2] == 1 && header[3] == 0;
+ } catch (Exception e) {
+ return false;
+ }
+ }
+
+ boolean isValidIcon(ImageData i) {
+ switch (i.depth) {
+ case 1 :
+ case 4 :
+ case 8 :
+ if (i.palette.isDirect)
+ return false;
+ int size = i.palette.colors.length;
+ return size == 2 || size == 16 || size == 32 || size == 256;
+ case 24 :
+ case 32 :
+ return i.palette.isDirect;
+ }
+ return false;
+ }
+
+ int loadFileHeader(LEDataInputStream byteStream) {
+ int[] fileHeader = new int[3];
+ try {
+ fileHeader[0] = byteStream.readShort();
+ fileHeader[1] = byteStream.readShort();
+ fileHeader[2] = byteStream.readShort();
+ } catch (IOException e) {
+ SWT.error(SWT.ERROR_IO, e);
+ }
+ if ((fileHeader[0] != 0) || (fileHeader[1] != 1))
SWT.error(SWT.ERROR_INVALID_IMAGE);
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
+ int numIcons = fileHeader[2];
+ if (numIcons <= 0)
+ SWT.error(SWT.ERROR_INVALID_IMAGE);
+ return numIcons;
}
- return paletteFromBytes(buf, numColors);
- }
- if (depth == 16) return new PaletteData(0x7C00, 0x3E0, 0x1F);
- if (depth == 24) return new PaletteData(0xFF, 0xFF00, 0xFF0000);
- return new PaletteData(0xFF00, 0xFF0000, 0xFF000000);
-}
-PaletteData paletteFromBytes(byte[] bytes, int numColors) {
- int bytesOffset = 0;
- RGB[] colors = new RGB[numColors];
- for (int i = 0; i < numColors; i++) {
- colors[i] = new RGB(bytes[bytesOffset + 2] & 0xFF,
- bytes[bytesOffset + 1] & 0xFF,
- bytes[bytesOffset] & 0xFF);
- bytesOffset += 4;
- }
- return new PaletteData(colors);
-}
-/**
- * Answer a byte array containing the BMP representation of
- * the given device independent palette.
- */
-static byte[] paletteToBytes(PaletteData pal) {
- int n = pal.colors == null ? 0 : (pal.colors.length < 256 ? pal.colors.length : 256);
- byte[] bytes = new byte[n * 4];
- int offset = 0;
- for (int i = 0; i < n; i++) {
- RGB col = pal.colors[i];
- bytes[offset] = (byte)col.blue;
- bytes[offset + 1] = (byte)col.green;
- bytes[offset + 2] = (byte)col.red;
- offset += 4;
- }
- return bytes;
-}
-void flipScanLines(byte[] data, int stride, int height) {
- int i1 = 0;
- int i2 = (height - 1) * stride;
- for (int i = 0; i < height / 2; i++) {
- for (int index = 0; index < stride; index++) {
- byte b = data[index + i1];
- data[index + i1] = data[index + i2];
- data[index + i2] = b;
+ int loadFileHeader(LEDataInputStream byteStream, boolean hasHeader) {
+ int[] fileHeader = new int[3];
+ try {
+ if (hasHeader) {
+ fileHeader[0] = byteStream.readShort();
+ fileHeader[1] = byteStream.readShort();
+ } else {
+ fileHeader[0] = 0;
+ fileHeader[1] = 1;
+ }
+ fileHeader[2] = byteStream.readShort();
+ } catch (IOException e) {
+ SWT.error(SWT.ERROR_IO, e);
+ }
+ if ((fileHeader[0] != 0) || (fileHeader[1] != 1))
+ SWT.error(SWT.ERROR_INVALID_IMAGE);
+ int numIcons = fileHeader[2];
+ if (numIcons <= 0)
+ SWT.error(SWT.ERROR_INVALID_IMAGE);
+ return numIcons;
}
- i1 += stride;
- i2 -= stride;
- }
-}
-}
+ ImageData[] loadFromByteStream() {
+ int numIcons = loadFileHeader(inputStream);
+ int[][] headers = loadIconHeaders(numIcons);
+ ImageData[] icons = new ImageData[headers.length];
+ for (int i = 0; i < icons.length; i++) {
+ icons[i] = loadIcon(headers[i]);
+ }
+ return icons;
+ }
-static class WinICOFileFormat extends FileFormat {
-
-static final byte[] convertPad(byte[] data, int width, int height, int depth, int pad, int newPad) {
- if (pad == newPad) return data;
- int stride = (width * depth + 7) / 8;
- int bpl = (stride + (pad - 1)) / pad * pad;
- int newBpl = (stride + (newPad - 1)) / newPad * newPad;
- byte[] newData = new byte[height * newBpl];
- int srcIndex = 0, destIndex = 0;
- for (int y = 0; y < height; y++) {
- System.arraycopy(data, srcIndex, newData, destIndex, newBpl);
- srcIndex += bpl;
- destIndex += newBpl;
- }
- return newData;
-}
-/**
- * Answer the size in bytes of the file representation of the given
- * icon
- */
-int iconSize(ImageData i) {
- int shapeDataStride = (i.width * i.depth + 31) / 32 * 4;
- int maskDataStride = (i.width + 31) / 32 * 4;
- int dataSize = (shapeDataStride + maskDataStride) * i.height;
- int paletteSize = i.palette.colors != null ? i.palette.colors.length * 4 : 0;
- return WinBMPFileFormat.BMPHeaderFixedSize + paletteSize + dataSize;
-}
-boolean isFileFormat(LEDataInputStream stream) {
- try {
- byte[] header = new byte[4];
- stream.read(header);
- stream.unread(header);
- return header[0] == 0 && header[1] == 0 && header[2] == 1 && header[3] == 0;
- } catch (Exception e) {
- return false;
- }
-}
-boolean isValidIcon(ImageData i) {
- switch (i.depth) {
- case 1:
- case 4:
- case 8:
- if (i.palette.isDirect) return false;
- int size = i.palette.colors.length;
- return size == 2 || size == 16 || size == 32 || size == 256;
- case 24:
- case 32:
- return i.palette.isDirect;
- }
- return false;
-}
-int loadFileHeader(LEDataInputStream byteStream) {
- int[] fileHeader = new int[3];
- try {
- fileHeader[0] = byteStream.readShort();
- fileHeader[1] = byteStream.readShort();
- fileHeader[2] = byteStream.readShort();
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- if ((fileHeader[0] != 0) || (fileHeader[1] != 1))
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- int numIcons = fileHeader[2];
- if (numIcons <= 0)
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- return numIcons;
-}
-int loadFileHeader(LEDataInputStream byteStream, boolean hasHeader) {
- int[] fileHeader = new int[3];
- try {
- if (hasHeader) {
- fileHeader[0] = byteStream.readShort();
- fileHeader[1] = byteStream.readShort();
- } else {
- fileHeader[0] = 0;
- fileHeader[1] = 1;
- }
- fileHeader[2] = byteStream.readShort();
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- if ((fileHeader[0] != 0) || (fileHeader[1] != 1))
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- int numIcons = fileHeader[2];
- if (numIcons <= 0)
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- return numIcons;
-}
-ImageData[] loadFromByteStream() {
- int numIcons = loadFileHeader(inputStream);
- int[][] headers = loadIconHeaders(numIcons);
- ImageData[] icons = new ImageData[headers.length];
- for (int i = 0; i < icons.length; i++) {
- icons[i] = loadIcon(headers[i]);
- }
- return icons;
-}
-/**
- * Load one icon from the byte stream.
- */
-ImageData loadIcon(int[] iconHeader) {
- byte[] infoHeader = loadInfoHeader(iconHeader);
- WinBMPFileFormat bmpFormat = new WinBMPFileFormat();
- bmpFormat.inputStream = inputStream;
- PaletteData palette = bmpFormat.loadPalette(infoHeader);
- byte[] shapeData = bmpFormat.loadData(infoHeader);
- int width = (infoHeader[4] & 0xFF) | ((infoHeader[5] & 0xFF) << 8) | ((infoHeader[6] & 0xFF) << 16) | ((infoHeader[7] & 0xFF) << 24);
- int height = (infoHeader[8] & 0xFF) | ((infoHeader[9] & 0xFF) << 8) | ((infoHeader[10] & 0xFF) << 16) | ((infoHeader[11] & 0xFF) << 24);
- int depth = (infoHeader[14] & 0xFF) | ((infoHeader[15] & 0xFF) << 8);
- infoHeader[14] = 1;
- infoHeader[15] = 0;
- byte[] maskData = bmpFormat.loadData(infoHeader);
- maskData = convertPad(maskData, width, height, 1, 4, 2);
- bitInvertData(maskData, 0, maskData.length);
- return ImageData.internal_new(
- width,
- height,
- depth,
- palette,
- 4,
- shapeData,
- 2,
- maskData,
- null,
- -1,
- -1,
- SWT.IMAGE_ICO,
- 0,
- 0,
- 0,
- 0);
-}
-int[][] loadIconHeaders(int numIcons) {
- int[][] headers = new int[numIcons][7];
- try {
- for (int i = 0; i < numIcons; i++) {
- headers[i][0] = inputStream.read();
- headers[i][1] = inputStream.read();
- headers[i][2] = inputStream.readShort();
- headers[i][3] = inputStream.readShort();
- headers[i][4] = inputStream.readShort();
- headers[i][5] = inputStream.readInt();
- headers[i][6] = inputStream.readInt();
- }
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- return headers;
-}
-byte[] loadInfoHeader(int[] iconHeader) {
- int width = iconHeader[0];
- int height = iconHeader[1];
- int numColors = iconHeader[2]; // the number of colors is in the low byte, but the high byte must be 0
- if (numColors == 0) numColors = 256; // this is specified: '00' represents '256' (0x100) colors
- if ((numColors != 2) && (numColors != 8) && (numColors != 16) &&
- (numColors != 32) && (numColors != 256))
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- if (inputStream.getPosition() < iconHeader[6]) {
- // Seek to the specified offset
- try {
- inputStream.skip(iconHeader[6] - inputStream.getPosition());
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- return null;
+ /**
+ * Load one icon from the byte stream.
+ */
+ ImageData loadIcon(int[] iconHeader) {
+ byte[] infoHeader = loadInfoHeader(iconHeader);
+ WinBMPFileFormat bmpFormat = new WinBMPFileFormat();
+ bmpFormat.inputStream = inputStream;
+ PaletteData palette = bmpFormat.loadPalette(infoHeader);
+ byte[] shapeData = bmpFormat.loadData(infoHeader);
+ int width = (infoHeader[4] & 0xFF) | ((infoHeader[5] & 0xFF) << 8) | ((infoHeader[6] & 0xFF) << 16) | ((infoHeader[7] & 0xFF) << 24);
+ int height = (infoHeader[8] & 0xFF) | ((infoHeader[9] & 0xFF) << 8) | ((infoHeader[10] & 0xFF) << 16) | ((infoHeader[11] & 0xFF) << 24);
+ int depth = (infoHeader[14] & 0xFF) | ((infoHeader[15] & 0xFF) << 8);
+ infoHeader[14] = 1;
+ infoHeader[15] = 0;
+ byte[] maskData = bmpFormat.loadData(infoHeader);
+ maskData = convertPad(maskData, width, height, 1, 4, 2);
+ bitInvertData(maskData, 0, maskData.length);
+ return ImageData.internal_new(width, height, depth, palette, 4, shapeData, 2, maskData, null, -1, -1, SWT.IMAGE_ICO, 0, 0, 0, 0);
+ }
+
+ int[][] loadIconHeaders(int numIcons) {
+ int[][] headers = new int[numIcons][7];
+ try {
+ for (int i = 0; i < numIcons; i++) {
+ headers[i][0] = inputStream.read();
+ headers[i][1] = inputStream.read();
+ headers[i][2] = inputStream.readShort();
+ headers[i][3] = inputStream.readShort();
+ headers[i][4] = inputStream.readShort();
+ headers[i][5] = inputStream.readInt();
+ headers[i][6] = inputStream.readInt();
+ }
+ } catch (IOException e) {
+ SWT.error(SWT.ERROR_IO, e);
+ }
+ return headers;
+ }
+
+ byte[] loadInfoHeader(int[] iconHeader) {
+ int width = iconHeader[0];
+ int height = iconHeader[1];
+ int numColors = iconHeader[2]; // the number of colors is in the low byte, but the high byte must be 0
+ if (numColors == 0)
+ numColors = 256; // this is specified: '00' represents '256' (0x100) colors
+ if ((numColors != 2) && (numColors != 8) && (numColors != 16) && (numColors != 32) && (numColors != 256))
+ SWT.error(SWT.ERROR_INVALID_IMAGE);
+ if (inputStream.getPosition() < iconHeader[6]) {
+ // Seek to the specified offset
+ try {
+ inputStream.skip(iconHeader[6] - inputStream.getPosition());
+ } catch (IOException e) {
+ SWT.error(SWT.ERROR_IO, e);
+ return null;
+ }
+ }
+ byte[] infoHeader = new byte[WinBMPFileFormat.BMPHeaderFixedSize];
+ try {
+ inputStream.read(infoHeader);
+ } catch (IOException e) {
+ SWT.error(SWT.ERROR_IO, e);
+ }
+ if (((infoHeader[12] & 0xFF) | ((infoHeader[13] & 0xFF) << 8)) != 1)
+ SWT.error(SWT.ERROR_INVALID_IMAGE);
+ int infoWidth = (infoHeader[4] & 0xFF) | ((infoHeader[5] & 0xFF) << 8) | ((infoHeader[6] & 0xFF) << 16) | ((infoHeader[7] & 0xFF) << 24);
+ int infoHeight = (infoHeader[8] & 0xFF) | ((infoHeader[9] & 0xFF) << 8) | ((infoHeader[10] & 0xFF) << 16) | ((infoHeader[11] & 0xFF) << 24);
+ int bitCount = (infoHeader[14] & 0xFF) | ((infoHeader[15] & 0xFF) << 8);
+ if (height == infoHeight && bitCount == 1)
+ height /= 2;
+ if (!((width == infoWidth) && (height * 2 == infoHeight) && (bitCount == 1 || bitCount == 4 || bitCount == 8 || bitCount == 24 || bitCount == 32)))
+ SWT.error(SWT.ERROR_INVALID_IMAGE);
+ infoHeader[8] = (byte) (height & 0xFF);
+ infoHeader[9] = (byte) ((height >> 8) & 0xFF);
+ infoHeader[10] = (byte) ((height >> 16) & 0xFF);
+ infoHeader[11] = (byte) ((height >> 24) & 0xFF);
+ return infoHeader;
}
}
- byte[] infoHeader = new byte[WinBMPFileFormat.BMPHeaderFixedSize];
- try {
- inputStream.read(infoHeader);
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- if (((infoHeader[12] & 0xFF) | ((infoHeader[13] & 0xFF) << 8)) != 1)
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- int infoWidth = (infoHeader[4] & 0xFF) | ((infoHeader[5] & 0xFF) << 8) | ((infoHeader[6] & 0xFF) << 16) | ((infoHeader[7] & 0xFF) << 24);
- int infoHeight = (infoHeader[8] & 0xFF) | ((infoHeader[9] & 0xFF) << 8) | ((infoHeader[10] & 0xFF) << 16) | ((infoHeader[11] & 0xFF) << 24);
- int bitCount = (infoHeader[14] & 0xFF) | ((infoHeader[15] & 0xFF) << 8);
- if (height == infoHeight && bitCount == 1) height /= 2;
- if (!((width == infoWidth) && (height * 2 == infoHeight) &&
- (bitCount == 1 || bitCount == 4 || bitCount == 8 || bitCount == 24 || bitCount == 32)))
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- infoHeader[8] = (byte)(height & 0xFF);
- infoHeader[9] = (byte)((height >> 8) & 0xFF);
- infoHeader[10] = (byte)((height >> 16) & 0xFF);
- infoHeader[11] = (byte)((height >> 24) & 0xFF);
- return infoHeader;
-}
-}
-static class SWT {
- public static final int IMAGE_ICO = 3;
- public static final int ERROR_IO = 39;
- public static final int ERROR_INVALID_IMAGE = 40;
- public static final int ERROR_NULL_ARGUMENT = 4;
- public static final int ERROR_INVALID_ARGUMENT = 5;
- public static final int ERROR_CANNOT_BE_ZERO = 7;
- public static final int IMAGE_UNDEFINED = -1;
- public static final int ERROR_UNSUPPORTED_DEPTH = 38;
- public static final int TRANSPARENCY_MASK = 1 << 1;
- public static final int ERROR_UNSUPPORTED_FORMAT = 42;
- public static final int TRANSPARENCY_ALPHA = 1 << 0;
- public static final int TRANSPARENCY_NONE = 0x0;
- public static final int TRANSPARENCY_PIXEL = 1 << 2;
- public static final int IMAGE_BMP = 0;
- public static final int IMAGE_BMP_RLE = 1;
-
- public static void error(int code) {
- throw new RuntimeException("Error "+code); //$NON-NLS-1$
- }
- public static void error(int code, Throwable t) {
- throw new RuntimeException(t);
+
+ static class SWT {
+ public static final int IMAGE_ICO = 3;
+ public static final int ERROR_IO = 39;
+ public static final int ERROR_INVALID_IMAGE = 40;
+ public static final int ERROR_NULL_ARGUMENT = 4;
+ public static final int ERROR_INVALID_ARGUMENT = 5;
+ public static final int ERROR_CANNOT_BE_ZERO = 7;
+ public static final int IMAGE_UNDEFINED = -1;
+ public static final int ERROR_UNSUPPORTED_DEPTH = 38;
+ public static final int TRANSPARENCY_MASK = 1 << 1;
+ public static final int ERROR_UNSUPPORTED_FORMAT = 42;
+ public static final int TRANSPARENCY_ALPHA = 1 << 0;
+ public static final int TRANSPARENCY_NONE = 0x0;
+ public static final int TRANSPARENCY_PIXEL = 1 << 2;
+ public static final int IMAGE_BMP = 0;
+ public static final int IMAGE_BMP_RLE = 1;
+
+ public static void error(int code) {
+ throw new RuntimeException("Error " + code); //$NON-NLS-1$
+ }
+
+ public static void error(int code, Throwable t) {
+ throw new RuntimeException(t);
+ }
}
}
-}
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AbstractPublisherAction.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AbstractPublisherAction.java
index 980e85853..aea9a7a35 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AbstractPublisherAction.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AbstractPublisherAction.java
@@ -12,10 +12,10 @@ package org.eclipse.equinox.p2.publisher;
import java.io.*;
import java.util.*;
+import java.util.Map.Entry;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactDescriptor;
-import org.eclipse.equinox.internal.p2.core.helpers.FileUtils;
-import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
+import org.eclipse.equinox.internal.p2.core.helpers.*;
import org.eclipse.equinox.internal.p2.core.helpers.FileUtils.IPathComputer;
import org.eclipse.equinox.internal.p2.metadata.IRequiredCapability;
import org.eclipse.equinox.internal.p2.metadata.LDAPQuery;
@@ -48,13 +48,13 @@ public abstract class AbstractPublisherAction implements IPublisherAction {
public static String[] getArrayFromString(String list, String separator) {
if (list == null || list.trim().equals("")) //$NON-NLS-1$
return new String[0];
- List result = new ArrayList();
+ List<String> result = new ArrayList<String>();
for (QuotedTokenizer tokens = new QuotedTokenizer(list, separator); tokens.hasMoreTokens();) {
String token = tokens.nextToken().trim();
if (!token.equals("")) //$NON-NLS-1$
result.add(token);
}
- return (String[]) result.toArray(new String[result.size()]);
+ return result.toArray(new String[result.size()]);
}
/**
@@ -129,7 +129,7 @@ public abstract class AbstractPublisherAction implements IPublisherAction {
}
String[] config = parseConfigSpec(configSpec);
- Dictionary environment = new Hashtable(3);
+ Dictionary<String, String> environment = new Hashtable<String, String>(3);
environment.put("osgi.ws", config[0]); //$NON-NLS-1$
environment.put("osgi.os", config[1]); //$NON-NLS-1$
environment.put("osgi.arch", config[2]); //$NON-NLS-1$
@@ -159,20 +159,19 @@ public abstract class AbstractPublisherAction implements IPublisherAction {
* @param children descriptions of the IUs on which requirements are to be made
* @return a collection of RequiredCapabilities representing the given IUs
*/
- protected Collection createIURequirements(Collection children) {
- ArrayList result = new ArrayList(children.size());
- for (Iterator i = children.iterator(); i.hasNext();) {
- Object next = i.next();
+ protected Collection<IRequirement> createIURequirements(Collection<? extends IVersionedId> children) {
+ ArrayList<IRequirement> result = new ArrayList<IRequirement>(children.size());
+ for (Iterator<? extends IVersionedId> i = children.iterator(); i.hasNext();) {
+ IVersionedId next = i.next();
if (next instanceof IInstallableUnit) {
IInstallableUnit iu = (IInstallableUnit) next;
VersionRange range = new VersionRange(iu.getVersion(), true, iu.getVersion(), true);
result.add(MetadataFactory.createRequiredCapability(IInstallableUnit.NAMESPACE_IU_ID, iu.getId(), range, iu.getFilter() == null ? null : ((LDAPQuery) iu.getFilter()).getFilter(), false, false));
- } else if (next instanceof IVersionedId) {
- IVersionedId name = (IVersionedId) next;
- Version version = name.getVersion();
+ } else {
+ Version version = next.getVersion();
VersionRange range = (version == null || Version.emptyVersion.equals(version)) ? VersionRange.emptyRange : new VersionRange(version, true, version, true);
- String filter = getFilterAdvice(name);
- result.add(MetadataFactory.createRequiredCapability(IInstallableUnit.NAMESPACE_IU_ID, name.getId(), range, filter, false, false));
+ String filter = getFilterAdvice(next);
+ result.add(MetadataFactory.createRequiredCapability(IInstallableUnit.NAMESPACE_IU_ID, next.getId(), range, filter, false, false));
}
}
return result;
@@ -181,9 +180,9 @@ public abstract class AbstractPublisherAction implements IPublisherAction {
private String getFilterAdvice(IVersionedId name) {
if (info == null)
return null;
- Collection filterAdvice = info.getAdvice(CONFIG_ANY, true, name.getId(), name.getVersion(), IFilterAdvice.class);
- for (Iterator i = filterAdvice.iterator(); i.hasNext();) {
- IFilterAdvice advice = (IFilterAdvice) i.next();
+ Collection<IFilterAdvice> filterAdvice = info.getAdvice(CONFIG_ANY, true, name.getId(), name.getVersion(), IFilterAdvice.class);
+ for (Iterator<IFilterAdvice> i = filterAdvice.iterator(); i.hasNext();) {
+ IFilterAdvice advice = i.next();
String result = advice.getFilter(name.getId(), name.getVersion(), false);
if (result != null)
return result;
@@ -212,7 +211,7 @@ public abstract class AbstractPublisherAction implements IPublisherAction {
return result;
}
- protected InstallableUnitDescription createParentIU(Collection children, String id, Version version) {
+ protected InstallableUnitDescription createParentIU(Collection<? extends IVersionedId> children, String id, Version version) {
InstallableUnitDescription root = createIUShell(id, version);
root.addRequiredCapabilities(createIURequirements(children));
addSelfCapability(root);
@@ -234,18 +233,18 @@ public abstract class AbstractPublisherAction implements IPublisherAction {
}
protected static InstallableUnitDescription[] processAdditionalInstallableUnitsAdvice(IInstallableUnit iu, IPublisherInfo publisherInfo) {
- Collection advice = publisherInfo.getAdvice(null, false, iu.getId(), iu.getVersion(), IAdditionalInstallableUnitAdvice.class);
+ Collection<IAdditionalInstallableUnitAdvice> advice = publisherInfo.getAdvice(null, false, iu.getId(), iu.getVersion(), IAdditionalInstallableUnitAdvice.class);
if (advice.isEmpty())
return null;
- List ius = new ArrayList();
- for (Iterator iterator = advice.iterator(); iterator.hasNext();) {
- IAdditionalInstallableUnitAdvice entry = (IAdditionalInstallableUnitAdvice) iterator.next();
+ List<InstallableUnitDescription> ius = new ArrayList<InstallableUnitDescription>();
+ for (Iterator<IAdditionalInstallableUnitAdvice> iterator = advice.iterator(); iterator.hasNext();) {
+ IAdditionalInstallableUnitAdvice entry = iterator.next();
InstallableUnitDescription[] others = entry.getAdditionalInstallableUnitDescriptions(iu);
if (others != null)
ius.addAll(Arrays.asList(others));
}
- return (InstallableUnitDescription[]) ius.toArray(new InstallableUnitDescription[ius.size()]);
+ return ius.toArray(new InstallableUnitDescription[ius.size()]);
}
/**
@@ -258,15 +257,15 @@ public abstract class AbstractPublisherAction implements IPublisherAction {
if (!(descriptor instanceof SimpleArtifactDescriptor))
return;
- Collection advice = info.getAdvice(null, false, iu.getId(), iu.getVersion(), IPropertyAdvice.class);
- for (Iterator i = advice.iterator(); i.hasNext();) {
- IPropertyAdvice entry = (IPropertyAdvice) i.next();
- Properties props = entry.getArtifactProperties(iu, descriptor);
+ Collection<IPropertyAdvice> advice = info.getAdvice(null, false, iu.getId(), iu.getVersion(), IPropertyAdvice.class);
+ for (Iterator<IPropertyAdvice> i = advice.iterator(); i.hasNext();) {
+ IPropertyAdvice entry = i.next();
+ Map<String, String> props = entry.getArtifactProperties(iu, descriptor);
if (props == null)
continue;
- for (Iterator j = props.keySet().iterator(); j.hasNext();) {
- String key = (String) j.next();
- ((SimpleArtifactDescriptor) descriptor).setRepositoryProperty(key, props.getProperty(key));
+ for (Iterator<Entry<String, String>> j = props.entrySet().iterator(); j.hasNext();) {
+ Entry<String, String> pe = j.next();
+ ((SimpleArtifactDescriptor) descriptor).setRepositoryProperty(pe.getKey(), pe.getValue());
}
}
}
@@ -277,15 +276,15 @@ public abstract class AbstractPublisherAction implements IPublisherAction {
* @param info the publisher info supplying the advice
*/
protected static void processInstallableUnitPropertiesAdvice(InstallableUnitDescription iu, IPublisherInfo info) {
- Collection advice = info.getAdvice(null, false, iu.getId(), iu.getVersion(), IPropertyAdvice.class);
- for (Iterator i = advice.iterator(); i.hasNext();) {
- IPropertyAdvice entry = (IPropertyAdvice) i.next();
- Properties props = entry.getInstallableUnitProperties(iu);
+ Collection<IPropertyAdvice> advice = info.getAdvice(null, false, iu.getId(), iu.getVersion(), IPropertyAdvice.class);
+ for (Iterator<IPropertyAdvice> i = advice.iterator(); i.hasNext();) {
+ IPropertyAdvice entry = i.next();
+ Map<String, String> props = entry.getInstallableUnitProperties(iu);
if (props == null)
continue;
- for (Iterator j = props.keySet().iterator(); j.hasNext();) {
- String key = (String) j.next();
- iu.setProperty(key, props.getProperty(key));
+ for (Iterator<Entry<String, String>> j = props.entrySet().iterator(); j.hasNext();) {
+ Entry<String, String> pe = j.next();
+ iu.setProperty(pe.getKey(), pe.getValue());
}
}
}
@@ -296,24 +295,25 @@ public abstract class AbstractPublisherAction implements IPublisherAction {
* @param info the publisher info supplying the advice
*/
protected static void processCapabilityAdvice(InstallableUnitDescription iu, IPublisherInfo info) {
- Collection advice = info.getAdvice(null, false, iu.getId(), iu.getVersion(), ICapabilityAdvice.class);
+ Collection<ICapabilityAdvice> advice = info.getAdvice(null, false, iu.getId(), iu.getVersion(), ICapabilityAdvice.class);
if (advice.isEmpty())
return;
- for (Iterator i = advice.iterator(); i.hasNext();) {
- ICapabilityAdvice entry = (ICapabilityAdvice) i.next();
+ for (Iterator<ICapabilityAdvice> i = advice.iterator(); i.hasNext();) {
+ ICapabilityAdvice entry = i.next();
//process required capabilities
IRequirement[] requiredAdvice = entry.getRequiredCapabilities(iu);
if (requiredAdvice != null) {
- IRequirement[] current = iu.getRequiredCapabilities();
- Set resultRequiredCapabilities = new HashSet(Arrays.asList(current));
+ List<IRequirement> current = iu.getRequiredCapabilities();
+ Set<IRequirement> resultRequiredCapabilities = new HashSet<IRequirement>(current);
// remove current required capabilities that match (same name and namespace) advice.
- for (int j = 0; j < current.length; j++) {
+ for (int j = 0; j < current.size(); j++) {
+ IRequirement curr = current.get(j);
IRequiredCapability currentRequiredCapability = null;
- if (current[j] instanceof IRequiredCapability)
- currentRequiredCapability = (IRequiredCapability) current[j];
+ if (curr instanceof IRequiredCapability)
+ currentRequiredCapability = (IRequiredCapability) curr;
else
continue;
for (int k = 0; k < requiredAdvice.length; k++) {
@@ -330,20 +330,21 @@ public abstract class AbstractPublisherAction implements IPublisherAction {
}
// add all advice
resultRequiredCapabilities.addAll(Arrays.asList(requiredAdvice));
- iu.setRequiredCapabilities((IRequirement[]) resultRequiredCapabilities.toArray(new IRequirement[resultRequiredCapabilities.size()]));
+ iu.setRequiredCapabilities(resultRequiredCapabilities.toArray(new IRequirement[resultRequiredCapabilities.size()]));
}
//process meta required capabilities
IRequirement[] metaRequiredAdvice = entry.getMetaRequiredCapabilities(iu);
if (metaRequiredAdvice != null) {
- IRequirement[] current = iu.getMetaRequiredCapabilities();
- Set resultMetaRequiredCapabilities = new HashSet(Arrays.asList(current));
+ List<IRequirement> current = iu.getMetaRequiredCapabilities();
+ Set<IRequirement> resultMetaRequiredCapabilities = new HashSet<IRequirement>(current);
// remove current meta-required capabilities that match (same name and namespace) advice.
- for (int j = 0; j < current.length; j++) {
+ for (int j = 0; j < current.size(); j++) {
+ IRequirement curr = current.get(j);
IRequiredCapability currentMetaRequiredCapability = null;
- if (current[j] instanceof IRequiredCapability)
- currentMetaRequiredCapability = (IRequiredCapability) current[j];
+ if (curr instanceof IRequiredCapability)
+ currentMetaRequiredCapability = (IRequiredCapability) curr;
else
continue;
for (int k = 0; k < metaRequiredAdvice.length; k++) {
@@ -361,16 +362,16 @@ public abstract class AbstractPublisherAction implements IPublisherAction {
// add all advice
resultMetaRequiredCapabilities.addAll(Arrays.asList(metaRequiredAdvice));
- iu.setMetaRequiredCapabilities((IRequirement[]) resultMetaRequiredCapabilities.toArray(new IRequirement[resultMetaRequiredCapabilities.size()]));
+ iu.setMetaRequiredCapabilities(resultMetaRequiredCapabilities.toArray(new IRequirement[resultMetaRequiredCapabilities.size()]));
}
//process provided capabilities
IProvidedCapability[] providedAdvice = entry.getProvidedCapabilities(iu);
if (providedAdvice != null) {
- IProvidedCapability[] current = iu.getProvidedCapabilities();
- Set resultProvidedCapabilities = new HashSet(Arrays.asList(current));
- for (int j = 0; j < current.length; j++) {
- IProvidedCapability currentProvidedCapability = current[j];
+ List<IProvidedCapability> current = iu.getProvidedCapabilities();
+ Set<IProvidedCapability> resultProvidedCapabilities = new HashSet<IProvidedCapability>(current);
+ for (int j = 0; j < current.size(); j++) {
+ IProvidedCapability currentProvidedCapability = current.get(j);
for (int k = 0; k < providedAdvice.length; k++) {
IProvidedCapability providedCapability = providedAdvice[k];
if (providedCapability.getNamespace().equals(currentProvidedCapability.getNamespace()) && providedCapability.getName().equals(currentProvidedCapability.getName())) {
@@ -380,7 +381,7 @@ public abstract class AbstractPublisherAction implements IPublisherAction {
}
}
resultProvidedCapabilities.addAll(Arrays.asList(providedAdvice));
- iu.setCapabilities((IProvidedCapability[]) resultProvidedCapabilities.toArray(new IProvidedCapability[resultProvidedCapabilities.size()]));
+ iu.setCapabilities(resultProvidedCapabilities.toArray(new IProvidedCapability[resultProvidedCapabilities.size()]));
}
}
}
@@ -391,22 +392,22 @@ public abstract class AbstractPublisherAction implements IPublisherAction {
* @param currentInstructions The set of touchpoint instructions assembled for this IU so far
* @param info The publisher info
*/
- protected static void processTouchpointAdvice(InstallableUnitDescription iu, Map currentInstructions, IPublisherInfo info) {
+ protected static void processTouchpointAdvice(InstallableUnitDescription iu, Map<String, ? extends Object> currentInstructions, IPublisherInfo info) {
processTouchpointAdvice(iu, currentInstructions, info, null);
}
- protected static void processTouchpointAdvice(InstallableUnitDescription iu, Map currentInstructions, IPublisherInfo info, String configSpec) {
- Collection advice = info.getAdvice(configSpec, false, iu.getId(), iu.getVersion(), ITouchpointAdvice.class);
+ protected static void processTouchpointAdvice(InstallableUnitDescription iu, Map<String, ? extends Object> currentInstructions, IPublisherInfo info, String configSpec) {
+ Collection<ITouchpointAdvice> advice = info.getAdvice(configSpec, false, iu.getId(), iu.getVersion(), ITouchpointAdvice.class);
if (currentInstructions == null) {
if (advice == null || advice.isEmpty())
return;
- currentInstructions = Collections.EMPTY_MAP;
+ currentInstructions = CollectionUtils.emptyMap();
}
ITouchpointData result = MetadataFactory.createTouchpointData(currentInstructions);
if (advice != null) {
- for (Iterator i = advice.iterator(); i.hasNext();) {
- ITouchpointAdvice entry = (ITouchpointAdvice) i.next();
+ for (Iterator<ITouchpointAdvice> i = advice.iterator(); i.hasNext();) {
+ ITouchpointAdvice entry = i.next();
result = entry.getTouchpointData(result);
}
}
@@ -524,12 +525,12 @@ public abstract class AbstractPublisherAction implements IPublisherAction {
* @return the first matching IU or <code>null</code> if none.
*/
protected IInstallableUnit queryForIU(IPublisherResult publisherResult, String iuId, Version version) {
- IQuery query = null;
- IQueryResult collector = Collector.EMPTY_COLLECTOR;
+ IQuery<IInstallableUnit> query = null;
+ IQueryResult<IInstallableUnit> collector = Collector.emptyCollector();
if (version != null && !Version.emptyVersion.equals(version)) {
- query = new LimitQuery(new InstallableUnitQuery(iuId, version), 1);
+ query = new LimitQuery<IInstallableUnit>(new InstallableUnitQuery(iuId, version), 1);
} else {
- query = new PipedQuery(new IQuery[] {new InstallableUnitQuery(iuId), new LatestIUVersionQuery()});
+ query = new PipedQuery<IInstallableUnit>(new InstallableUnitQuery(iuId), new LatestIUVersionQuery<IInstallableUnit>());
}
NullProgressMonitor progress = new NullProgressMonitor();
@@ -541,7 +542,7 @@ public abstract class AbstractPublisherAction implements IPublisherAction {
collector = info.getContextMetadataRepository().query(query, progress);
if (!collector.isEmpty())
- return (IInstallableUnit) collector.iterator().next();
+ return collector.iterator().next();
return null;
}
@@ -552,9 +553,9 @@ public abstract class AbstractPublisherAction implements IPublisherAction {
* @param versionRange the version range to consider
* @return The the IUs with the matching ids in the given range
*/
- protected IQueryResult queryForIUs(IPublisherResult publisherResult, String iuId, VersionRange versionRange) {
- IQuery query = null;
- IQueryResult queryResult = Collector.EMPTY_COLLECTOR;
+ protected IQueryResult<IInstallableUnit> queryForIUs(IPublisherResult publisherResult, String iuId, VersionRange versionRange) {
+ IQuery<IInstallableUnit> query = null;
+ IQueryResult<IInstallableUnit> queryResult = Collector.emptyCollector();
query = new InstallableUnitQuery(iuId, versionRange);
NullProgressMonitor progress = new NullProgressMonitor();
if (publisherResult != null)
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/IPublisherInfo.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/IPublisherInfo.java
index 5cf073209..40409f02f 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/IPublisherInfo.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/IPublisherInfo.java
@@ -65,7 +65,7 @@ public interface IPublisherInfo {
* @param includeDefault whether or not to merge in the advice common to all configurations
* @return the set of advice of the given type for the given configuration
*/
- public Collection getAdvice(String configSpec, boolean includeDefault, String id, Version version, Class type);
+ public <T extends IPublisherAdvice> Collection<T> getAdvice(String configSpec, boolean includeDefault, String id, Version version, Class<T> type);
/**
* Add the given advice to the set of publishing advices.
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/IPublisherResult.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/IPublisherResult.java
index a1fa931b7..4b524018e 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/IPublisherResult.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/IPublisherResult.java
@@ -22,7 +22,7 @@ import org.eclipse.equinox.p2.metadata.IInstallableUnit;
* determined by the actions involved in the operation and it is up to the consumer of the
* result to interpret the collections.
*/
-public interface IPublisherResult extends IQueryable {
+public interface IPublisherResult extends IQueryable<IInstallableUnit> {
/**
* Merge mode setting that causes all root results to be merged into
* the root of the merged results and all non-roots to become non-roots.
@@ -69,7 +69,7 @@ public interface IPublisherResult extends IQueryable {
* @param ius the IUs to add
* @param type the type of the IUs in this result
*/
- public void addIUs(Collection ius, String type);
+ public void addIUs(Collection<IInstallableUnit> ius, String type);
/**
* Returns the IUs of the given type with the given id in this result.
@@ -79,7 +79,7 @@ public interface IPublisherResult extends IQueryable {
* @see #ROOT
* @see #NON_ROOT
*/
- public Collection getIUs(String id, String type);
+ public Collection<IInstallableUnit> getIUs(String id, String type);
/**
* Returns the first available IU of the given type with the given id in this result.
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/Publisher.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/Publisher.java
index 6fd6c2e18..f8819040f 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/Publisher.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/Publisher.java
@@ -183,8 +183,8 @@ public class Publisher {
// if there were no errors, publish all the ius.
IMetadataRepository metadataRepository = info.getMetadataRepository();
if (metadataRepository != null) {
- Collection ius = results.getIUs(null, null);
- metadataRepository.addInstallableUnits((IInstallableUnit[]) ius.toArray(new IInstallableUnit[ius.size()]));
+ Collection<IInstallableUnit> ius = results.getIUs(null, null);
+ metadataRepository.addInstallableUnits(ius.toArray(new IInstallableUnit[ius.size()]));
}
return Status.OK_STATUS;
}
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/PublisherInfo.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/PublisherInfo.java
index 179d5eae6..0e4c6b779 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/PublisherInfo.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/PublisherInfo.java
@@ -23,22 +23,22 @@ public class PublisherInfo implements IPublisherInfo {
private IMetadataRepository contextMetadataRepository;
private IArtifactRepository contextArtifactRepository;
private String[] configurations = new String[0];
- private List adviceList = new ArrayList(11);
+ private List<IPublisherAdvice> adviceList = new ArrayList<IPublisherAdvice>(11);
public void addAdvice(IPublisherAdvice advice) {
adviceList.add(advice);
}
- public List getAdvice() {
+ public List<IPublisherAdvice> getAdvice() {
return adviceList;
}
- public Collection getAdvice(String configSpec, boolean includeDefault, String id, Version version, Class type) {
- ArrayList result = new ArrayList();
- for (Iterator i = adviceList.iterator(); i.hasNext();) {
- Object object = i.next();
- if (type.isInstance(object) && ((IPublisherAdvice) object).isApplicable(configSpec, includeDefault, id, version))
- result.add(object);
+ public <T extends IPublisherAdvice> Collection<T> getAdvice(String configSpec, boolean includeDefault, String id, Version version, Class<T> type) {
+ ArrayList<T> result = new ArrayList<T>();
+ for (Iterator<IPublisherAdvice> i = adviceList.iterator(); i.hasNext();) {
+ IPublisherAdvice advice = i.next();
+ if (type.isInstance(advice) && advice.isApplicable(configSpec, includeDefault, id, version))
+ result.add(type.cast(advice));
}
return result;
}
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/PublisherResult.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/PublisherResult.java
index 0898b5806..4bcf2521a 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/PublisherResult.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/PublisherResult.java
@@ -12,6 +12,7 @@ package org.eclipse.equinox.p2.publisher;
import java.util.*;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils;
import org.eclipse.equinox.internal.provisional.p2.metadata.Version;
import org.eclipse.equinox.internal.provisional.p2.metadata.VersionRange;
import org.eclipse.equinox.internal.provisional.p2.metadata.query.*;
@@ -21,9 +22,8 @@ import org.eclipse.equinox.p2.metadata.query.IQueryResult;
public class PublisherResult implements IPublisherResult {
- private static final Collection EMPTY_COLLECTION = new ArrayList(0);
- final Map rootIUs = new HashMap();
- final Map nonRootIUs = new HashMap();
+ final Map<String, Set<IInstallableUnit>> rootIUs = new HashMap<String, Set<IInstallableUnit>>();
+ final Map<String, Set<IInstallableUnit>> nonRootIUs = new HashMap<String, Set<IInstallableUnit>>();
public void addIU(IInstallableUnit iu, String type) {
if (type == ROOT)
@@ -32,15 +32,15 @@ public class PublisherResult implements IPublisherResult {
addIU(nonRootIUs, iu.getId(), iu);
}
- public void addIUs(Collection ius, String type) {
- for (Iterator i = ius.iterator(); i.hasNext();)
- addIU((IInstallableUnit) i.next(), type);
+ public void addIUs(Collection<IInstallableUnit> ius, String type) {
+ for (Iterator<IInstallableUnit> i = ius.iterator(); i.hasNext();)
+ addIU(i.next(), type);
}
- private void addIU(Map map, String id, IInstallableUnit iu) {
- Set ius = (Set) map.get(id);
+ private void addIU(Map<String, Set<IInstallableUnit>> map, String id, IInstallableUnit iu) {
+ Set<IInstallableUnit> ius = map.get(id);
if (ius == null) {
- ius = new HashSet(11);
+ ius = new HashSet<IInstallableUnit>(11);
map.put(id, ius);
}
ius.add(iu);
@@ -48,17 +48,17 @@ public class PublisherResult implements IPublisherResult {
public IInstallableUnit getIU(String id, Version version, String type) {
if (type == null || type == ROOT) {
- Collection ius = (Collection) rootIUs.get(id);
- for (Iterator i = ius.iterator(); i.hasNext();) {
- IInstallableUnit iu = (IInstallableUnit) i.next();
+ Collection<IInstallableUnit> ius = rootIUs.get(id);
+ for (Iterator<IInstallableUnit> i = ius.iterator(); i.hasNext();) {
+ IInstallableUnit iu = i.next();
if (iu.getVersion().equals(version))
return iu;
}
}
if (type == null || type == NON_ROOT) {
- Collection ius = (Collection) nonRootIUs.get(id);
- for (Iterator i = ius.iterator(); i.hasNext();) {
- IInstallableUnit iu = (IInstallableUnit) i.next();
+ Collection<IInstallableUnit> ius = nonRootIUs.get(id);
+ for (Iterator<IInstallableUnit> i = ius.iterator(); i.hasNext();) {
+ IInstallableUnit iu = i.next();
if (iu.getVersion().equals(version))
return iu;
}
@@ -70,14 +70,14 @@ public class PublisherResult implements IPublisherResult {
// matching IU non-deterministically.
public IInstallableUnit getIU(String id, String type) {
if (type == null || type == ROOT) {
- Collection ius = (Collection) rootIUs.get(id);
+ Collection<IInstallableUnit> ius = rootIUs.get(id);
if (ius != null && ius.size() > 0)
- return (IInstallableUnit) ius.iterator().next();
+ return ius.iterator().next();
}
if (type == null || type == NON_ROOT) {
- Collection ius = (Collection) nonRootIUs.get(id);
+ Collection<IInstallableUnit> ius = nonRootIUs.get(id);
if (ius != null && ius.size() > 0)
- return (IInstallableUnit) ius.iterator().next();
+ return ius.iterator().next();
}
return null;
}
@@ -85,29 +85,29 @@ public class PublisherResult implements IPublisherResult {
/**
* Returns the IUs in this result with the given id.
*/
- public Collection getIUs(String id, String type) {
+ public Collection<IInstallableUnit> getIUs(String id, String type) {
if (type == null) {
- ArrayList result = new ArrayList();
+ ArrayList<IInstallableUnit> result = new ArrayList<IInstallableUnit>();
result.addAll(id == null ? flatten(rootIUs.values()) : getIUs(rootIUs, id));
result.addAll(id == null ? flatten(nonRootIUs.values()) : getIUs(nonRootIUs, id));
return result;
}
if (type == ROOT)
- return id == null ? flatten(rootIUs.values()) : (Collection) rootIUs.get(id);
+ return id == null ? flatten(rootIUs.values()) : rootIUs.get(id);
if (type == NON_ROOT)
- return id == null ? flatten(nonRootIUs.values()) : (Collection) nonRootIUs.get(id);
+ return id == null ? flatten(nonRootIUs.values()) : nonRootIUs.get(id);
return null;
}
- private Collection getIUs(Map ius, String id) {
- Collection result = (Collection) ius.get(id);
- return result == null ? EMPTY_COLLECTION : result;
+ private Collection<IInstallableUnit> getIUs(Map<String, Set<IInstallableUnit>> ius, String id) {
+ Collection<IInstallableUnit> result = ius.get(id);
+ return result == null ? CollectionUtils.<IInstallableUnit> emptyList() : result;
}
- protected List flatten(Collection values) {
- ArrayList result = new ArrayList();
- for (Iterator i = values.iterator(); i.hasNext();)
- for (Iterator j = ((HashSet) i.next()).iterator(); j.hasNext();)
+ protected List<IInstallableUnit> flatten(Collection<Set<IInstallableUnit>> values) {
+ ArrayList<IInstallableUnit> result = new ArrayList<IInstallableUnit>();
+ for (Iterator<Set<IInstallableUnit>> i = values.iterator(); i.hasNext();)
+ for (Iterator<IInstallableUnit> j = i.next().iterator(); j.hasNext();)
result.add(j.next());
return result;
}
@@ -125,14 +125,14 @@ public class PublisherResult implements IPublisherResult {
}
}
- class QueryableMap implements IQueryable {
- private Map map;
+ class QueryableMap implements IQueryable<IInstallableUnit> {
+ private Map<String, Set<IInstallableUnit>> map;
- public QueryableMap(Map map) {
+ public QueryableMap(Map<String, Set<IInstallableUnit>> map) {
this.map = map;
}
- public IQueryResult query(IQuery query, IProgressMonitor monitor) {
+ public IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor) {
return query.perform(flatten(this.map.values()).iterator());
}
}
@@ -140,21 +140,23 @@ public class PublisherResult implements IPublisherResult {
/**
* Queries both the root and non root IUs
*/
- public IQueryResult query(IQuery query, IProgressMonitor monitor) {
+ public IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor) {
//optimize for installable unit query
if (query instanceof InstallableUnitQuery)
return queryIU((InstallableUnitQuery) query, monitor);
- IQueryable nonRootQueryable = new QueryableMap(nonRootIUs);
- IQueryable rootQueryable = new QueryableMap(rootIUs);
- return new CompoundQueryable(new IQueryable[] {nonRootQueryable, rootQueryable}).query(query, monitor);
+ IQueryable<IInstallableUnit> nonRootQueryable = new QueryableMap(nonRootIUs);
+ IQueryable<IInstallableUnit> rootQueryable = new QueryableMap(rootIUs);
+ @SuppressWarnings("unchecked")
+ IQueryable<IInstallableUnit>[] queryables = new IQueryable[] {nonRootQueryable, rootQueryable};
+ return new CompoundQueryable<IInstallableUnit>(queryables).query(query, monitor);
}
- private IQueryResult queryIU(InstallableUnitQuery query, IProgressMonitor monitor) {
- Collector result = new Collector();
- Collection matches = getIUs(query.getId(), null);
+ private IQueryResult<IInstallableUnit> queryIU(InstallableUnitQuery query, IProgressMonitor monitor) {
+ Collector<IInstallableUnit> result = new Collector<IInstallableUnit>();
+ Collection<IInstallableUnit> matches = getIUs(query.getId(), null);
VersionRange queryRange = query.getRange();
- for (Iterator it = matches.iterator(); it.hasNext();) {
- IInstallableUnit match = (IInstallableUnit) it.next();
+ for (Iterator<IInstallableUnit> it = matches.iterator(); it.hasNext();) {
+ IInstallableUnit match = it.next();
if (queryRange == null || queryRange.isIncluded(match.getVersion()))
if (!result.accept(match))
break;
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/ILicenseAdvice.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/ILicenseAdvice.java
index 03868e07f..a6deae374 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/ILicenseAdvice.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/ILicenseAdvice.java
@@ -9,10 +9,12 @@
******************************************************************************/
package org.eclipse.equinox.p2.publisher.actions;
+import org.eclipse.equinox.p2.publisher.IPublisherAdvice;
+
/**
* Provides advice about a license.
*/
-public interface ILicenseAdvice {
+public interface ILicenseAdvice extends IPublisherAdvice {
public String getLicenseURL();
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/IPropertyAdvice.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/IPropertyAdvice.java
index 1cb0be9a8..18ef45493 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/IPropertyAdvice.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/IPropertyAdvice.java
@@ -10,7 +10,7 @@
*******************************************************************************/
package org.eclipse.equinox.p2.publisher.actions;
-import java.util.Properties;
+import java.util.Map;
import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory.InstallableUnitDescription;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.publisher.IPublisherAdvice;
@@ -21,11 +21,11 @@ public interface IPropertyAdvice extends IPublisherAdvice {
/**
* Returns the set of extra properties to be associated with the IU
*/
- public Properties getInstallableUnitProperties(InstallableUnitDescription iu);
+ public Map<String, String> getInstallableUnitProperties(InstallableUnitDescription iu);
/**
* Returns the set of extra properties to be associated with the artifact descriptor
* being published
*/
- public Properties getArtifactProperties(IInstallableUnit iu, IArtifactDescriptor descriptor);
+ public Map<String, String> getArtifactProperties(IInstallableUnit iu, IArtifactDescriptor descriptor);
}
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/IRootIUAdvice.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/IRootIUAdvice.java
index 2c5cad689..9cd432b1c 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/IRootIUAdvice.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/IRootIUAdvice.java
@@ -11,9 +11,10 @@
package org.eclipse.equinox.p2.publisher.actions;
import java.util.Collection;
+import org.eclipse.equinox.p2.publisher.IPublisherAdvice;
import org.eclipse.equinox.p2.publisher.IPublisherResult;
-public interface IRootIUAdvice {
+public interface IRootIUAdvice extends IPublisherAdvice {
/**
* Returns the list of children of the root for this publishing operation.
@@ -22,5 +23,5 @@ public interface IRootIUAdvice {
* @param result
* @return the collection of children
*/
- public Collection getChildren(IPublisherResult result);
+ public Collection<? extends Object> getChildren(IPublisherResult result);
} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/JREAction.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/JREAction.java
index 7d6dd97c6..5a2e744fc 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/JREAction.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/JREAction.java
@@ -12,8 +12,10 @@ package org.eclipse.equinox.p2.publisher.actions;
import java.io.*;
import java.net.URL;
-import java.util.*;
+import java.util.HashMap;
+import java.util.Map;
import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils;
import org.eclipse.equinox.internal.p2.metadata.ArtifactKey;
import org.eclipse.equinox.internal.p2.publisher.Activator;
import org.eclipse.equinox.internal.provisional.p2.metadata.*;
@@ -37,7 +39,7 @@ public class JREAction extends AbstractPublisherAction {
private File jreLocation;
private String environment;
- private Properties profileProperties;
+ private Map<String, String> profileProperties;
public JREAction(File location) {
this.jreLocation = location;
@@ -79,7 +81,7 @@ public class JREAction extends AbstractPublisherAction {
cu.setProperty(InstallableUnitDescription.PROP_TYPE_FRAGMENT, Boolean.TRUE.toString());
cu.setCapabilities(new IProvidedCapability[] {PublisherHelper.createSelfCapability(configId, iu.getVersion())});
cu.setTouchpointType(PublisherHelper.TOUCHPOINT_NATIVE);
- Map touchpointData = new HashMap();
+ Map<String, String> touchpointData = new HashMap<String, String>();
if (jreLocation == null || !jreLocation.exists()) {
touchpointData.put("install", ""); //$NON-NLS-1$ //$NON-NLS-2$
@@ -111,7 +113,7 @@ public class JREAction extends AbstractPublisherAction {
return new IProvidedCapability[0];
try {
- ManifestElement[] jrePackages = ManifestElement.parseHeader(PROFILE_SYSTEM_PACKAGES, (String) profileProperties.get(PROFILE_SYSTEM_PACKAGES));
+ ManifestElement[] jrePackages = ManifestElement.parseHeader(PROFILE_SYSTEM_PACKAGES, profileProperties.get(PROFILE_SYSTEM_PACKAGES));
IProvidedCapability[] exportedPackageAsCapabilities = new IProvidedCapability[jrePackages.length + 1];
exportedPackageAsCapabilities[0] = PublisherHelper.createSelfCapability(id, version);
for (int i = 1; i <= jrePackages.length; i++) {
@@ -129,9 +131,9 @@ public class JREAction extends AbstractPublisherAction {
if (profileProperties == null || profileProperties.size() == 0)
return; //got nothing
- String profileLocation = profileProperties.getProperty(PROFILE_LOCATION);
+ String profileLocation = profileProperties.get(PROFILE_LOCATION);
- String profileName = profileLocation != null ? new Path(profileLocation).lastSegment() : profileProperties.getProperty(PROFILE_NAME);
+ String profileName = profileLocation != null ? new Path(profileLocation).lastSegment() : profileProperties.get(PROFILE_NAME);
if (profileName.endsWith(".profile")) //$NON-NLS-1$
profileName = profileName.substring(0, profileName.length() - 8);
Version version = null;
@@ -146,7 +148,7 @@ public class JREAction extends AbstractPublisherAction {
}
if (version == null) {
try {
- String targetVersion = profileProperties.getProperty(PROFILE_TARGET_VERSION);
+ String targetVersion = profileProperties.get(PROFILE_TARGET_VERSION);
version = targetVersion != null ? Version.parseVersion(targetVersion) : null;
} catch (IllegalArgumentException e) {
//ignore
@@ -188,13 +190,13 @@ public class JREAction extends AbstractPublisherAction {
}
}
- private Properties loadProfile(File profileFile) {
+ private Map<String, String> loadProfile(File profileFile) {
if (profileFile == null || !profileFile.exists())
return null;
try {
InputStream stream = new BufferedInputStream(new FileInputStream(profileFile));
- Properties properties = loadProfile(stream);
+ Map<String, String> properties = loadProfile(stream);
if (properties != null)
properties.put(PROFILE_LOCATION, profileFile.getAbsolutePath());
return properties;
@@ -204,7 +206,7 @@ public class JREAction extends AbstractPublisherAction {
return null;
}
- private Properties loadProfile(URL profileURL) {
+ private Map<String, String> loadProfile(URL profileURL) {
if (profileURL == null)
return null;
@@ -220,12 +222,10 @@ public class JREAction extends AbstractPublisherAction {
/**
* Always closes the stream when done
*/
- private Properties loadProfile(InputStream stream) {
+ private Map<String, String> loadProfile(InputStream stream) {
if (stream != null) {
try {
- Properties properties = new Properties();
- properties.load(stream);
- return properties;
+ return CollectionUtils.loadProperties(stream);
} catch (IOException e) {
return null;
} finally {
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/QueryableFilterAdvice.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/QueryableFilterAdvice.java
index a36950573..7121d3025 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/QueryableFilterAdvice.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/QueryableFilterAdvice.java
@@ -22,24 +22,24 @@ import org.eclipse.equinox.p2.metadata.query.IQueryResult;
*/
public class QueryableFilterAdvice implements IFilterAdvice {
- private IQueryable queryable;
+ private IQueryable<IInstallableUnit> queryable;
- public QueryableFilterAdvice(IQueryable queryable) {
+ public QueryableFilterAdvice(IQueryable<IInstallableUnit> queryable) {
this.queryable = queryable;
}
public String getFilter(String id, Version version, boolean exact) {
InstallableUnitQuery query = new InstallableUnitQuery(id, version);
- IQueryResult result = queryable.query(query, null);
+ IQueryResult<IInstallableUnit> result = queryable.query(query, null);
if (!result.isEmpty())
- return ((LDAPQuery) ((IInstallableUnit) result.iterator().next()).getFilter()).getFilter();
+ return ((LDAPQuery) result.iterator().next().getFilter()).getFilter();
if (exact)
return null;
query = new InstallableUnitQuery(id);
result = queryable.query(query, null);
if (!result.isEmpty())
- return ((LDAPQuery) ((IInstallableUnit) result.iterator().next()).getFilter()).getFilter();
+ return ((LDAPQuery) result.iterator().next().getFilter()).getFilter();
return null;
}
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/RootFilesAction.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/RootFilesAction.java
index f996efd8a..02becbfb1 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/RootFilesAction.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/RootFilesAction.java
@@ -68,7 +68,7 @@ public class RootFilesAction extends AbstractPublisherAction {
return Status.OK_STATUS;
}
- private void publishTopLevelRootFilesIU(Collection children, IPublisherResult result) {
+ private void publishTopLevelRootFilesIU(Collection<? extends IVersionedId> children, IPublisherResult result) {
InstallableUnitDescription descriptor = createParentIU(children, computeIUId(idBase, flavor), version);
descriptor.setSingleton(true);
IInstallableUnit rootIU = MetadataFactory.createInstallableUnit(descriptor);
@@ -111,7 +111,7 @@ public class RootFilesAction extends AbstractPublisherAction {
cu.setCapabilities(new IProvidedCapability[] {PublisherHelper.createSelfCapability(configUnitId, version)});
cu.setTouchpointType(PublisherHelper.TOUCHPOINT_NATIVE);
- Map touchpointData = new HashMap();
+ Map<String, String> touchpointData = new HashMap<String, String>();
String configurationData = "unzip(source:@artifact, target:${installFolder});"; //$NON-NLS-1$
touchpointData.put("install", configurationData); //$NON-NLS-1$
String unConfigurationData = "cleanupzip(source:@artifact, target:${installFolder});"; //$NON-NLS-1$
@@ -141,12 +141,12 @@ public class RootFilesAction extends AbstractPublisherAction {
* @return a compilation of <class>IRootfilesAdvice</class> from the <code>info</code>.
*/
private IRootFilesAdvice getAdvice(String configSpec) {
- Collection advice = info.getAdvice(configSpec, true, null, null, IRootFilesAdvice.class);
- ArrayList inclusions = new ArrayList();
- ArrayList exclusions = new ArrayList();
+ Collection<IRootFilesAdvice> advice = info.getAdvice(configSpec, true, null, null, IRootFilesAdvice.class);
+ ArrayList<File> inclusions = new ArrayList<File>();
+ ArrayList<File> exclusions = new ArrayList<File>();
File root = null;
- for (Iterator i = advice.iterator(); i.hasNext();) {
- IRootFilesAdvice entry = (IRootFilesAdvice) i.next();
+ for (Iterator<IRootFilesAdvice> i = advice.iterator(); i.hasNext();) {
+ IRootFilesAdvice entry = i.next();
// TODO for now we simply get root from the first advice that has one
if (root == null)
root = entry.getRoot();
@@ -157,8 +157,8 @@ public class RootFilesAction extends AbstractPublisherAction {
if (list != null)
exclusions.addAll(Arrays.asList(list));
}
- File[] includeList = (File[]) inclusions.toArray(new File[inclusions.size()]);
- File[] excludeList = (File[]) exclusions.toArray(new File[exclusions.size()]);
+ File[] includeList = inclusions.toArray(new File[inclusions.size()]);
+ File[] excludeList = exclusions.toArray(new File[exclusions.size()]);
return new RootFilesAdvice(root, includeList, excludeList, configSpec);
}
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/RootIUAction.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/RootIUAction.java
index c7058339f..837def9b8 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/RootIUAction.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/RootIUAction.java
@@ -32,7 +32,7 @@ public class RootIUAction extends AbstractPublisherAction {
private Version version;
private String id;
private String name;
- private Collection versionAdvice;
+ private Collection<IVersionAdvice> versionAdvice;
public RootIUAction(String id, Version version, String name) {
this.id = id;
@@ -46,7 +46,7 @@ public class RootIUAction extends AbstractPublisherAction {
}
protected IStatus generateRootIU(IPublisherResult result) {
- Collection children = getChildren(result);
+ Collection<? extends IVersionedId> children = getChildren(result);
InstallableUnitDescription descriptor = createTopLevelIUDescription(children, null, false);
processCapabilityAdvice(descriptor, info);
processTouchpointAdvice(descriptor, null, info);
@@ -68,10 +68,10 @@ public class RootIUAction extends AbstractPublisherAction {
}
protected static void processLicense(InstallableUnitDescription iu, IPublisherInfo info) {
- Collection advice = info.getAdvice(null, true, iu.getId(), iu.getVersion(), ILicenseAdvice.class);
+ Collection<ILicenseAdvice> advice = info.getAdvice(null, true, iu.getId(), iu.getVersion(), ILicenseAdvice.class);
if (advice.size() > 0) {
// Only process the first license we find for this IU.
- ILicenseAdvice entry = (ILicenseAdvice) advice.iterator().next();
+ ILicenseAdvice entry = advice.iterator().next();
String licenseText = entry.getLicenseText() == null ? "" : entry.getLicenseText(); //$NON-NLS-1$
String licenseUrl = entry.getLicenseURL() == null ? "" : entry.getLicenseURL(); //$NON-NLS-1$
if (licenseText.length() > 0 || licenseUrl.length() > 0)
@@ -117,18 +117,18 @@ public class RootIUAction extends AbstractPublisherAction {
// cat.setProperty(IInstallableUnit.PROP_TYPE_CATEGORY, "true"); //$NON-NLS-1$
// return MetadataFactory.createInstallableUnit(cat);
// }
- private Collection getChildren(IPublisherResult result) {
+ private Collection<? extends IVersionedId> getChildren(IPublisherResult result) {
// get any roots that we have accummulated so far and search for
// children from the advice.
- HashSet children = new HashSet();
- Collection rootAdvice = info.getAdvice(null, true, null, null, IRootIUAdvice.class);
+ HashSet<IVersionedId> children = new HashSet<IVersionedId>();
+ Collection<IRootIUAdvice> rootAdvice = info.getAdvice(null, true, null, null, IRootIUAdvice.class);
if (rootAdvice == null)
return children;
- for (Iterator i = rootAdvice.iterator(); i.hasNext();) {
- IRootIUAdvice advice = (IRootIUAdvice) i.next();
- Collection list = advice.getChildren(result);
+ for (Iterator<IRootIUAdvice> i = rootAdvice.iterator(); i.hasNext();) {
+ IRootIUAdvice advice = i.next();
+ Collection<? extends Object> list = advice.getChildren(result);
if (list != null)
- for (Iterator j = list.iterator(); j.hasNext();) {
+ for (Iterator<? extends Object> j = list.iterator(); j.hasNext();) {
Object object = j.next();
// if the advice is a string, look it up in the result. if not there then
// query the known metadata repos
@@ -138,24 +138,24 @@ public class RootIUAction extends AbstractPublisherAction {
if (iu != null)
children.add(iu);
} else if (object instanceof IVersionedId) {
- children.add(object);
+ children.add((IVersionedId) object);
}
}
}
return children;
}
- private InstallableUnitDescription createTopLevelIUDescription(Collection children, Collection requires, boolean configureLauncherData) {
+ private InstallableUnitDescription createTopLevelIUDescription(Collection<? extends IVersionedId> children, Collection<IRequirement> requires, boolean configureLauncherData) {
InstallableUnitDescription root = new MetadataFactory.InstallableUnitDescription();
root.setSingleton(true);
root.setId(id);
root.setVersion(version);
root.setProperty(IInstallableUnit.PROP_NAME, name);
- Collection requiredCapabilities = createIURequirements(children);
+ Collection<IRequirement> requiredCapabilities = createIURequirements(children);
if (requires != null)
requiredCapabilities.addAll(requires);
- root.setRequiredCapabilities((IRequirement[]) requiredCapabilities.toArray(new IRequirement[requiredCapabilities.size()]));
+ root.setRequiredCapabilities(requiredCapabilities.toArray(new IRequirement[requiredCapabilities.size()]));
root.setArtifacts(new IArtifactKey[0]);
root.setProperty("lineUp", "true"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -173,8 +173,8 @@ public class RootIUAction extends AbstractPublisherAction {
if (versionAdvice == null)
return null;
}
- for (Iterator i = versionAdvice.iterator(); i.hasNext();) {
- IVersionAdvice advice = (IVersionAdvice) i.next();
+ for (Iterator<IVersionAdvice> i = versionAdvice.iterator(); i.hasNext();) {
+ IVersionAdvice advice = i.next();
// TODO have to figure a way to know the namespace here. for now just look everywhere
Version result = advice.getVersion(IInstallableUnit.NAMESPACE_IU_ID, iuID);
if (result == null)
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/RootIUAdvice.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/RootIUAdvice.java
index 85d6051cb..5dbfb5274 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/RootIUAdvice.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/RootIUAdvice.java
@@ -20,13 +20,13 @@ import org.eclipse.equinox.p2.publisher.IPublisherResult;
*/
public class RootIUAdvice extends AbstractAdvice implements IRootIUAdvice {
- private Collection children;
+ private Collection<? extends Object> children;
- public RootIUAdvice(Collection children) {
+ public RootIUAdvice(Collection<? extends Object> children) {
this.children = children;
}
- public Collection getChildren(IPublisherResult result) {
+ public Collection<? extends Object> getChildren(IPublisherResult result) {
return children;
}
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/RootIUResultFilterAdvice.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/RootIUResultFilterAdvice.java
index 4e65d9ba4..a0f95659a 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/RootIUResultFilterAdvice.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/RootIUResultFilterAdvice.java
@@ -17,14 +17,14 @@ import org.eclipse.equinox.p2.publisher.AbstractAdvice;
import org.eclipse.equinox.p2.publisher.IPublisherResult;
public class RootIUResultFilterAdvice extends AbstractAdvice implements IRootIUAdvice {
- private IQuery query;
+ private IQuery<IInstallableUnit> query;
- public RootIUResultFilterAdvice(IQuery query) {
+ public RootIUResultFilterAdvice(IQuery<IInstallableUnit> query) {
this.query = query;
}
- public Collection getChildren(IPublisherResult result) {
- Collection value = result.getIUs(null, IPublisherResult.ROOT);
+ public Collection<IInstallableUnit> getChildren(IPublisherResult result) {
+ Collection<IInstallableUnit> value = result.getIUs(null, IPublisherResult.ROOT);
if (query == null)
return value;
return Arrays.asList(query.perform(value.iterator()).toArray(IInstallableUnit.class));
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/VersionAdvice.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/VersionAdvice.java
index 629d2f45b..bedcbd3eb 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/VersionAdvice.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/VersionAdvice.java
@@ -12,13 +12,15 @@ package org.eclipse.equinox.p2.publisher.actions;
import java.io.*;
import java.util.*;
+import java.util.Map.Entry;
+import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils;
import org.eclipse.equinox.internal.provisional.p2.metadata.Version;
import org.eclipse.equinox.p2.publisher.AbstractAdvice;
import org.eclipse.equinox.p2.publisher.IPublisherAdvice;
public class VersionAdvice extends AbstractAdvice implements IVersionAdvice {
- Map versions = new HashMap(11);
+ Map<String, Map<String, Version>> versions = new HashMap<String, Map<String, Version>>(11);
/**
* Load the given namespace with version mappings from the properties file at
@@ -33,35 +35,31 @@ public class VersionAdvice extends AbstractAdvice implements IVersionAdvice {
}
public void load(String namespace, String location, String idSuffix) {
+ File file = new File(location);
if (namespace == null)
namespace = "null"; //$NON-NLS-1$
- Properties properties = new Properties();
- File file = new File(location);
- if (file.exists()) {
- InputStream stream = null;
- try {
- stream = new BufferedInputStream(new FileInputStream(file));
- properties.load(stream);
- } catch (IOException e) {
- // nothing
- } finally {
- if (stream != null)
- try {
- stream.close();
- } catch (IOException e) {
- //nothing
- }
- }
+
+ Map<String, String> properties;
+ InputStream stream = null;
+ try {
+ stream = new BufferedInputStream(new FileInputStream(file));
+ properties = CollectionUtils.loadProperties(stream);
+ } catch (IOException e) {
+ return;
+ } finally {
+ if (stream != null)
+ try {
+ stream.close();
+ } catch (IOException e) {
+ //nothing
+ }
}
- if (properties.size() > 0) {
- Enumeration enumeration = properties.keys();
- while (enumeration.hasMoreElements()) {
- String key = (String) enumeration.nextElement();
- if (idSuffix != null)
- key += idSuffix;
- String value = properties.getProperty(key);
- setVersion(namespace, key, Version.parseVersion(value));
- }
+ for (Iterator<Entry<String, String>> itor = properties.entrySet().iterator(); itor.hasNext();) {
+ Entry<String, String> entry = itor.next();
+ String key = entry.getKey();
+ if (idSuffix != null)
+ key += idSuffix;
+ setVersion(namespace, key, Version.parseVersion(entry.getValue()));
}
}
@@ -72,18 +70,18 @@ public class VersionAdvice extends AbstractAdvice implements IVersionAdvice {
* @return the version advice found or <code>null</code> if none
*/
public Version getVersion(String namespace, String id) {
- Map values = (Map) versions.get(namespace);
+ Map<String, Version> values = versions.get(namespace);
// if no one says anything then don't say anything. someone else might have an opinion
if (values != null) {
- Version result = (Version) values.get(id);
+ Version result = values.get(id);
if (result != null)
return result;
}
- values = (Map) versions.get("null"); //$NON-NLS-1$
+ values = versions.get("null"); //$NON-NLS-1$
if (values == null)
return null;
- return (Version) values.get(id);
+ return values.get(id);
}
/**
@@ -93,12 +91,12 @@ public class VersionAdvice extends AbstractAdvice implements IVersionAdvice {
* @param version the version advice for the given id or <code>null</code> to remove advice
*/
public void setVersion(String namespace, String id, Version version) {
- Map values = (Map) versions.get(namespace);
+ Map<String, Version> values = versions.get(namespace);
if (values == null) {
// if we are clearing values then there is nothing to do
if (version == null)
return;
- values = new HashMap();
+ values = new HashMap<String, Version>();
versions.put(namespace, values);
}
if (version == null)
@@ -111,10 +109,10 @@ public class VersionAdvice extends AbstractAdvice implements IVersionAdvice {
if (!(advice instanceof VersionAdvice))
return this;
VersionAdvice source = (VersionAdvice) advice;
- for (Iterator i = source.versions.keySet().iterator(); i.hasNext();) {
- String namespace = (String) i.next();
- Map myValues = (Map) versions.get(namespace);
- Map sourceValues = (Map) source.versions.get(namespace);
+ for (Iterator<String> i = source.versions.keySet().iterator(); i.hasNext();) {
+ String namespace = i.next();
+ Map<String, Version> myValues = versions.get(namespace);
+ Map<String, Version> sourceValues = source.versions.get(namespace);
if (myValues == null)
versions.put(namespace, sourceValues);
else if (sourceValues != null)
@@ -123,10 +121,10 @@ public class VersionAdvice extends AbstractAdvice implements IVersionAdvice {
return this;
}
- private Map merge(Map myValues, Map sourceValues) {
- Map result = new HashMap(myValues);
- for (Iterator i = sourceValues.keySet().iterator(); i.hasNext();) {
- String key = (String) i.next();
+ private Map<String, Version> merge(Map<String, Version> myValues, Map<String, Version> sourceValues) {
+ Map<String, Version> result = new HashMap<String, Version>(myValues);
+ for (Iterator<String> i = sourceValues.keySet().iterator(); i.hasNext();) {
+ String key = i.next();
if (result.get(key) == null)
result.put(key, sourceValues.get(key));
}
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/AdviceFileAdvice.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/AdviceFileAdvice.java
index 47932c289..02cc4ad41 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/AdviceFileAdvice.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/AdviceFileAdvice.java
@@ -11,10 +11,11 @@
package org.eclipse.equinox.p2.publisher.eclipse;
import java.io.*;
-import java.util.*;
+import java.util.Map;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils;
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
import org.eclipse.equinox.internal.p2.publisher.Activator;
import org.eclipse.equinox.internal.provisional.p2.metadata.*;
@@ -40,11 +41,11 @@ public class AdviceFileAdvice extends AbstractAdvice implements ITouchpointAdvic
private final String id;
private final Version version;
- private Map touchpointInstructions;
+ private Map<String, ITouchpointInstruction> touchpointInstructions;
private IProvidedCapability[] providedCapabilities;
private IRequirement[] requiredCapabilities;
private IRequirement[] metaRequiredCapabilities;
- private Properties iuProperties;
+ private Map<String, String> iuProperties;
private InstallableUnitDescription[] additionalIUs;
private boolean containsAdvice = false;
@@ -69,7 +70,7 @@ public class AdviceFileAdvice extends AbstractAdvice implements ITouchpointAdvic
this.id = id;
this.version = version;
- Map advice = loadAdviceMap(basePath, adviceFilePath);
+ Map<String, String> advice = loadAdviceMap(basePath, adviceFilePath);
if (advice.isEmpty())
return;
@@ -98,10 +99,10 @@ public class AdviceFileAdvice extends AbstractAdvice implements ITouchpointAdvic
/**
* Loads the advice file and returns it in map form.
*/
- private static Map loadAdviceMap(IPath basePath, IPath adviceFilePath) {
+ private static Map<String, String> loadAdviceMap(IPath basePath, IPath adviceFilePath) {
File location = basePath.toFile();
if (location == null || !location.exists())
- return Collections.EMPTY_MAP;
+ return CollectionUtils.emptyMap();
ZipFile jar = null;
InputStream stream = null;
@@ -109,25 +110,22 @@ public class AdviceFileAdvice extends AbstractAdvice implements ITouchpointAdvic
if (location.isDirectory()) {
File adviceFile = new File(location, adviceFilePath.toString());
if (!adviceFile.isFile())
- return Collections.EMPTY_MAP;
+ return CollectionUtils.emptyMap();
stream = new BufferedInputStream(new FileInputStream(adviceFile));
} else if (location.isFile()) {
jar = new ZipFile(location);
ZipEntry entry = jar.getEntry(adviceFilePath.toString());
if (entry == null)
- return Collections.EMPTY_MAP;
+ return CollectionUtils.emptyMap();
stream = new BufferedInputStream(jar.getInputStream(entry));
}
-
- Properties advice = new Properties();
- advice.load(stream);
- return (advice != null ? advice : Collections.EMPTY_MAP);
+ return CollectionUtils.loadProperties(stream);
} catch (IOException e) {
String message = "An error occured while reading advice file: basePath=" + basePath + ", adviceFilePath=" + adviceFilePath + "."; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
IStatus status = new Status(IStatus.ERROR, Activator.ID, message, e);
LogHelper.log(status);
- return Collections.EMPTY_MAP;
+ return CollectionUtils.emptyMap();
} finally {
if (stream != null)
try {
@@ -171,11 +169,11 @@ public class AdviceFileAdvice extends AbstractAdvice implements ITouchpointAdvic
return additionalIUs;
}
- public Properties getArtifactProperties(IInstallableUnit iu, IArtifactDescriptor descriptor) {
+ public Map<String, String> getArtifactProperties(IInstallableUnit iu, IArtifactDescriptor descriptor) {
return null;
}
- public Properties getInstallableUnitProperties(InstallableUnitDescription iu) {
+ public Map<String, String> getInstallableUnitProperties(InstallableUnitDescription iu) {
return iuProperties;
}
}
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/AdviceFileParser.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/AdviceFileParser.java
index 80f56b612..ad6a65236 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/AdviceFileParser.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/AdviceFileParser.java
@@ -62,31 +62,31 @@ public class AdviceFileParser {
public static final Version COMPATIBLE_VERSION = Version.createOSGi(1, 0, 0);
public static final VersionRange VERSION_TOLERANCE = new VersionRange(COMPATIBLE_VERSION, true, Version.createOSGi(2, 0, 0), false);
- private Properties adviceProperties = new Properties();
- private List adviceProvides = new ArrayList();
- private List adviceRequires = new ArrayList();
- private List adviceMetaRequires = new ArrayList();
- private Map adviceInstructions = new HashMap();
- private List adviceOtherIUs = new ArrayList();
-
- private final Map advice;
- private Iterator keysIterator;
+ private Map<String, String> adviceProperties = new HashMap<String, String>();
+ private List<IProvidedCapability> adviceProvides = new ArrayList<IProvidedCapability>();
+ private List<IRequirement> adviceRequires = new ArrayList<IRequirement>();
+ private List<IRequirement> adviceMetaRequires = new ArrayList<IRequirement>();
+ private Map<String, ITouchpointInstruction> adviceInstructions = new HashMap<String, ITouchpointInstruction>();
+ private List<InstallableUnitDescription> adviceOtherIUs = new ArrayList<InstallableUnitDescription>();
+
+ private final Map<String, String> advice;
+ private Iterator<String> keysIterator;
private String current;
// private String hostId; not currently used
private Version hostVersion;
- public AdviceFileParser(String id, Version version, Map advice) {
+ public AdviceFileParser(String id, Version version, Map<String, String> advice) {
// this.hostId = id; not currently used
this.hostVersion = version;
this.advice = advice;
}
public void parse() {
- String adviceVersion = (String) advice.get(ADVICE_VERSION);
+ String adviceVersion = advice.get(ADVICE_VERSION);
if (adviceVersion != null)
checkAdviceVersion(adviceVersion);
- List keys = new ArrayList(advice.keySet());
+ List<String> keys = new ArrayList<String>(advice.keySet());
Collections.sort(keys);
keysIterator = keys.iterator();
@@ -121,14 +121,14 @@ public class AdviceFileParser {
}
private void next() {
- current = (String) (keysIterator.hasNext() ? keysIterator.next() : null);
+ current = keysIterator.hasNext() ? keysIterator.next() : null;
}
private String currentValue() {
- return ((String) advice.get(current)).trim();
+ return advice.get(current).trim();
}
- private void parseProperties(String prefix, Map properties) {
+ private void parseProperties(String prefix, Map<String, String> properties) {
while (current != null && current.startsWith(prefix)) {
int dotIndex = current.indexOf('.', prefix.length());
if (dotIndex == -1)
@@ -138,7 +138,7 @@ public class AdviceFileParser {
}
}
- private void parseProperty(String prefix, Map properties) {
+ private void parseProperty(String prefix, Map<String, String> properties) {
String propertyName = null;
String propertyValue = null;
while (current != null && current.startsWith(prefix)) {
@@ -156,7 +156,7 @@ public class AdviceFileParser {
properties.put(propertyName, propertyValue);
}
- private void parseProvides(String prefix, List provides) {
+ private void parseProvides(String prefix, List<IProvidedCapability> provides) {
while (current != null && current.startsWith(prefix)) {
int dotIndex = current.indexOf('.', prefix.length());
if (dotIndex == -1)
@@ -166,7 +166,7 @@ public class AdviceFileParser {
}
}
- private void parseProvided(String prefix, List provides) {
+ private void parseProvided(String prefix, List<IProvidedCapability> provides) {
String namespace = null;
String name = null;
Version capabilityVersion = null;
@@ -188,7 +188,7 @@ public class AdviceFileParser {
provides.add(capability);
}
- private void parseRequires(String prefix, List requires) {
+ private void parseRequires(String prefix, List<IRequirement> requires) {
while (current != null && current.startsWith(prefix)) {
int dotIndex = current.indexOf('.', prefix.length());
if (dotIndex == -1)
@@ -198,7 +198,7 @@ public class AdviceFileParser {
}
}
- private void parseRequired(String prefix, List requires) {
+ private void parseRequired(String prefix, List<IRequirement> requires) {
String namespace = null;
String name = null;
@@ -233,7 +233,7 @@ public class AdviceFileParser {
requires.add(capability);
}
- private void parseInstructions(String prefix, Map instructions) {
+ private void parseInstructions(String prefix, Map<String, ITouchpointInstruction> instructions) {
while (current != null && current.startsWith(prefix)) {
int dotIndex = current.indexOf('.', prefix.length());
if (dotIndex != -1)
@@ -243,7 +243,7 @@ public class AdviceFileParser {
}
}
- private void parseInstruction(String prefix, Map instructions) {
+ private void parseInstruction(String prefix, Map<String, ITouchpointInstruction> instructions) {
String phase = current.substring(current.lastIndexOf('.') + 1);
String body = currentValue();
next();
@@ -262,7 +262,7 @@ public class AdviceFileParser {
instructions.put(phase, instruction);
}
- private void parseUnits(String prefix, List ius) {
+ private void parseUnits(String prefix, List<InstallableUnitDescription> ius) {
while (current != null && current.startsWith(prefix)) {
int dotIndex = current.indexOf('.', prefix.length());
if (dotIndex == -1)
@@ -272,7 +272,7 @@ public class AdviceFileParser {
}
}
- private void parseUnit(String prefix, List units) {
+ private void parseUnit(String prefix, List<InstallableUnitDescription> units) {
String unitId = null;
Version unitVersion = null;
boolean unitSingleton = false;
@@ -287,14 +287,14 @@ public class AdviceFileParser {
int unitUpdateSeverity = 0;
String unitUpdateDescription = null;
- List unitArtifacts = new ArrayList();
- Properties unitProperties = new Properties();
- List unitHostRequirements = new ArrayList();
- List unitProvides = new ArrayList();
- List unitRequires = new ArrayList();
- List unitMetaRequirements = new ArrayList();
- List unitLicenses = new ArrayList();
- Map unitInstructions = new HashMap();
+ List<IArtifactKey> unitArtifacts = new ArrayList<IArtifactKey>();
+ Map<String, String> unitProperties = new HashMap<String, String>();
+ List<IRequirement> unitHostRequirements = new ArrayList<IRequirement>();
+ List<IProvidedCapability> unitProvides = new ArrayList<IProvidedCapability>();
+ List<IRequirement> unitRequires = new ArrayList<IRequirement>();
+ List<IRequirement> unitMetaRequirements = new ArrayList<IRequirement>();
+ List<ILicense> unitLicenses = new ArrayList<ILicense>();
+ Map<String, ITouchpointInstruction> unitInstructions = new HashMap<String, ITouchpointInstruction>();
// updatedescriptor ??
while (current != null && current.startsWith(prefix)) {
@@ -377,29 +377,29 @@ public class AdviceFileParser {
description.setUpdateDescriptor(MetadataFactory.createUpdateDescriptor(unitUpdateId, unitUpdateRange, unitUpdateSeverity, unitUpdateDescription));
if (!unitLicenses.isEmpty())
- description.setLicenses((ILicense[]) unitLicenses.toArray(new ILicense[unitLicenses.size()]));
+ description.setLicenses(unitLicenses.toArray(new ILicense[unitLicenses.size()]));
if (!unitArtifacts.isEmpty())
- description.setArtifacts((IArtifactKey[]) unitArtifacts.toArray(new IArtifactKey[unitArtifacts.size()]));
+ description.setArtifacts(unitArtifacts.toArray(new IArtifactKey[unitArtifacts.size()]));
if (!unitHostRequirements.isEmpty())
- ((InstallableUnitFragmentDescription) description).setHost((IRequirement[]) unitHostRequirements.toArray(new IRequirement[unitHostRequirements.size()]));
+ ((InstallableUnitFragmentDescription) description).setHost(unitHostRequirements.toArray(new IRequirement[unitHostRequirements.size()]));
if (!unitProperties.isEmpty()) {
- for (Iterator iterator = unitProperties.entrySet().iterator(); iterator.hasNext();) {
- Entry entry = (Entry) iterator.next();
- description.setProperty((String) entry.getKey(), (String) entry.getValue());
+ for (Iterator<Entry<String, String>> iterator = unitProperties.entrySet().iterator(); iterator.hasNext();) {
+ Entry<String, String> entry = iterator.next();
+ description.setProperty(entry.getKey(), entry.getValue());
}
}
if (!unitProvides.isEmpty())
- description.setCapabilities((IProvidedCapability[]) unitProvides.toArray(new IProvidedCapability[unitProvides.size()]));
+ description.setCapabilities(unitProvides.toArray(new IProvidedCapability[unitProvides.size()]));
if (!unitRequires.isEmpty())
- description.setRequiredCapabilities((IRequirement[]) unitRequires.toArray(new IRequirement[unitRequires.size()]));
+ description.setRequiredCapabilities(unitRequires.toArray(new IRequirement[unitRequires.size()]));
if (!unitMetaRequirements.isEmpty())
- description.setMetaRequiredCapabilities((IRequirement[]) unitMetaRequirements.toArray(new IRequirement[unitMetaRequirements.size()]));
+ description.setMetaRequiredCapabilities(unitMetaRequirements.toArray(new IRequirement[unitMetaRequirements.size()]));
if (!unitInstructions.isEmpty())
description.addTouchpointData(MetadataFactory.createTouchpointData(unitInstructions));
@@ -407,7 +407,7 @@ public class AdviceFileParser {
adviceOtherIUs.add(description);
}
- private void parseLicenses(String prefix, List licenses) {
+ private void parseLicenses(String prefix, List<ILicense> licenses) {
while (current != null && current.startsWith(prefix)) {
int dotIndex = current.indexOf('.', prefix.length());
if (dotIndex != -1)
@@ -417,7 +417,7 @@ public class AdviceFileParser {
}
}
- private void parseLicense(String prefix, List licenses) {
+ private void parseLicense(String prefix, List<ILicense> licenses) {
String body = currentValue();
next();
@@ -441,7 +441,7 @@ public class AdviceFileParser {
}
}
- private void parseArtifacts(String prefix, List artifacts) {
+ private void parseArtifacts(String prefix, List<IArtifactKey> artifacts) {
while (current != null && current.startsWith(prefix)) {
int dotIndex = current.indexOf('.', prefix.length());
if (dotIndex == -1)
@@ -451,7 +451,7 @@ public class AdviceFileParser {
}
}
- private void parseArtifact(String prefix, List artifacts) {
+ private void parseArtifact(String prefix, List<IArtifactKey> artifacts) {
String artifactClassifier = null;
String artifactId = null;
Version artifactVersion = null;
@@ -516,7 +516,7 @@ public class AdviceFileParser {
return buffer.toString();
}
- public Properties getProperties() {
+ public Map<String, String> getProperties() {
if (adviceProperties.isEmpty())
return null;
return adviceProperties;
@@ -526,17 +526,17 @@ public class AdviceFileParser {
if (adviceRequires.isEmpty())
return null;
- return (IRequirement[]) adviceRequires.toArray(new IRequirement[adviceRequires.size()]);
+ return adviceRequires.toArray(new IRequirement[adviceRequires.size()]);
}
public IProvidedCapability[] getProvidedCapabilities() {
if (adviceProvides.isEmpty())
return null;
- return (IProvidedCapability[]) adviceProvides.toArray(new IProvidedCapability[adviceProvides.size()]);
+ return adviceProvides.toArray(new IProvidedCapability[adviceProvides.size()]);
}
- public Map getTouchpointInstructions() {
+ public Map<String, ITouchpointInstruction> getTouchpointInstructions() {
if (adviceInstructions.isEmpty())
return null;
@@ -547,13 +547,13 @@ public class AdviceFileParser {
if (adviceOtherIUs.isEmpty())
return null;
- return (InstallableUnitDescription[]) adviceOtherIUs.toArray(new InstallableUnitDescription[adviceOtherIUs.size()]);
+ return adviceOtherIUs.toArray(new InstallableUnitDescription[adviceOtherIUs.size()]);
}
public IRequirement[] getMetaRequiredCapabilities() {
if (adviceMetaRequires.isEmpty())
return null;
- return (IRequirement[]) adviceMetaRequires.toArray(new IRequirement[adviceMetaRequires.size()]);
+ return adviceMetaRequires.toArray(new IRequirement[adviceMetaRequires.size()]);
}
} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ApplicationLauncherAction.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ApplicationLauncherAction.java
index fe5acbcb8..12d41a045 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ApplicationLauncherAction.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ApplicationLauncherAction.java
@@ -18,6 +18,7 @@ import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory;
import org.eclipse.equinox.internal.provisional.p2.metadata.Version;
import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory.InstallableUnitDescription;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.metadata.IVersionedId;
import org.eclipse.equinox.p2.metadata.query.FragmentQuery;
import org.eclipse.equinox.p2.publisher.*;
import org.eclipse.equinox.p2.publisher.actions.VersionAdvice;
@@ -57,14 +58,14 @@ public class ApplicationLauncherAction extends AbstractPublisherAction {
public IStatus perform(IPublisherInfo publisherInfo, IPublisherResult results, IProgressMonitor monitor) {
// Create the basic actions and run them putting the IUs in a temporary result
- Collection actions = createActions(publisherInfo);
+ Collection<IPublisherAction> actions = createActions(publisherInfo);
createAdvice(publisherInfo, results);
IPublisherResult innerResult = new PublisherResult();
MultiStatus finalStatus = new MultiStatus(ApplicationLauncherAction.class.getName(), 0, "publishing result", null); //$NON-NLS-1$
- for (Iterator i = actions.iterator(); i.hasNext();) {
+ for (Iterator<IPublisherAction> i = actions.iterator(); i.hasNext();) {
if (monitor.isCanceled())
return Status.CANCEL_STATUS;
- finalStatus.merge(((IPublisherAction) i.next()).perform(publisherInfo, innerResult, monitor));
+ finalStatus.merge(i.next().perform(publisherInfo, innerResult, monitor));
}
if (!finalStatus.isOK())
return finalStatus;
@@ -86,11 +87,11 @@ public class ApplicationLauncherAction extends AbstractPublisherAction {
* fragments are in use in this particular result.
*/
private void createLauncherAdvice(IPublisherInfo publisherInfo, IPublisherResult results) {
- Collection ius = getIUs(results.getIUs(null, null), EquinoxLauncherCUAction.ORG_ECLIPSE_EQUINOX_LAUNCHER);
+ Collection<IInstallableUnit> ius = getIUs(results.getIUs(null, null), EquinoxLauncherCUAction.ORG_ECLIPSE_EQUINOX_LAUNCHER);
VersionAdvice advice = new VersionAdvice();
boolean found = false;
- for (Iterator i = ius.iterator(); i.hasNext();) {
- IInstallableUnit iu = (IInstallableUnit) i.next();
+ for (Iterator<IInstallableUnit> i = ius.iterator(); i.hasNext();) {
+ IInstallableUnit iu = i.next();
// skip over source bundles and fragments
// TODO should we use the source property here rather than magic name matching?
if (iu.getId().endsWith(".source") || FragmentQuery.isFragment(iu)) //$NON-NLS-1$
@@ -102,17 +103,17 @@ public class ApplicationLauncherAction extends AbstractPublisherAction {
publisherInfo.addAdvice(advice);
}
- private Collection getIUs(Collection ius, String prefix) {
- Set result = new HashSet();
- for (Iterator iterator = ius.iterator(); iterator.hasNext();) {
- IInstallableUnit tmp = (IInstallableUnit) iterator.next();
+ private Collection<IInstallableUnit> getIUs(Collection<IInstallableUnit> ius, String prefix) {
+ Set<IInstallableUnit> result = new HashSet<IInstallableUnit>();
+ for (Iterator<IInstallableUnit> iterator = ius.iterator(); iterator.hasNext();) {
+ IInstallableUnit tmp = iterator.next();
if (tmp.getId().startsWith(prefix))
result.add(tmp);
}
return result;
}
- private void publishApplicationLauncherIU(Collection children, IPublisherResult result) {
+ private void publishApplicationLauncherIU(Collection<? extends IVersionedId> children, IPublisherResult result) {
InstallableUnitDescription descriptor = createParentIU(children, computeIUId(id, flavor), version);
descriptor.setSingleton(true);
IInstallableUnit rootIU = MetadataFactory.createInstallableUnit(descriptor);
@@ -121,15 +122,15 @@ public class ApplicationLauncherAction extends AbstractPublisherAction {
result.addIU(rootIU, IPublisherResult.ROOT);
}
- private Collection createActions(IPublisherInfo publisherInfo) {
- Collection actions = new ArrayList();
+ private Collection<IPublisherAction> createActions(IPublisherInfo publisherInfo) {
+ Collection<IPublisherAction> actions = new ArrayList<IPublisherAction>();
actions.add(new EquinoxLauncherCUAction(flavor, configSpecs));
actions.addAll(createExecutablesActions(configSpecs));
return actions;
}
- protected Collection createExecutablesActions(String[] configs) {
- Collection actions = new ArrayList(configs.length);
+ protected Collection<IPublisherAction> createExecutablesActions(String[] configs) {
+ Collection<IPublisherAction> actions = new ArrayList<IPublisherAction>(configs.length);
for (int i = 0; i < configs.length; i++) {
ExecutablesDescriptor executables = computeExecutables(configs[i]);
IPublisherAction action = new EquinoxExecutableAction(executables, configs[i], id, version, flavor);
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/BundlesAction.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/BundlesAction.java
index 135cffbbb..4fb71ed66 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/BundlesAction.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/BundlesAction.java
@@ -12,6 +12,7 @@ package org.eclipse.equinox.p2.publisher.eclipse;
import java.io.*;
import java.util.*;
+import java.util.Map.Entry;
import java.util.jar.JarFile;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
@@ -19,6 +20,7 @@ import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
import org.eclipse.equinox.internal.p2.metadata.ArtifactKey;
+import org.eclipse.equinox.internal.p2.metadata.IRequiredCapability;
import org.eclipse.equinox.internal.p2.publisher.Activator;
import org.eclipse.equinox.internal.p2.publisher.Messages;
import org.eclipse.equinox.internal.p2.publisher.eclipse.GeneratorBundleInfo;
@@ -34,7 +36,6 @@ import org.eclipse.equinox.p2.publisher.*;
import org.eclipse.equinox.p2.publisher.actions.*;
import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
-import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor;
import org.eclipse.equinox.spi.p2.publisher.LocalizationHelper;
import org.eclipse.equinox.spi.p2.publisher.PublisherHelper;
import org.eclipse.osgi.service.pluginconversion.PluginConversionException;
@@ -123,7 +124,7 @@ public class BundlesAction extends AbstractPublisherAction {
cu.setProperty(InstallableUnitDescription.PROP_TYPE_FRAGMENT, Boolean.TRUE.toString());
cu.setCapabilities(new IProvidedCapability[] {PublisherHelper.createSelfCapability(configUnitId, cuVersion), MetadataFactory.createProvidedCapability(PublisherHelper.NAMESPACE_FLAVOR, configurationFlavor, Version.createOSGi(1, 0, 0))});
- Map touchpointData = new HashMap();
+ Map<String, String> touchpointData = new HashMap<String, String>();
touchpointData.put("install", "installBundle(bundle:${artifact})"); //$NON-NLS-1$ //$NON-NLS-2$
touchpointData.put("uninstall", "uninstallBundle(bundle:${artifact})"); //$NON-NLS-1$ //$NON-NLS-2$
touchpointData.put("configure", createConfigScript(configInfo, isBundleFragment)); //$NON-NLS-1$
@@ -134,8 +135,9 @@ public class BundlesAction extends AbstractPublisherAction {
}
public static IInstallableUnit createBundleIU(BundleDescription bd, IArtifactKey key, IPublisherInfo info) {
- Map manifest = (Map) bd.getUserObject();
- Map manifestLocalizations = null;
+ @SuppressWarnings("unchecked")
+ Map<String, String> manifest = (Map<String, String>) bd.getUserObject();
+ Map<Locale, Map<String, String>> manifestLocalizations = null;
if (manifest != null && bd.getLocation() != null)
manifestLocalizations = getManifestLocalizations(manifest, new File(bd.getLocation()));
InstallableUnitDescription iu = new MetadataFactory.InstallableUnitDescription();
@@ -152,7 +154,7 @@ public class BundlesAction extends AbstractPublisherAction {
//Process the required bundles
BundleSpecification requiredBundles[] = bd.getRequiredBundles();
- ArrayList reqsDeps = new ArrayList();
+ ArrayList<IRequiredCapability> reqsDeps = new ArrayList<IRequiredCapability>();
// if (requiresAFragment)
// reqsDeps.add(MetadataFactory.createRequiredCapability(CAPABILITY_TYPE_OSGI_FRAGMENTS, bd.getSymbolicName(), VersionRange.emptyRange, null, false, false));
if (isFragment)
@@ -172,10 +174,10 @@ public class BundlesAction extends AbstractPublisherAction {
//TODO this needs to be refined to take into account all the attribute handled by imports
reqsDeps.add(MetadataFactory.createRequiredCapability(PublisherHelper.CAPABILITY_NS_JAVA_PACKAGE, importPackageName, versionRange, null, isOptional(importSpec), false));
}
- iu.setRequiredCapabilities((IRequirement[]) reqsDeps.toArray(new IRequirement[reqsDeps.size()]));
+ iu.setRequiredCapabilities(reqsDeps.toArray(new IRequirement[reqsDeps.size()]));
// Create set of provided capabilities
- ArrayList providedCapabilities = new ArrayList();
+ ArrayList<IProvidedCapability> providedCapabilities = new ArrayList<IProvidedCapability>();
providedCapabilities.add(PublisherHelper.createSelfCapability(bd.getSymbolicName(), Version.fromOSGiVersion(bd.getVersion())));
providedCapabilities.add(MetadataFactory.createProvidedCapability(CAPABILITY_NS_OSGI_BUNDLE, bd.getSymbolicName(), Version.fromOSGiVersion(bd.getVersion())));
@@ -194,18 +196,18 @@ public class BundlesAction extends AbstractPublisherAction {
providedCapabilities.add(MetadataFactory.createProvidedCapability(CAPABILITY_NS_OSGI_FRAGMENT, bd.getHost().getName(), Version.fromOSGiVersion(bd.getVersion())));
if (manifestLocalizations != null) {
- for (Iterator iter = manifestLocalizations.keySet().iterator(); iter.hasNext();) {
- Locale locale = (Locale) iter.next();
- Properties translatedStrings = (Properties) manifestLocalizations.get(locale);
- Enumeration propertyKeys = translatedStrings.propertyNames();
- while (propertyKeys.hasMoreElements()) {
- String nextKey = (String) propertyKeys.nextElement();
- iu.setProperty(locale.toString() + '.' + nextKey, translatedStrings.getProperty(nextKey));
+ for (Iterator<Entry<Locale, Map<String, String>>> iter = manifestLocalizations.entrySet().iterator(); iter.hasNext();) {
+ Entry<Locale, Map<String, String>> locEntry = iter.next();
+ Locale locale = locEntry.getKey();
+ Map<String, String> translatedStrings = locEntry.getValue();
+ for (Iterator<Entry<String, String>> transIter = translatedStrings.entrySet().iterator(); transIter.hasNext();) {
+ Entry<String, String> entry = transIter.next();
+ iu.setProperty(locale.toString() + '.' + entry.getKey(), entry.getValue());
}
providedCapabilities.add(PublisherHelper.makeTranslationCapability(bd.getSymbolicName(), locale));
}
}
- iu.setCapabilities((IProvidedCapability[]) providedCapabilities.toArray(new IProvidedCapability[providedCapabilities.size()]));
+ iu.setCapabilities(providedCapabilities.toArray(new IProvidedCapability[providedCapabilities.size()]));
processCapabilityAdvice(iu, info);
// Set certain properties from the manifest header attributes as IU properties.
@@ -216,7 +218,7 @@ public class BundlesAction extends AbstractPublisherAction {
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]);
+ String value = manifest.get(BUNDLE_IU_PROPERTY_MAP[i]);
if (value != null && value.length() > 0) {
iu.setProperty(BUNDLE_IU_PROPERTY_MAP[i + 1], value);
}
@@ -227,7 +229,7 @@ public class BundlesAction extends AbstractPublisherAction {
// 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();
+ Map<String, String> touchpointData = new HashMap<String, String>();
touchpointData.put("manifest", toManifestString(manifest)); //$NON-NLS-1$
if (isDir(bd, info))
touchpointData.put("zipped", "true"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -248,7 +250,7 @@ public class BundlesAction extends AbstractPublisherAction {
}
private IInstallableUnitFragment createHostLocalizationFragment(IInstallableUnit bundleIU, BundleDescription bd, String hostId, String[] hostBundleManifestValues) {
- Map hostLocalizations = getHostLocalizations(new File(bd.getLocation()), hostBundleManifestValues);
+ Map<Locale, Map<String, String>> hostLocalizations = getHostLocalizations(new File(bd.getLocation()), hostBundleManifestValues);
if (hostLocalizations != null) {
return createLocalizationFragmentOfHost(bd, hostId, hostBundleManifestValues, hostLocalizations);
}
@@ -262,7 +264,7 @@ public class BundlesAction extends AbstractPublisherAction {
* @param localizedStrings
* @return installableUnitFragment
*/
- private static IInstallableUnitFragment createLocalizationFragmentOfHost(BundleDescription bd, String hostId, String[] hostManifestValues, Map hostLocalizations) {
+ private static IInstallableUnitFragment createLocalizationFragmentOfHost(BundleDescription bd, String hostId, String[] hostManifestValues, Map<Locale, Map<String, String>> hostLocalizations) {
InstallableUnitFragmentDescription fragment = new MetadataFactory.InstallableUnitFragmentDescription();
String fragmentId = makeHostLocalizationFragmentId(bd.getSymbolicName());
fragment.setId(fragmentId);
@@ -276,19 +278,18 @@ public class BundlesAction extends AbstractPublisherAction {
fragment.setProperty(InstallableUnitDescription.PROP_TYPE_FRAGMENT, Boolean.TRUE.toString());
// Create a provided capability for each locale and add the translated properties.
- ArrayList providedCapabilities = new ArrayList(hostLocalizations.keySet().size());
- for (Iterator iter = hostLocalizations.keySet().iterator(); iter.hasNext();) {
- Locale locale = (Locale) iter.next();
- Properties translatedStrings = (Properties) hostLocalizations.get(locale);
-
- Enumeration propertyKeys = translatedStrings.propertyNames();
- while (propertyKeys.hasMoreElements()) {
- String nextKey = (String) propertyKeys.nextElement();
- fragment.setProperty(locale.toString() + '.' + nextKey, translatedStrings.getProperty(nextKey));
+ ArrayList<IProvidedCapability> providedCapabilities = new ArrayList<IProvidedCapability>(hostLocalizations.keySet().size());
+ for (Iterator<Entry<Locale, Map<String, String>>> iter = hostLocalizations.entrySet().iterator(); iter.hasNext();) {
+ Entry<Locale, Map<String, String>> localeEntry = iter.next();
+ Locale locale = localeEntry.getKey();
+ Map<String, String> translatedStrings = localeEntry.getValue();
+ for (Iterator<Entry<String, String>> transItor = translatedStrings.entrySet().iterator(); transItor.hasNext();) {
+ Entry<String, String> entry = transItor.next();
+ fragment.setProperty(locale.toString() + '.' + entry.getKey(), entry.getValue());
}
providedCapabilities.add(PublisherHelper.makeTranslationCapability(hostId, locale));
}
- fragment.setCapabilities((IProvidedCapability[]) providedCapabilities.toArray(new IProvidedCapability[providedCapabilities.size()]));
+ fragment.setCapabilities(providedCapabilities.toArray(new IProvidedCapability[providedCapabilities.size()]));
return MetadataFactory.createInstallableUnitFragment(fragment);
}
@@ -339,7 +340,7 @@ public class BundlesAction extends AbstractPublisherAction {
// Create a required capability on bundles
IRequirement[] reqs = new IRequirement[] {MetadataFactory.createRequiredCapability(PublisherHelper.NAMESPACE_ECLIPSE_TYPE, TYPE_ECLIPSE_BUNDLE, VersionRange.emptyRange, null, false, true, false)};
cu.setHost(reqs);
- Map touchpointData = new HashMap();
+ Map<String, String> touchpointData = new HashMap<String, String>();
touchpointData.put("install", "installBundle(bundle:${artifact})"); //$NON-NLS-1$ //$NON-NLS-2$
touchpointData.put("uninstall", "uninstallBundle(bundle:${artifact})"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -377,13 +378,12 @@ public class BundlesAction extends AbstractPublisherAction {
return false;
}
- private static String toManifestString(Map p) {
+ private static String toManifestString(Map<String, String> 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();
+ for (Iterator<Entry<String, String>> iterator = p.entrySet().iterator(); iterator.hasNext();) {
+ Entry<String, String> aProperty = iterator.next();
if (aProperty.getKey().equals(BUNDLE_SHAPE))
continue;
result.append(aProperty.getKey()).append(": ").append(aProperty.getValue()).append('\n'); //$NON-NLS-1$
@@ -394,8 +394,8 @@ public class BundlesAction extends AbstractPublisherAction {
// Return a map from locale to property set for the manifest localizations
// from the given bundle directory and given bundle localization path/name
// manifest property value.
- private static Map getManifestLocalizations(Map manifest, File bundleLocation) {
- Map localizations;
+ private static Map<Locale, Map<String, String>> getManifestLocalizations(Map<String, String> manifest, File bundleLocation) {
+ Map<Locale, Map<String, String>> localizations;
Locale defaultLocale = null; // = Locale.ENGLISH; // TODO: get this from GeneratorInfo
String[] bundleManifestValues = getManifestCachedValues(manifest);
String bundleLocalization = bundleManifestValues[BUNDLE_LOCALIZATION_INDEX]; // Bundle localization is the last one in the list
@@ -427,10 +427,10 @@ public class BundlesAction extends AbstractPublisherAction {
return result;
}
- public static String[] getManifestCachedValues(Map manifest) {
+ public static String[] getManifestCachedValues(Map<String, String> manifest) {
String[] cachedValues = new String[PublisherHelper.BUNDLE_LOCALIZED_PROPERTIES.length];
for (int j = 0; j < PublisherHelper.BUNDLE_LOCALIZED_PROPERTIES.length; j++) {
- String value = (String) manifest.get(PublisherHelper.BUNDLE_LOCALIZED_PROPERTIES[j]);
+ String value = manifest.get(PublisherHelper.BUNDLE_LOCALIZED_PROPERTIES[j]);
if (PublisherHelper.BUNDLE_LOCALIZED_PROPERTIES[j].equals(Constants.BUNDLE_LOCALIZATION)) {
if (value == null)
value = DEFAULT_BUNDLE_LOCALIZATION;
@@ -445,8 +445,8 @@ public class BundlesAction extends AbstractPublisherAction {
// Return a map from locale to property set for the manifest localizations
// from the given bundle directory and given bundle localization path/name
// manifest property value.
- public static Map getHostLocalizations(File bundleLocation, String[] hostBundleManifestValues) {
- Map localizations;
+ public static Map<Locale, Map<String, String>> getHostLocalizations(File bundleLocation, String[] hostBundleManifestValues) {
+ Map<Locale, Map<String, String>> localizations;
Locale defaultLocale = null; // = Locale.ENGLISH; // TODO: get this from GeneratorInfo
String hostBundleLocalization = hostBundleManifestValues[BUNDLE_LOCALIZATION_INDEX];
if (hostBundleLocalization == null)
@@ -468,7 +468,7 @@ public class BundlesAction extends AbstractPublisherAction {
return (PluginConverter) ServiceHelper.getService(Activator.getContext(), PluginConverter.class.getName());
}
- private static Dictionary convertPluginManifest(File bundleLocation, boolean logConversionException) {
+ private static Dictionary<String, String> convertPluginManifest(File bundleLocation, boolean logConversionException) {
PluginConverter converter;
try {
converter = acquirePluginConverter();
@@ -492,7 +492,7 @@ public class BundlesAction extends AbstractPublisherAction {
}
}
- public static BundleDescription createBundleDescription(Dictionary enhancedManifest, File bundleLocation) {
+ public static BundleDescription createBundleDescription(Dictionary<String, String> enhancedManifest, File bundleLocation) {
try {
BundleDescription descriptor = StateObjectFactory.defaultFactory.createBundleDescription(null, enhancedManifest, bundleLocation == null ? null : bundleLocation.getAbsolutePath(), 1); //TODO Do we need to have a real bundle id
descriptor.setUserObject(enhancedManifest);
@@ -506,14 +506,14 @@ public class BundlesAction extends AbstractPublisherAction {
}
public static BundleDescription createBundleDescription(File bundleLocation) {
- Dictionary manifest = loadManifest(bundleLocation);
+ Dictionary<String, String> manifest = loadManifest(bundleLocation);
if (manifest == null)
return null;
return createBundleDescription(manifest, bundleLocation);
}
- public static Dictionary loadManifest(File bundleLocation) {
- Dictionary manifest = basicLoadManifest(bundleLocation);
+ public static Dictionary<String, String> loadManifest(File bundleLocation) {
+ Dictionary<String, String> manifest = basicLoadManifest(bundleLocation);
if (manifest == null)
return null;
// if the bundle itself does not define its shape, infer the shape from the current form
@@ -522,7 +522,7 @@ public class BundlesAction extends AbstractPublisherAction {
return manifest;
}
- public static Dictionary basicLoadManifest(File bundleLocation) {
+ public static Dictionary<String, String> basicLoadManifest(File bundleLocation) {
InputStream manifestStream = null;
ZipFile jarFile = null;
try {
@@ -541,14 +541,15 @@ public class BundlesAction extends AbstractPublisherAction {
String message = NLS.bind(Messages.exception_errorLoadingManifest, bundleLocation);
LogHelper.log(new Status(IStatus.WARNING, Activator.ID, message, e));
}
- Dictionary manifest = null;
+ Dictionary<String, String> manifest = null;
try {
if (manifestStream != null) {
try {
- Map manifestMap = ManifestElement.parseBundleManifest(manifestStream, null);
+ @SuppressWarnings("unchecked")
+ Map<String, String> manifestMap = ManifestElement.parseBundleManifest(manifestStream, null);
// TODO temporary hack. We are reading a Map but everyone wants a Dictionary so convert.
// real answer is to have people expect a Map but that is a wider change.
- manifest = new Hashtable(manifestMap);
+ manifest = new Hashtable<String, String>(manifestMap);
} catch (IOException e) {
String message = NLS.bind(Messages.exception_errorReadingManifest, bundleLocation, e.getMessage());
LogHelper.log(new Status(IStatus.ERROR, Activator.ID, message, e));
@@ -639,12 +640,12 @@ public class BundlesAction extends AbstractPublisherAction {
}
private File[] expandLocations(File[] list) {
- ArrayList result = new ArrayList();
+ ArrayList<File> result = new ArrayList<File>();
expandLocations(list, result);
- return (File[]) result.toArray(new File[result.size()]);
+ return result.toArray(new File[result.size()]);
}
- private void expandLocations(File[] list, ArrayList result) {
+ private void expandLocations(File[] list, ArrayList<File> result) {
if (list == null)
return;
for (int i = 0; i < list.length; i++) {
@@ -684,7 +685,7 @@ public class BundlesAction extends AbstractPublisherAction {
File location = new File(bd.getLocation());
IArtifactDescriptor ad = PublisherHelper.createArtifactDescriptor(info.getArtifactRepository(), key, location);
- processArtifactPropertiesAdvice(bundleIU, (ArtifactDescriptor) ad, info);
+ processArtifactPropertiesAdvice(bundleIU, ad, info);
// Publish according to the shape on disk
File bundleLocation = new File(bd.getLocation());
@@ -698,13 +699,13 @@ public class BundlesAction extends AbstractPublisherAction {
// TODO: Need a test case for multiple hosts
String hostId = bd.getHost().getName();
VersionRange hostVersionRange = VersionRange.fromOSGiVersionRange(bd.getHost().getVersionRange());
- IQueryResult hosts = queryForIUs(result, hostId, hostVersionRange);
+ IQueryResult<IInstallableUnit> hosts = queryForIUs(result, hostId, hostVersionRange);
- for (Iterator itor = hosts.iterator(); itor.hasNext();) {
+ for (Iterator<IInstallableUnit> itor = hosts.iterator(); itor.hasNext();) {
String fragmentId = makeHostLocalizationFragmentId(bd.getSymbolicName());
fragment = queryForIU(result, fragmentId, Version.fromOSGiVersion(bd.getVersion()));
if (fragment == null) {
- String[] externalizedStrings = getExternalizedStrings((IInstallableUnit) itor.next());
+ String[] externalizedStrings = getExternalizedStrings(itor.next());
fragment = createHostLocalizationFragment(bundleIU, bd, hostId, externalizedStrings);
}
}
@@ -738,17 +739,18 @@ public class BundlesAction extends AbstractPublisherAction {
}
private static boolean isDir(BundleDescription bundle, IPublisherInfo info) {
- Collection advice = info.getAdvice(null, true, bundle.getSymbolicName(), Version.fromOSGiVersion(bundle.getVersion()), IBundleShapeAdvice.class);
+ Collection<IBundleShapeAdvice> advice = info.getAdvice(null, true, bundle.getSymbolicName(), Version.fromOSGiVersion(bundle.getVersion()), IBundleShapeAdvice.class);
// if the advice has a shape, use it
if (advice != null && !advice.isEmpty()) {
// we know there is some advice but if there is more than one, take the first.
- String shape = ((IBundleShapeAdvice) advice.iterator().next()).getShape();
+ String shape = advice.iterator().next().getShape();
if (shape != null)
return shape.equals(IBundleShapeAdvice.DIR);
}
// otherwise go with whatever we figured out from the manifest or the shape on disk
- Map manifest = (Map) bundle.getUserObject();
- String format = (String) manifest.get(BUNDLE_SHAPE);
+ @SuppressWarnings("unchecked")
+ Map<String, String> manifest = (Map<String, String>) bundle.getUserObject();
+ String format = manifest.get(BUNDLE_SHAPE);
return DIR.equals(format);
}
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ConfigAdvice.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ConfigAdvice.java
index 2e25a1b97..e6a5497e8 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ConfigAdvice.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ConfigAdvice.java
@@ -9,7 +9,8 @@
******************************************************************************/
package org.eclipse.equinox.p2.publisher.eclipse;
-import java.util.Properties;
+import java.util.Map;
+import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils;
import org.eclipse.equinox.internal.provisional.frameworkadmin.BundleInfo;
import org.eclipse.equinox.internal.provisional.frameworkadmin.ConfigData;
import org.eclipse.equinox.p2.publisher.AbstractAdvice;
@@ -32,10 +33,8 @@ public class ConfigAdvice extends AbstractAdvice implements IConfigAdvice {
return configSpec;
}
- public Properties getProperties() {
- Properties result = new Properties();
- result.putAll(data.getProperties());
- return result;
+ public Map<String, String> getProperties() {
+ return CollectionUtils.toMap(data.getProperties());
}
}
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ConfigCUsAction.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ConfigCUsAction.java
index 7270d1667..2dda6257d 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ConfigCUsAction.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ConfigCUsAction.java
@@ -20,6 +20,7 @@ import org.eclipse.equinox.internal.provisional.frameworkadmin.BundleInfo;
import org.eclipse.equinox.internal.provisional.p2.metadata.*;
import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory.InstallableUnitDescription;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.metadata.IVersionedId;
import org.eclipse.equinox.p2.publisher.*;
import org.eclipse.equinox.spi.p2.publisher.PublisherHelper;
import org.eclipse.osgi.util.ManifestElement;
@@ -35,8 +36,8 @@ public class ConfigCUsAction extends AbstractPublisherAction {
protected static final String ORG_ECLIPSE_UPDATE_CONFIGURATOR = "org.eclipse.update.configurator"; //$NON-NLS-1$
protected static final String DEFAULT_START_LEVEL = "osgi.bundles.defaultStartLevel"; //$NON-NLS-1$
- private static Collection PROPERTIES_TO_SKIP;
- private static HashSet PROGRAM_ARGS_TO_SKIP;
+ private static Collection<String> PROPERTIES_TO_SKIP;
+ private static HashSet<String> PROGRAM_ARGS_TO_SKIP;
protected Version version;
protected String id;
protected String flavor;
@@ -45,7 +46,7 @@ public class ConfigCUsAction extends AbstractPublisherAction {
// TODO consider moving this filtering to the LaunchingAdvice and ConfigAdvice so
// it is not hardcoded in the action.
static {
- PROPERTIES_TO_SKIP = new HashSet();
+ PROPERTIES_TO_SKIP = new HashSet<String>();
PROPERTIES_TO_SKIP.add("osgi.frameworkClassPath"); //$NON-NLS-1$
PROPERTIES_TO_SKIP.add("osgi.framework"); //$NON-NLS-1$
PROPERTIES_TO_SKIP.add("osgi.bundles"); //$NON-NLS-1$
@@ -56,7 +57,7 @@ public class ConfigCUsAction extends AbstractPublisherAction {
PROPERTIES_TO_SKIP.add("org.eclipse.update.reconcile"); //$NON-NLS-1$
PROPERTIES_TO_SKIP.add("org.eclipse.equinox.simpleconfigurator.configUrl"); //$NON-NLS-1$
- PROGRAM_ARGS_TO_SKIP = new HashSet();
+ PROGRAM_ARGS_TO_SKIP = new HashSet<String>();
PROGRAM_ARGS_TO_SKIP.add("--launcher.library"); //$NON-NLS-1$
PROGRAM_ARGS_TO_SKIP.add("-startup"); //$NON-NLS-1$
PROGRAM_ARGS_TO_SKIP.add("-configuration"); //$NON-NLS-1$
@@ -97,11 +98,11 @@ public class ConfigCUsAction extends AbstractPublisherAction {
if (monitor.isCanceled())
return Status.CANCEL_STATUS;
String configSpec = configSpecs[i];
- Collection configAdvice = publisherInfo.getAdvice(configSpec, false, id, version, IConfigAdvice.class);
+ Collection<IConfigAdvice> configAdvice = publisherInfo.getAdvice(configSpec, false, id, version, IConfigAdvice.class);
BundleInfo[] bundles = fillInBundles(configAdvice, results);
publishBundleCUs(publisherInfo, bundles, configSpec, innerResult);
publishConfigIUs(configAdvice, innerResult, configSpec);
- Collection launchingAdvice = publisherInfo.getAdvice(configSpec, false, id, version, IExecutableAdvice.class);
+ Collection<IExecutableAdvice> launchingAdvice = publisherInfo.getAdvice(configSpec, false, id, version, IExecutableAdvice.class);
publishIniIUs(launchingAdvice, innerResult, configSpec);
}
// merge the IUs into the final result as non-roots and create a parent IU that captures them all
@@ -110,7 +111,7 @@ public class ConfigCUsAction extends AbstractPublisherAction {
return Status.OK_STATUS;
}
- private void publishTopLevelConfigurationIU(Collection children, IPublisherResult result) {
+ private void publishTopLevelConfigurationIU(Collection<? extends IVersionedId> children, IPublisherResult result) {
InstallableUnitDescription descriptor = createParentIU(children, computeIUId(id, flavor), version);
descriptor.setSingleton(true);
IInstallableUnit rootIU = MetadataFactory.createInstallableUnit(descriptor);
@@ -121,16 +122,16 @@ public class ConfigCUsAction extends AbstractPublisherAction {
// there seem to be cases where the bundle infos are not filled in with symbolic name and version.
// fill in the missing data.
- private BundleInfo[] fillInBundles(Collection configAdvice, IPublisherResult results) {
- ArrayList result = new ArrayList();
- for (Iterator j = configAdvice.iterator(); j.hasNext();) {
- IConfigAdvice advice = (IConfigAdvice) j.next();
+ private BundleInfo[] fillInBundles(Collection<IConfigAdvice> configAdvice, IPublisherResult results) {
+ ArrayList<BundleInfo> result = new ArrayList<BundleInfo>();
+ for (Iterator<IConfigAdvice> j = configAdvice.iterator(); j.hasNext();) {
+ IConfigAdvice advice = j.next();
int defaultStart = BundleInfo.NO_LEVEL;
- Properties adviceProperties = advice.getProperties();
+ Map<String, String> adviceProperties = advice.getProperties();
if (adviceProperties.containsKey(DEFAULT_START_LEVEL)) {
try {
- defaultStart = Integer.parseInt((String) adviceProperties.get(DEFAULT_START_LEVEL));
+ defaultStart = Integer.parseInt(adviceProperties.get(DEFAULT_START_LEVEL));
} catch (NumberFormatException e) {
//don't know default
}
@@ -150,13 +151,13 @@ public class ConfigCUsAction extends AbstractPublisherAction {
else {
try {
File location = new File(bundleInfo.getLocation());
- Dictionary manifest = BundlesAction.loadManifest(location);
+ Dictionary<String, String> manifest = BundlesAction.loadManifest(location);
if (manifest == null)
continue;
GeneratorBundleInfo newInfo = new GeneratorBundleInfo(bundleInfo);
- ManifestElement[] element = ManifestElement.parseHeader("dummy-bsn", (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME)); //$NON-NLS-1$
+ ManifestElement[] element = ManifestElement.parseHeader("dummy-bsn", manifest.get(Constants.BUNDLE_SYMBOLICNAME)); //$NON-NLS-1$
newInfo.setSymbolicName(element[0].getValue());
- newInfo.setVersion((String) manifest.get(Constants.BUNDLE_VERSION));
+ newInfo.setVersion(manifest.get(Constants.BUNDLE_VERSION));
result.add(newInfo);
} catch (BundleException e) {
// TODO Auto-generated catch block
@@ -165,13 +166,13 @@ public class ConfigCUsAction extends AbstractPublisherAction {
}
}
}
- return (BundleInfo[]) result.toArray(new BundleInfo[result.size()]);
+ return result.toArray(new BundleInfo[result.size()]);
}
/**
* Publish the IUs that capture the eclipse.ini information such as vmargs and program args, etc
*/
- private void publishIniIUs(Collection launchingAdvice, IPublisherResult results, String configSpec) {
+ private void publishIniIUs(Collection<IExecutableAdvice> launchingAdvice, IPublisherResult results, String configSpec) {
if (launchingAdvice.isEmpty())
return;
@@ -186,7 +187,7 @@ public class ConfigCUsAction extends AbstractPublisherAction {
if (configureData.length() == 0 && unconfigureData.length() == 0)
return;
- Map touchpointData = new HashMap();
+ Map<String, String> touchpointData = new HashMap<String, String>();
touchpointData.put("configure", configureData); //$NON-NLS-1$
touchpointData.put("unconfigure", unconfigureData); //$NON-NLS-1$
IInstallableUnit cu = createCU(id, version, "ini", flavor, configSpec, touchpointData); //$NON-NLS-1$
@@ -196,7 +197,7 @@ public class ConfigCUsAction extends AbstractPublisherAction {
/**
* Publish the IUs that capture the config.ini information such as properties etc
*/
- private void publishConfigIUs(Collection configAdvice, IPublisherResult results, String configSpec) {
+ private void publishConfigIUs(Collection<IConfigAdvice> configAdvice, IPublisherResult results, String configSpec) {
if (configAdvice.isEmpty())
return;
@@ -211,7 +212,7 @@ public class ConfigCUsAction extends AbstractPublisherAction {
if (configureData.length() == 0 && unconfigureData.length() == 0)
return;
- Map touchpointData = new HashMap();
+ Map<String, String> touchpointData = new HashMap<String, String>();
touchpointData.put("configure", configureData); //$NON-NLS-1$
touchpointData.put("unconfigure", unconfigureData); //$NON-NLS-1$
IInstallableUnit cu = createCU(id, version, "config", flavor, configSpec, touchpointData); //$NON-NLS-1$
@@ -224,7 +225,7 @@ public class ConfigCUsAction extends AbstractPublisherAction {
* with the name id.type and the given version. This allows others to create an abstract
* dependency on having one of these things around but not having to list out the configs.
*/
- private IInstallableUnit createCU(String id, Version version, String type, String flavor, String configSpec, Map touchpointData) {
+ private IInstallableUnit createCU(String id, Version version, String type, String flavor, String configSpec, Map<String, String> touchpointData) {
InstallableUnitDescription cu = new InstallableUnitDescription();
String resultId = createCUIdString(id, type, flavor, configSpec);
cu.setId(resultId);
@@ -240,18 +241,18 @@ public class ConfigCUsAction extends AbstractPublisherAction {
return MetadataFactory.createInstallableUnit(cu);
}
- protected String[] getConfigurationStrings(Collection configAdvice) {
+ protected String[] getConfigurationStrings(Collection<IConfigAdvice> configAdvice) {
String configurationData = ""; //$NON-NLS-1$
String unconfigurationData = ""; //$NON-NLS-1$
- Set properties = new HashSet();
- for (Iterator i = configAdvice.iterator(); i.hasNext();) {
- IConfigAdvice advice = (IConfigAdvice) i.next();
- for (Iterator iterator = advice.getProperties().entrySet().iterator(); iterator.hasNext();) {
- Entry aProperty = (Entry) iterator.next();
- String key = ((String) aProperty.getKey());
+ Set<String> properties = new HashSet<String>();
+ for (Iterator<IConfigAdvice> i = configAdvice.iterator(); i.hasNext();) {
+ IConfigAdvice advice = i.next();
+ for (Iterator<Entry<String, String>> iterator = advice.getProperties().entrySet().iterator(); iterator.hasNext();) {
+ Entry<String, String> aProperty = iterator.next();
+ String key = aProperty.getKey();
if (shouldPublishProperty(key) && !properties.contains(key)) {
properties.add(key);
- configurationData += "setProgramProperty(propName:" + key + ", propValue:" + ((String) aProperty.getValue()) + ");"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ configurationData += "setProgramProperty(propName:" + key + ", propValue:" + aProperty.getValue() + ");"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
unconfigurationData += "setProgramProperty(propName:" + key + ", propValue:);"; //$NON-NLS-1$ //$NON-NLS-2$
}
}
@@ -271,14 +272,14 @@ public class ConfigCUsAction extends AbstractPublisherAction {
return !PROGRAM_ARGS_TO_SKIP.contains(key);
}
- protected String[] getLauncherConfigStrings(Collection launchingAdvice) {
+ protected String[] getLauncherConfigStrings(Collection<IExecutableAdvice> launchingAdvice) {
String configurationData = ""; //$NON-NLS-1$
String unconfigurationData = ""; //$NON-NLS-1$
- Set jvmSet = new HashSet();
- Set programSet = new HashSet();
- for (Iterator j = launchingAdvice.iterator(); j.hasNext();) {
- IExecutableAdvice advice = (IExecutableAdvice) j.next();
+ Set<String> jvmSet = new HashSet<String>();
+ Set<String> programSet = new HashSet<String>();
+ for (Iterator<IExecutableAdvice> j = launchingAdvice.iterator(); j.hasNext();) {
+ IExecutableAdvice advice = j.next();
String[] jvmArgs = advice.getVMArguments();
for (int i = 0; i < jvmArgs.length; i++)
if (shouldPublishJvmArg(jvmArgs[i]) && !jvmSet.contains(jvmArgs[i])) {
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/EclipseInstallAction.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/EclipseInstallAction.java
index bcfa72c84..345252f37 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/EclipseInstallAction.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/EclipseInstallAction.java
@@ -63,7 +63,7 @@ public class EclipseInstallAction extends AbstractPublisherAction {
protected IPublisherAction[] createActions() {
createAdvice();
- ArrayList actions = new ArrayList();
+ ArrayList<IPublisherAction> actions = new ArrayList<IPublisherAction>();
// create an action that just publishes the raw bundles and features
IPublisherAction action = new MergeResultsAction(new IPublisherAction[] {createFeaturesAction(), createBundlesAction()}, IPublisherResult.MERGE_ALL_NON_ROOT);
actions.add(action);
@@ -74,7 +74,7 @@ public class EclipseInstallAction extends AbstractPublisherAction {
actions.add(createConfigCUsAction());
actions.add(createDefaultCUsAction());
actions.add(createRootIUAction());
- return (IPublisherAction[]) actions.toArray(new IPublisherAction[actions.size()]);
+ return actions.toArray(new IPublisherAction[actions.size()]);
}
private void createAdvice() {
@@ -96,7 +96,7 @@ public class EclipseInstallAction extends AbstractPublisherAction {
return new RootIUAction(id, version, name);
}
- protected Collection getTopLevel() {
+ protected Collection<IVersionedId> getTopLevel() {
return Arrays.asList(topLevel);
}
@@ -108,8 +108,8 @@ public class EclipseInstallAction extends AbstractPublisherAction {
return new ApplicationLauncherAction(id, version, flavor, executableName, getExecutablesLocation(), configSpecs);
}
- protected Collection createAccumulateConfigDataActions(String[] configs) {
- Collection result = new ArrayList(configs.length);
+ protected Collection<IPublisherAction> createAccumulateConfigDataActions(String[] configs) {
+ Collection<IPublisherAction> result = new ArrayList<IPublisherAction>(configs.length);
for (int i = 0; i < configs.length; i++) {
String configSpec = configs[i];
File configuration = computeConfigurationLocation(configSpec);
@@ -133,8 +133,8 @@ public class EclipseInstallAction extends AbstractPublisherAction {
return new FeaturesAction(new File[] {new File(source, "features")}); //$NON-NLS-1$
}
- protected Collection createExecutablesActions(String[] configSpecs) {
- Collection result = new ArrayList(configSpecs.length);
+ protected Collection<IPublisherAction> createExecutablesActions(String[] configSpecs) {
+ Collection<IPublisherAction> result = new ArrayList<IPublisherAction>(configSpecs.length);
for (int i = 0; i < configSpecs.length; i++) {
ExecutablesDescriptor executables = computeExecutables(configSpecs[i]);
IPublisherAction action = new EquinoxExecutableAction(executables, configSpecs[i], id, version, flavor);
@@ -175,7 +175,7 @@ public class EclipseInstallAction extends AbstractPublisherAction {
protected File[] computeRootFileExclusions() {
if (nonRootFiles == null || nonRootFiles.length == 0)
return null;
- ArrayList result = new ArrayList();
+ ArrayList<File> result = new ArrayList<File>();
for (int i = 0; i < nonRootFiles.length; i++) {
String filename = nonRootFiles[i];
File file = new File(filename);
@@ -184,7 +184,7 @@ public class EclipseInstallAction extends AbstractPublisherAction {
else
result.add(new File(source, filename));
}
- return (File[]) result.toArray(new File[result.size()]);
+ return result.toArray(new File[result.size()]);
}
protected ExecutablesDescriptor computeExecutables(String configSpec) {
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/EquinoxExecutableAction.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/EquinoxExecutableAction.java
index 4407ba6cb..919289bcb 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/EquinoxExecutableAction.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/EquinoxExecutableAction.java
@@ -89,7 +89,7 @@ public class EquinoxExecutableAction extends AbstractPublisherAction {
String filter = createFilterSpec(configSpec);
if (filter.length() > 0)
iud.setFilter(filter);
- Map touchpointData = new HashMap();
+ Map<String, String> touchpointData = new HashMap<String, String>();
touchpointData.put("configure", "setLauncherName(name:" + executableName + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
touchpointData.put("unconfigure", "setLauncherName()"); //$NON-NLS-1$ //$NON-NLS-2$
iud.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData));
@@ -155,14 +155,14 @@ public class EquinoxExecutableAction extends AbstractPublisherAction {
cu.setTouchpointType(PublisherHelper.TOUCHPOINT_NATIVE);
String[] config = parseConfigSpec(configSpec);
String os = config[1];
- Map touchpointData = computeInstallActions(execDescriptor, os);
+ Map<String, String> touchpointData = computeInstallActions(execDescriptor, os);
cu.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData));
IInstallableUnit unit = MetadataFactory.createInstallableUnit(cu);
result.addIU(unit, IPublisherResult.ROOT);
}
- private Map computeInstallActions(ExecutablesDescriptor execDescriptor, String os) {
- Map touchpointData = new HashMap();
+ private Map<String, String> computeInstallActions(ExecutablesDescriptor execDescriptor, String os) {
+ Map<String, String> touchpointData = new HashMap<String, String>();
String configurationData = "unzip(source:@artifact, target:${installFolder});"; //$NON-NLS-1$
if (Constants.OS_MACOSX.equals(os)) {
String execName = execDescriptor.getExecutableName();
@@ -201,9 +201,9 @@ public class EquinoxExecutableAction extends AbstractPublisherAction {
private IBrandingAdvice getBrandingAdvice() {
// there is expected to only be one branding advice for a given configspec so
// just return the first one we find.
- Collection advice = info.getAdvice(configSpec, true, null, null, IBrandingAdvice.class);
- for (Iterator i = advice.iterator(); i.hasNext();)
- return (IBrandingAdvice) i.next();
+ Collection<IBrandingAdvice> advice = info.getAdvice(configSpec, true, null, null, IBrandingAdvice.class);
+ for (Iterator<IBrandingAdvice> i = advice.iterator(); i.hasNext();)
+ return i.next();
return null;
}
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/EquinoxLauncherCUAction.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/EquinoxLauncherCUAction.java
index 6c8e97ed6..1805a98f1 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/EquinoxLauncherCUAction.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/EquinoxLauncherCUAction.java
@@ -65,9 +65,9 @@ public class EquinoxLauncherCUAction extends AbstractPublisherAction {
* configure it in as the launcher.library for this configuration.
*/
private void publishCU(String id, String configSpec, IPublisherResult results) {
- Collection advice = info.getAdvice(configSpec, true, id, null, IVersionAdvice.class);
- for (Iterator j = advice.iterator(); j.hasNext();) {
- IVersionAdvice versionSpec = (IVersionAdvice) j.next();
+ Collection<IVersionAdvice> advice = info.getAdvice(configSpec, true, id, null, IVersionAdvice.class);
+ for (Iterator<IVersionAdvice> j = advice.iterator(); j.hasNext();) {
+ IVersionAdvice versionSpec = j.next();
Version version = versionSpec.getVersion(IInstallableUnit.NAMESPACE_IU_ID, id);
if (version == null)
continue;
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/Feature.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/Feature.java
index 844505056..b57f0eafa 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/Feature.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/Feature.java
@@ -10,8 +10,7 @@
*******************************************************************************/
package org.eclipse.equinox.p2.publisher.eclipse;
-import java.util.ArrayList;
-import java.util.Map;
+import java.util.*;
/**
*
@@ -38,9 +37,9 @@ public class Feature {
private String installHandlerLibrary;
private URLEntry updateSite;
- private ArrayList discoverySites;
+ private ArrayList<URLEntry> discoverySites;
- private ArrayList entries;
+ private ArrayList<FeatureEntry> entries;
private String providerName;
private String os;
private String ws;
@@ -49,7 +48,7 @@ public class Feature {
private String location;
- private Map localizations;
+ private Map<Locale, Map<String, String>> localizations;
public Feature(String id, String version) {
if (id == null)
@@ -63,7 +62,7 @@ public class Feature {
return;
if (this.discoverySites == null)
- this.discoverySites = new ArrayList();
+ this.discoverySites = new ArrayList<URLEntry>();
URLEntry entry = new URLEntry(url, siteLabel);
this.discoverySites.add(entry);
@@ -71,7 +70,7 @@ public class Feature {
public void addEntry(FeatureEntry plugin) {
if (entries == null)
- entries = new ArrayList();
+ entries = new ArrayList<FeatureEntry>();
entries.add(plugin);
}
@@ -114,13 +113,13 @@ public class Feature {
public URLEntry[] getDiscoverySites() {
if (discoverySites == null)
return new URLEntry[0];
- return (URLEntry[]) discoverySites.toArray(new URLEntry[discoverySites.size()]);
+ return discoverySites.toArray(new URLEntry[discoverySites.size()]);
}
public FeatureEntry[] getEntries() {
if (entries == null)
return new FeatureEntry[0];
- return (FeatureEntry[]) entries.toArray(new FeatureEntry[entries.size()]);
+ return entries.toArray(new FeatureEntry[entries.size()]);
}
public String getId() {
@@ -159,7 +158,7 @@ public class Feature {
return null;
}
- public Map getLocalizations() {
+ public Map<Locale, Map<String, String>> getLocalizations() {
return this.localizations;
}
@@ -278,7 +277,7 @@ public class Feature {
this.license.setURL(licenseURL);
}
- public void setLocalizations(Map localizations) {
+ public void setLocalizations(Map<Locale, Map<String, String>> localizations) {
this.localizations = localizations;
}
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/FeaturesAction.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/FeaturesAction.java
index a191709fe..6c78cb381 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/FeaturesAction.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/FeaturesAction.java
@@ -14,13 +14,14 @@ import java.io.File;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.*;
+import java.util.Map.Entry;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.core.helpers.FileUtils;
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
import org.eclipse.equinox.internal.p2.core.helpers.FileUtils.IPathComputer;
-import org.eclipse.equinox.internal.p2.metadata.ArtifactKey;
-import org.eclipse.equinox.internal.p2.metadata.LDAPQuery;
+import org.eclipse.equinox.internal.p2.metadata.*;
import org.eclipse.equinox.internal.p2.publisher.*;
+import org.eclipse.equinox.internal.p2.publisher.Messages;
import org.eclipse.equinox.internal.p2.publisher.eclipse.FeatureParser;
import org.eclipse.equinox.internal.provisional.p2.metadata.*;
import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory.InstallableUnitDescription;
@@ -98,7 +99,7 @@ public class FeaturesAction extends AbstractPublisherAction {
iu.setProperty(PublisherHelper.ECLIPSE_INSTALL_HANDLER_PROP, installHandlerProperty);
}
- ArrayList providedCapabilities = new ArrayList();
+ ArrayList<IProvidedCapability> providedCapabilities = new ArrayList<IProvidedCapability>();
providedCapabilities.add(PublisherHelper.createSelfCapability(id, version));
providedCapabilities.add(PublisherHelper.FEATURE_CAPABILITY);
providedCapabilities.add(MetadataFactory.createProvidedCapability(PublisherHelper.CAPABILITY_NS_UPDATE_FEATURE, feature.getId(), version));
@@ -106,19 +107,19 @@ public class FeaturesAction extends AbstractPublisherAction {
iu.setCapabilities(new IProvidedCapability[] {PublisherHelper.createSelfCapability(id, version), PublisherHelper.FEATURE_CAPABILITY, MetadataFactory.createProvidedCapability(PublisherHelper.CAPABILITY_NS_UPDATE_FEATURE, feature.getId(), version)});
iu.setArtifacts(new IArtifactKey[] {createFeatureArtifactKey(feature.getId(), version.toString())});
- Map touchpointData = new HashMap();
+ Map<String, String> touchpointData = new HashMap<String, String>();
touchpointData.put("zipped", "true"); //$NON-NLS-1$ //$NON-NLS-2$
iu.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData));
- Map localizations = feature.getLocalizations();
+ Map<Locale, Map<String, String>> localizations = feature.getLocalizations();
if (localizations != null) {
- for (Iterator iter = localizations.keySet().iterator(); iter.hasNext();) {
- Locale locale = (Locale) iter.next();
- Properties translatedStrings = (Properties) localizations.get(locale);
- Enumeration propertyKeys = translatedStrings.propertyNames();
- while (propertyKeys.hasMoreElements()) {
- String nextKey = (String) propertyKeys.nextElement();
- iu.setProperty(locale.toString() + '.' + nextKey, translatedStrings.getProperty(nextKey));
+ for (Iterator<Entry<Locale, Map<String, String>>> iter = localizations.entrySet().iterator(); iter.hasNext();) {
+ Entry<Locale, Map<String, String>> locEntry = iter.next();
+ Locale locale = locEntry.getKey();
+ Map<String, String> translatedStrings = locEntry.getValue();
+ for (Iterator<Entry<String, String>> transIter = translatedStrings.entrySet().iterator(); transIter.hasNext();) {
+ Entry<String, String> entry = transIter.next();
+ iu.setProperty(locale.toString() + '.' + entry.getKey(), entry.getValue());
}
providedCapabilities.add(PublisherHelper.makeTranslationCapability(id, locale));
}
@@ -197,7 +198,7 @@ public class FeaturesAction extends AbstractPublisherAction {
if (configSpec != null && configSpec.length() > 0)
iu.setFilter(createFilterSpec(configSpec));
- Map touchpointData = new HashMap(2);
+ Map<String, String> touchpointData = new HashMap<String, String>(2);
String configurationData = "unzip(source:@artifact, target:${installFolder});"; //$NON-NLS-1$
touchpointData.put("install", configurationData); //$NON-NLS-1$
String unConfigurationData = "cleanupzip(source:@artifact, target:${installFolder});"; //$NON-NLS-1$
@@ -215,7 +216,7 @@ public class FeaturesAction extends AbstractPublisherAction {
return iuResult;
}
- protected IInstallableUnit createGroupIU(Feature feature, List childIUs, IPublisherInfo publisherInfo) {
+ protected IInstallableUnit createGroupIU(Feature feature, List<IInstallableUnit> childIUs, IPublisherInfo publisherInfo) {
if (isPatch(feature))
return createPatchIU(feature, childIUs, publisherInfo);
InstallableUnitDescription iu = new MetadataFactory.InstallableUnitDescription();
@@ -238,7 +239,7 @@ public class FeaturesAction extends AbstractPublisherAction {
iu.setUpdateDescriptor(MetadataFactory.createUpdateDescriptor(id, BundlesAction.computeUpdateRange(new org.osgi.framework.Version(feature.getVersion())), IUpdateDescriptor.NORMAL, null));
FeatureEntry entries[] = feature.getEntries();
- List required = new ArrayList(entries.length + (childIUs == null ? 0 : childIUs.size()));
+ List<IRequiredCapability> required = new ArrayList<IRequiredCapability>(entries.length + (childIUs == null ? 0 : childIUs.size()));
for (int i = 0; i < entries.length; i++) {
VersionRange range = getVersionRange(entries[i]);
String requiredId = getTransformedId(entries[i].getId(), entries[i].isPlugin(), /*isGroup*/true);
@@ -249,12 +250,12 @@ public class FeaturesAction extends AbstractPublisherAction {
// TODO consider if these should be linked as exact version numbers. Should be ok but may be brittle.
if (childIUs != null) {
for (int i = 0; i < childIUs.size(); i++) {
- IInstallableUnit child = (IInstallableUnit) childIUs.get(i);
+ IInstallableUnit child = childIUs.get(i);
String filter = (child.getFilter() instanceof LDAPQuery) ? ((LDAPQuery) child.getFilter()).getFilter() : null;
required.add(MetadataFactory.createRequiredCapability(PublisherHelper.IU_NAMESPACE, child.getId(), new VersionRange(child.getVersion(), true, child.getVersion(), true), filter, false, false));
}
}
- iu.setRequiredCapabilities((IRequirement[]) required.toArray(new IRequirement[required.size()]));
+ iu.setRequiredCapabilities(required.toArray(new IRequirement[required.size()]));
iu.setTouchpointType(ITouchpointType.NONE);
iu.setProperty(InstallableUnitDescription.PROP_TYPE_GROUP, Boolean.TRUE.toString());
processTouchpointAdvice(iu, null, publisherInfo);
@@ -268,24 +269,24 @@ public class FeaturesAction extends AbstractPublisherAction {
iu.setFilter(filter);
// Create set of provided capabilities
- ArrayList providedCapabilities = new ArrayList();
+ ArrayList<IProvidedCapability> providedCapabilities = new ArrayList<IProvidedCapability>();
providedCapabilities.add(createSelfCapability(id, version));
- Map localizations = feature.getLocalizations();
+ Map<Locale, Map<String, String>> localizations = feature.getLocalizations();
if (localizations != null) {
- for (Iterator iter = localizations.keySet().iterator(); iter.hasNext();) {
- Locale locale = (Locale) iter.next();
- Properties translatedStrings = (Properties) localizations.get(locale);
- Enumeration propertyKeys = translatedStrings.propertyNames();
- while (propertyKeys.hasMoreElements()) {
- String nextKey = (String) propertyKeys.nextElement();
- iu.setProperty(locale.toString() + '.' + nextKey, translatedStrings.getProperty(nextKey));
+ for (Iterator<Entry<Locale, Map<String, String>>> iter = localizations.entrySet().iterator(); iter.hasNext();) {
+ Entry<Locale, Map<String, String>> locEntry = iter.next();
+ Locale locale = locEntry.getKey();
+ Map<String, String> translatedStrings = locEntry.getValue();
+ for (Iterator<Entry<String, String>> transIter = translatedStrings.entrySet().iterator(); transIter.hasNext();) {
+ Entry<String, String> e = transIter.next();
+ iu.setProperty(locale.toString() + '.' + e.getKey(), e.getValue());
}
providedCapabilities.add(PublisherHelper.makeTranslationCapability(id, locale));
}
}
- iu.setCapabilities((IProvidedCapability[]) providedCapabilities.toArray(new IProvidedCapability[providedCapabilities.size()]));
+ iu.setCapabilities(providedCapabilities.toArray(new IProvidedCapability[providedCapabilities.size()]));
processCapabilityAdvice(iu, publisherInfo);
return MetadataFactory.createInstallableUnit(iu);
}
@@ -294,7 +295,7 @@ public class FeaturesAction extends AbstractPublisherAction {
return getTransformedId(featureId, /*isPlugin*/false, /*isGroup*/true);
}
- private IInstallableUnit createPatchIU(Feature feature, List childIUs, IPublisherInfo publisherInfo) {
+ private IInstallableUnit createPatchIU(Feature feature, List<IInstallableUnit> childIUs, IPublisherInfo publisherInfo) {
InstallableUnitPatchDescription iu = new MetadataFactory.InstallableUnitPatchDescription();
String id = getTransformedId(feature.getId(), /*isPlugin*/false, /*isGroup*/true);
iu.setId(id);
@@ -314,9 +315,9 @@ public class FeaturesAction extends AbstractPublisherAction {
iu.setUpdateDescriptor(MetadataFactory.createUpdateDescriptor(id, BundlesAction.computeUpdateRange(new org.osgi.framework.Version(feature.getVersion())), IUpdateDescriptor.NORMAL, null));
FeatureEntry entries[] = feature.getEntries();
- ArrayList applicabilityScope = new ArrayList();
- ArrayList patchRequirements = new ArrayList();
- ArrayList requirementChanges = new ArrayList();
+ ArrayList<IRequirement> applicabilityScope = new ArrayList<IRequirement>();
+ ArrayList<IRequirement> patchRequirements = new ArrayList<IRequirement>();
+ ArrayList<IRequirementChange> requirementChanges = new ArrayList<IRequirementChange>();
for (int i = 0; i < entries.length; i++) {
VersionRange range = getVersionRange(entries[i]);
IRequirement req = MetadataFactory.createRequiredCapability(IInstallableUnit.NAMESPACE_IU_ID, getTransformedId(entries[i].getId(), entries[i].isPlugin(), /*isGroup*/true), range, getFilter(entries[i]), entries[i].isOptional(), false);
@@ -338,13 +339,13 @@ public class FeaturesAction extends AbstractPublisherAction {
//Always add a requirement on the IU containing the feature jar
if (childIUs != null) {
for (int i = 0; i < childIUs.size(); i++) {
- IInstallableUnit child = (IInstallableUnit) childIUs.get(i);
+ IInstallableUnit child = childIUs.get(i);
patchRequirements.add(MetadataFactory.createRequiredCapability(PublisherHelper.IU_NAMESPACE, child.getId(), new VersionRange(child.getVersion(), true, child.getVersion(), true), child.getFilter() == null ? null : ((LDAPQuery) child.getFilter()).getFilter(), false, false));
}
}
- iu.setRequiredCapabilities((IRequirement[]) patchRequirements.toArray(new IRequirement[patchRequirements.size()]));
- iu.setApplicabilityScope(new IRequirement[][] {(IRequirement[]) applicabilityScope.toArray(new IRequirement[applicabilityScope.size()])});
- iu.setRequirementChanges((IRequirementChange[]) requirementChanges.toArray(new IRequirementChange[requirementChanges.size()]));
+ iu.setRequiredCapabilities(patchRequirements.toArray(new IRequirement[patchRequirements.size()]));
+ iu.setApplicabilityScope(new IRequirement[][] {applicabilityScope.toArray(new IRequirement[applicabilityScope.size()])});
+ iu.setRequirementChanges(requirementChanges.toArray(new IRequirementChange[requirementChanges.size()]));
iu.setTouchpointType(ITouchpointType.NONE);
processTouchpointAdvice(iu, null, publisherInfo);
@@ -356,35 +357,35 @@ public class FeaturesAction extends AbstractPublisherAction {
// iu.setFilter(filter);
// Create set of provided capabilities
- ArrayList providedCapabilities = new ArrayList();
+ ArrayList<IProvidedCapability> providedCapabilities = new ArrayList<IProvidedCapability>();
providedCapabilities.add(createSelfCapability(id, version));
- Map localizations = feature.getLocalizations();
+ Map<Locale, Map<String, String>> localizations = feature.getLocalizations();
if (localizations != null) {
- for (Iterator iter = localizations.keySet().iterator(); iter.hasNext();) {
- Locale locale = (Locale) iter.next();
- Properties translatedStrings = (Properties) localizations.get(locale);
- Enumeration propertyKeys = translatedStrings.propertyNames();
- while (propertyKeys.hasMoreElements()) {
- String nextKey = (String) propertyKeys.nextElement();
- iu.setProperty(locale.toString() + '.' + nextKey, translatedStrings.getProperty(nextKey));
+ for (Iterator<Entry<Locale, Map<String, String>>> iter = localizations.entrySet().iterator(); iter.hasNext();) {
+ Entry<Locale, Map<String, String>> locEntry = iter.next();
+ Locale locale = locEntry.getKey();
+ Map<String, String> translatedStrings = locEntry.getValue();
+ for (Iterator<Entry<String, String>> transIter = translatedStrings.entrySet().iterator(); transIter.hasNext();) {
+ Entry<String, String> e = transIter.next();
+ iu.setProperty(locale.toString() + '.' + e.getKey(), e.getValue());
}
providedCapabilities.add(PublisherHelper.makeTranslationCapability(id, locale));
}
}
- iu.setCapabilities((IProvidedCapability[]) providedCapabilities.toArray(new IProvidedCapability[providedCapabilities.size()]));
+ iu.setCapabilities(providedCapabilities.toArray(new IProvidedCapability[providedCapabilities.size()]));
processCapabilityAdvice(iu, publisherInfo);
return MetadataFactory.createInstallableUnitPatch(iu);
}
private File[] expandLocations(File[] list) {
- ArrayList result = new ArrayList();
+ ArrayList<File> result = new ArrayList<File>();
expandLocations(list, result);
- return (File[]) result.toArray(new File[result.size()]);
+ return result.toArray(new File[result.size()]);
}
- private void expandLocations(File[] list, ArrayList result) {
+ private void expandLocations(File[] list, ArrayList<File> result) {
if (list == null)
return;
for (int i = 0; i < list.length; i++) {
@@ -409,7 +410,7 @@ public class FeaturesAction extends AbstractPublisherAction {
createBundleShapeAdvice(feature, info);
createAdviceFileAdvice(feature, info);
- ArrayList childIUs = new ArrayList();
+ ArrayList<IInstallableUnit> childIUs = new ArrayList<IInstallableUnit>();
IInstallableUnit featureJarIU = queryForIU(result, getTransformedId(feature.getId(), false, false), Version.parseVersion(feature.getVersion()));
if (featureJarIU == null)
@@ -441,14 +442,14 @@ public class FeaturesAction extends AbstractPublisherAction {
return createFeatureJarIU(feature, publisherInfo);
}
- protected ArrayList generateRootFileIUs(Feature feature, IPublisherResult result, IPublisherInfo publisherInfo) {
- ArrayList ius = new ArrayList();
+ protected ArrayList<IInstallableUnit> generateRootFileIUs(Feature feature, IPublisherResult result, IPublisherInfo publisherInfo) {
+ ArrayList<IInstallableUnit> ius = new ArrayList<IInstallableUnit>();
- Collection collection = publisherInfo.getAdvice(null, false, feature.getId(), Version.parseVersion(feature.getVersion()), IFeatureRootAdvice.class);
+ Collection<IFeatureRootAdvice> collection = publisherInfo.getAdvice(null, false, feature.getId(), Version.parseVersion(feature.getVersion()), IFeatureRootAdvice.class);
if (collection.size() == 0)
return ius;
- IFeatureRootAdvice advice = (IFeatureRootAdvice) collection.iterator().next();
+ IFeatureRootAdvice advice = collection.iterator().next();
String[] configs = advice.getConfigurations();
for (int i = 0; i < configs.length; i++) {
String config = configs[i];
@@ -458,7 +459,7 @@ public class FeaturesAction extends AbstractPublisherAction {
IInstallableUnit iu = createFeatureRootFileIU(feature.getId(), feature.getVersion(), null, descriptor);
File[] files = descriptor.getFiles();
- IArtifactKey artifactKey = iu.getArtifacts()[0];
+ IArtifactKey artifactKey = iu.getArtifacts().get(0);
ArtifactDescriptor artifactDescriptor = new ArtifactDescriptor(artifactKey);
IPathComputer computer = advice.getRootFileComputer(config);
if (computer == null)
@@ -510,7 +511,7 @@ public class FeaturesAction extends AbstractPublisherAction {
}
protected Feature[] getFeatures(File[] featureLocations) {
- ArrayList result = new ArrayList(featureLocations.length);
+ ArrayList<Feature> result = new ArrayList<Feature>(featureLocations.length);
for (int i = 0; i < featureLocations.length; i++) {
Feature feature = new FeatureParser().parse(featureLocations[i]);
if (feature != null) {
@@ -518,7 +519,7 @@ public class FeaturesAction extends AbstractPublisherAction {
result.add(feature);
}
}
- return (Feature[]) result.toArray(new Feature[result.size()]);
+ return result.toArray(new Feature[result.size()]);
}
private String getFilter(FeatureEntry entry) {
@@ -605,10 +606,10 @@ public class FeaturesAction extends AbstractPublisherAction {
// TODO this is a little strange. If there are several artifacts, how do we know which files go with
// which artifacts when we publish them? For now it would be surprising to have more than one
// artifact per feature IU.
- IArtifactKey[] artifacts = featureIU.getArtifacts();
- for (int j = 0; j < artifacts.length; j++) {
+ List<IArtifactKey> artifacts = featureIU.getArtifacts();
+ for (int j = 0; j < artifacts.size(); j++) {
File file = new File(feature.getLocation());
- ArtifactDescriptor ad = (ArtifactDescriptor) PublisherHelper.createArtifactDescriptor(info.getArtifactRepository(), artifacts[j], file);
+ ArtifactDescriptor ad = (ArtifactDescriptor) PublisherHelper.createArtifactDescriptor(info.getArtifactRepository(), artifacts.get(j), file);
processArtifactPropertiesAdvice(featureIU, ad, publisherInfo);
ad.setProperty(IArtifactDescriptor.DOWNLOAD_CONTENTTYPE, IArtifactDescriptor.TYPE_ZIP);
// if the artifact is a dir then zip it up.
@@ -637,7 +638,7 @@ public class FeaturesAction extends AbstractPublisherAction {
}
if (linkActions.length() > 0) {
- Map touchpointData = new HashMap();
+ Map<String, String> touchpointData = new HashMap<String, String>();
//we do ln during configure to avoid complicating branding which uses the install phase
touchpointData.put("configure", linkActions.toString()); //$NON-NLS-1$
iu.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData));
@@ -645,7 +646,7 @@ public class FeaturesAction extends AbstractPublisherAction {
}
private void setupPermissions(InstallableUnitDescription iu, FileSetDescriptor descriptor) {
- Map touchpointData = new HashMap();
+ Map<String, String> touchpointData = new HashMap<String, String>();
String[][] permsList = descriptor.getPermissions();
for (int i = 0; i < permsList.length; i++) {
String[] permSpec = permsList[i];
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/FeaturesAndBundlesPublisherApplication.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/FeaturesAndBundlesPublisherApplication.java
index a58f5f0a0..f838580dc 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/FeaturesAndBundlesPublisherApplication.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/FeaturesAndBundlesPublisherApplication.java
@@ -52,13 +52,13 @@ public class FeaturesAndBundlesPublisherApplication extends AbstractPublisherApp
}
protected IPublisherAction[] createActions() {
- ArrayList result = new ArrayList();
+ ArrayList<IPublisherAction> result = new ArrayList<IPublisherAction>();
if (features == null)
features = new File[] {new File(source, "features")}; //$NON-NLS-1$
result.add(new FeaturesAction(features));
if (bundles == null)
bundles = new File[] {new File(source, "plugins")}; //$NON-NLS-1$
result.add(new BundlesAction(bundles));
- return (IPublisherAction[]) result.toArray(new IPublisherAction[result.size()]);
+ return result.toArray(new IPublisherAction[result.size()]);
}
}
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/IBrandingAdvice.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/IBrandingAdvice.java
index 3e92dc84c..6f4952079 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/IBrandingAdvice.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/IBrandingAdvice.java
@@ -9,10 +9,12 @@
******************************************************************************/
package org.eclipse.equinox.p2.publisher.eclipse;
+import org.eclipse.equinox.p2.publisher.IPublisherAdvice;
+
/**
* Advice for branding executables and other element while publishing.
*/
-public interface IBrandingAdvice {
+public interface IBrandingAdvice extends IPublisherAdvice {
/**
* Returns the OS that this branding advice is relevant for.
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/IConfigAdvice.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/IConfigAdvice.java
index 5e673ea92..a8826d153 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/IConfigAdvice.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/IConfigAdvice.java
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.equinox.p2.publisher.eclipse;
-import java.util.Properties;
+import java.util.Map;
import org.eclipse.equinox.internal.provisional.frameworkadmin.BundleInfo;
import org.eclipse.equinox.p2.publisher.IPublisherAdvice;
@@ -17,5 +17,5 @@ public interface IConfigAdvice extends IPublisherAdvice {
public BundleInfo[] getBundles();
- public Properties getProperties();
+ public Map<String, String> getProperties();
}
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/InstallPublisherApplication.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/InstallPublisherApplication.java
index 3330abc6f..ececbc8c1 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/InstallPublisherApplication.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/InstallPublisherApplication.java
@@ -10,6 +10,8 @@
******************************************************************************/
package org.eclipse.equinox.p2.publisher.eclipse;
+import org.eclipse.equinox.p2.publisher.IPublisherAction;
+
import java.net.URISyntaxException;
import java.util.ArrayList;
import org.eclipse.equinox.internal.provisional.p2.metadata.Version;
@@ -73,9 +75,9 @@ public class InstallPublisherApplication extends AbstractPublisherApplication {
}
protected IPublisherAction[] createActions() {
- ArrayList result = new ArrayList();
+ ArrayList<IPublisherAction> result = new ArrayList<IPublisherAction>();
result.add(createEclipseInstallAction());
- return (IPublisherAction[]) result.toArray(new IPublisherAction[result.size()]);
+ return result.toArray(new IPublisherAction[result.size()]);
}
private IPublisherAction createEclipseInstallAction() {
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ProductAction.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ProductAction.java
index 60bb7419d..05e24cd01 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ProductAction.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ProductAction.java
@@ -48,7 +48,7 @@ public class ProductAction extends AbstractPublisherAction {
createAdvice();
// create all the actions needed to publish a product
- ArrayList actions = new ArrayList();
+ ArrayList<IPublisherAction> actions = new ArrayList<IPublisherAction>();
// products include the executable so add actions to publish them
if (getExecutablesLocation() != null)
actions.add(createApplicationExecutableAction(info.getConfigurations()));
@@ -57,7 +57,7 @@ public class ProductAction extends AbstractPublisherAction {
actions.add(createJREAction());
actions.add(createDefaultCUsAction());
actions.add(createRootIUAction());
- return (IPublisherAction[]) actions.toArray(new IPublisherAction[actions.size()]);
+ return actions.toArray(new IPublisherAction[actions.size()]);
}
protected IPublisherAction createApplicationExecutableAction(String[] configSpecs) {
@@ -120,7 +120,7 @@ public class ProductAction extends AbstractPublisherAction {
}
private void createRootAdvice() {
- Collection list;
+ Collection<IVersionedId> list;
if (product.useFeatures())
// TODO: We need a real namespace here
list = versionElements(listElements(product.getFeatures(), ".feature.group"), IInstallableUnit.NAMESPACE_IU_ID); //$NON-NLS-1$
@@ -142,16 +142,16 @@ public class ProductAction extends AbstractPublisherAction {
info.addAdvice(new ProductFileAdvice(product, configSpecs[i]));
}
- private Collection versionElements(Collection elements, String namespace) {
- Collection versionAdvice = info.getAdvice(null, true, null, null, IVersionAdvice.class);
- List result = new ArrayList();
- for (Iterator i = elements.iterator(); i.hasNext();) {
- IVersionedId element = (IVersionedId) i.next();
+ private Collection<IVersionedId> versionElements(Collection<IVersionedId> elements, String namespace) {
+ Collection<IVersionAdvice> versionAdvice = info.getAdvice(null, true, null, null, IVersionAdvice.class);
+ List<IVersionedId> result = new ArrayList<IVersionedId>();
+ for (Iterator<IVersionedId> i = elements.iterator(); i.hasNext();) {
+ IVersionedId element = i.next();
Version elementVersion = element.getVersion();
if (elementVersion == null || Version.emptyVersion.equals(elementVersion)) {
- Iterator advice = versionAdvice.iterator();
+ Iterator<IVersionAdvice> advice = versionAdvice.iterator();
while (advice.hasNext()) {
- elementVersion = ((IVersionAdvice) advice.next()).getVersion(namespace, element.getId());
+ elementVersion = advice.next().getVersion(namespace, element.getId());
break;
}
}
@@ -170,12 +170,12 @@ public class ProductAction extends AbstractPublisherAction {
return result;
}
- private Collection listElements(List elements, String suffix) {
+ private Collection<IVersionedId> listElements(List<IVersionedId> elements, String suffix) {
if (suffix == null || suffix.length() == 0)
return elements;
- ArrayList result = new ArrayList(elements.size());
- for (Iterator i = elements.iterator(); i.hasNext();) {
- IVersionedId elementName = (IVersionedId) i.next();
+ ArrayList<IVersionedId> result = new ArrayList<IVersionedId>(elements.size());
+ for (Iterator<IVersionedId> i = elements.iterator(); i.hasNext();) {
+ IVersionedId elementName = i.next();
result.add(new VersionedId(elementName.getId() + suffix, elementName.getVersion()));
}
return result;
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ProductFileAdvice.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ProductFileAdvice.java
index 90513e438..5b2cb2b73 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ProductFileAdvice.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ProductFileAdvice.java
@@ -13,6 +13,7 @@ package org.eclipse.equinox.p2.publisher.eclipse;
import java.io.File;
import java.util.*;
+import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils;
import org.eclipse.equinox.internal.p2.publisher.eclipse.DataLoader;
import org.eclipse.equinox.internal.p2.publisher.eclipse.IProductDescriptor;
import org.eclipse.equinox.internal.provisional.frameworkadmin.BundleInfo;
@@ -102,9 +103,9 @@ public class ProductFileAdvice extends AbstractAdvice implements ILicenseAdvice,
* properties may be defined in the .product file, the config.ini
* file, or both.
*/
- public Properties getProperties() {
- Properties result = new Properties();
- result.putAll(configData.getProperties());
+ public Map<String, String> getProperties() {
+ Map<String, String> result = new HashMap<String, String>();
+ CollectionUtils.putAll(configData.getProperties(), result);
result.putAll(product.getConfigurationProperties());
return result;
}
@@ -186,8 +187,8 @@ public class ProductFileAdvice extends AbstractAdvice implements ILicenseAdvice,
}
private void addProductFileConfigBundles(ConfigData data) {
- Set versionBoundBundles = new HashSet();
- Map unboundedBundles = new HashMap();
+ Set<BundleInfo> versionBoundBundles = new HashSet<BundleInfo>();
+ Map<String, List<BundleInfo>> unboundedBundles = new HashMap<String, List<BundleInfo>>();
BundleInfo[] bundles = data.getBundles();
for (int i = 0; i < bundles.length; i++) {
@@ -203,13 +204,13 @@ public class ProductFileAdvice extends AbstractAdvice implements ILicenseAdvice,
}
}
- List bundleInfos = product.getBundleInfos();
- for (Iterator i = bundleInfos.iterator(); i.hasNext();) {
+ List<BundleInfo> bundleInfos = product.getBundleInfos();
+ for (Iterator<BundleInfo> i = bundleInfos.iterator(); i.hasNext();) {
// For each bundle that has configuration information, if the bundle is in the
// bundles bound by version, add the "configured" bundle instead
// If the bundle is not bound to a version, then replace all bounded versions
// with this one. Otherwise, just add this one (don't replace)
- BundleInfo bundleInfo = (BundleInfo) i.next();
+ BundleInfo bundleInfo = i.next();
if (versionBoundBundles.contains(bundleInfo)) {
// If we found a version with the same name and version, replace it with the "configured" bundle
@@ -217,12 +218,12 @@ public class ProductFileAdvice extends AbstractAdvice implements ILicenseAdvice,
data.addBundle(bundleInfo);
} else if (bundleInfo.getVersion() == null || bundleInfo.getVersion().equals("0.0.0")) {//$NON-NLS-1$
// If we don't have a version number, look for all bundles that match by name
- List list = (List) unboundedBundles.get(bundleInfo.getSymbolicName());
+ List<BundleInfo> list = unboundedBundles.get(bundleInfo.getSymbolicName());
if (list == null)
data.addBundle(bundleInfo);
else
- for (Iterator iterator = list.iterator(); iterator.hasNext();) {
- BundleInfo target = (BundleInfo) iterator.next();
+ for (Iterator<BundleInfo> iterator = list.iterator(); iterator.hasNext();) {
+ BundleInfo target = iterator.next();
target.setStartLevel(bundleInfo.getStartLevel());
target.setMarkedAsStarted(bundleInfo.isMarkedAsStarted());
}
@@ -234,19 +235,19 @@ public class ProductFileAdvice extends AbstractAdvice implements ILicenseAdvice,
}
}
- private void addUnboundedBundle(Map data, BundleInfo bundleInfo) {
+ private void addUnboundedBundle(Map<String, List<BundleInfo>> data, BundleInfo bundleInfo) {
if (!data.containsKey(bundleInfo.getSymbolicName()))
- data.put(bundleInfo.getSymbolicName(), new LinkedList());
- ((LinkedList) data.get(bundleInfo.getSymbolicName())).add(bundleInfo);
+ data.put(bundleInfo.getSymbolicName(), new LinkedList<BundleInfo>());
+ data.get(bundleInfo.getSymbolicName()).add(bundleInfo);
}
private void addProductFileBundles(ConfigData data) {
- List bundles = product.getBundles(true);
- Set set = new HashSet();
+ List<IVersionedId> bundles = product.getBundles(true);
+ Set<BundleInfo> set = new HashSet<BundleInfo>();
set.addAll(Arrays.asList(data.getBundles()));
- for (Iterator i = bundles.iterator(); i.hasNext();) {
- IVersionedId vid = (IVersionedId) i.next();
+ for (Iterator<IVersionedId> i = bundles.iterator(); i.hasNext();) {
+ IVersionedId vid = i.next();
BundleInfo bundleInfo = new BundleInfo();
bundleInfo.setSymbolicName(vid.getId());
bundleInfo.setVersion(vid.getVersion().toString());
@@ -262,9 +263,9 @@ public class ProductFileAdvice extends AbstractAdvice implements ILicenseAdvice,
// Add all the bundles here. We replace / update them later
// if we find configuration information
- List bundles = product.getBundles(true);
- for (Iterator i = bundles.iterator(); i.hasNext();) {
- IVersionedId vid = (IVersionedId) i.next();
+ List<IVersionedId> bundles = product.getBundles(true);
+ for (Iterator<IVersionedId> i = bundles.iterator(); i.hasNext();) {
+ IVersionedId vid = i.next();
BundleInfo bundleInfo = new BundleInfo();
bundleInfo.setSymbolicName(vid.getId());
bundleInfo.setVersion(vid.getVersion().toString());
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ProductPublisherApplication.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ProductPublisherApplication.java
index 1f96c5c02..10641e5c5 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ProductPublisherApplication.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ProductPublisherApplication.java
@@ -10,6 +10,8 @@
******************************************************************************/
package org.eclipse.equinox.p2.publisher.eclipse;
+import org.eclipse.equinox.p2.publisher.IPublisherAction;
+
import java.io.File;
import java.net.URISyntaxException;
import java.util.ArrayList;
@@ -28,9 +30,9 @@ public class ProductPublisherApplication extends AbstractPublisherApplication {
}
protected IPublisherAction[] createActions() {
- ArrayList result = new ArrayList();
+ ArrayList<IPublisherAction> result = new ArrayList<IPublisherAction>();
result.add(createProductAction());
- return (IPublisherAction[]) result.toArray(new IPublisherAction[result.size()]);
+ return result.toArray(new IPublisherAction[result.size()]);
}
private IPublisherAction createProductAction() {
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/spi/p2/publisher/LocalizationHelper.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/spi/p2/publisher/LocalizationHelper.java
index 4dcf75669..c05b73206 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/spi/p2/publisher/LocalizationHelper.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/spi/p2/publisher/LocalizationHelper.java
@@ -16,6 +16,7 @@ import java.net.URLConnection;
import java.util.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
+import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils;
/**
* Helper functions supporting the processing of localized
@@ -56,23 +57,23 @@ public final class LocalizationHelper {
// For the given root directory and path to localization files within that directory
// get a map from locale to property set for the localization property files.
- public static Map getDirPropertyLocalizations(File root, String localizationPath, Locale defaultLocale, String[] propertyKeys) {
+ public static Map<Locale, Map<String, String>> getDirPropertyLocalizations(File root, String localizationPath, Locale defaultLocale, String[] propertyKeys) {
File fullPath = new File(root, localizationPath);
File localizationDir = fullPath.getParentFile();
final String localizationFile = fullPath.getName();
String[] localizationFiles = LocalizationHelper.getLocalizationFiles(localizationDir, localizationFile);
- HashMap localizations = null;
+ HashMap<Locale, Map<String, String>> localizations = null;
if (localizationFiles != null) {
- localizations = new HashMap(localizationFiles.length);
+ localizations = new HashMap<Locale, Map<String, String>>(localizationFiles.length);
for (int i = 0; i < localizationFiles.length; i++) {
String nextFile = localizationFiles[i];
Locale nextLocale = getLocale(LocalizationHelper.getLocaleString(nextFile, localizationFile));
try {
- Properties properties = loadProperties(root, nextFile);
- Properties localizedStrings = getLocalizedProperties(propertyKeys, properties);
+ Map<String, String> properties = loadProperties(root, nextFile);
+ Map<String, String> localizedStrings = getLocalizedProperties(propertyKeys, properties);
if (localizedStrings.size() > 0) {
localizations.put(nextLocale, localizedStrings);
if (DEFAULT_LOCALE.equals(nextLocale) && defaultLocale != null) {
@@ -88,13 +89,13 @@ public final class LocalizationHelper {
return localizations;
}
- public static Map getJarPropertyLocalizations(File root, String localizationPath, Locale defaultLocale, String[] propertyKeys) {
+ public static Map<Locale, Map<String, String>> getJarPropertyLocalizations(File root, String localizationPath, Locale defaultLocale, String[] propertyKeys) {
ZipFile jarFile = null;
- Map localizations = new HashMap(4);
+ Map<Locale, Map<String, String>> localizations = new HashMap<Locale, Map<String, String>>(4);
try {
jarFile = new ZipFile(root, ZipFile.OPEN_READ);
- for (Enumeration entries = jarFile.entries(); entries.hasMoreElements();) {
- ZipEntry nextEntry = (ZipEntry) entries.nextElement();
+ for (Enumeration<? extends ZipEntry> entries = jarFile.entries(); entries.hasMoreElements();) {
+ ZipEntry nextEntry = entries.nextElement();
String nextName = nextEntry.getName();
String localeString = LocalizationHelper.getLocaleString(nextName, localizationPath);
@@ -103,9 +104,8 @@ public final class LocalizationHelper {
InputStream stream = null;
try {
stream = jarFile.getInputStream(nextEntry);
- Properties properties = new Properties();
- properties.load(stream);
- Properties localizedStrings = LocalizationHelper.getLocalizedProperties(propertyKeys, properties);
+ Map<String, String> properties = CollectionUtils.loadProperties(stream);
+ Map<String, String> localizedStrings = LocalizationHelper.getLocalizedProperties(propertyKeys, properties);
if (localizedStrings.size() > 0) {
localizations.put(nextLocale, localizedStrings);
if (DEFAULT_LOCALE.equals(nextLocale) && defaultLocale != null) {
@@ -134,8 +134,7 @@ public final class LocalizationHelper {
}
// Load a property set from given root and file with the given name
- private static Properties loadProperties(File root, String propertyFilename) throws IOException {
- Properties result = new Properties();
+ private static Map<String, String> loadProperties(File root, String propertyFilename) throws IOException {
InputStream propertyStream = null;
try {
try {
@@ -148,24 +147,23 @@ public final class LocalizationHelper {
}
} catch (FileNotFoundException e) {
// if there is no messages file then just return;
- return result;
+ return CollectionUtils.emptyMap();
}
- result.load(propertyStream);
+ return CollectionUtils.loadProperties(propertyStream);
} finally {
if (propertyStream != null)
propertyStream.close();
}
- return result;
}
// Given a list of keys and the corresponding localized property set,
// return a new property set with those keys and the localized values.
- static public Properties getLocalizedProperties(String[] propertyKeys, Properties properties) {
- Properties localizedProperties = new Properties();
+ static public Map<String, String> getLocalizedProperties(String[] propertyKeys, Map<String, String> properties) {
+ Map<String, String> localizedProperties = new HashMap<String, String>();
for (int i = 0; i < propertyKeys.length; i++) {
String key = propertyKeys[i];
if (key != null) {
- String localizedValue = properties.getProperty(key);
+ String localizedValue = properties.get(key);
if (localizedValue != null)
localizedProperties.put(key, localizedValue);
}
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/spi/p2/publisher/PublisherHelper.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/spi/p2/publisher/PublisherHelper.java
index 503e388de..27010c29f 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/spi/p2/publisher/PublisherHelper.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/spi/p2/publisher/PublisherHelper.java
@@ -16,6 +16,7 @@ import java.io.*;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.*;
+import java.util.Map.Entry;
import org.eclipse.equinox.internal.p2.metadata.ArtifactKey;
import org.eclipse.equinox.internal.p2.metadata.InstallableUnit;
import org.eclipse.equinox.internal.provisional.p2.metadata.*;
@@ -169,7 +170,7 @@ public class PublisherHelper {
cu.setHost(reqs);
cu.setFilter(INSTALL_FEATURES_FILTER);
- Map touchpointData = new HashMap();
+ Map<String, String> touchpointData = new HashMap<String, String>();
touchpointData.put("install", "installFeature(feature:${artifact},featureId:default,featureVersion:default)"); //$NON-NLS-1$//$NON-NLS-2$
touchpointData.put("uninstall", "uninstallFeature(feature:${artifact},featureId:default,featureVersion:default)"); //$NON-NLS-1$//$NON-NLS-2$
cu.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData));
@@ -191,7 +192,7 @@ public class PublisherHelper {
// Create a required capability on source providers
IRequirement[] reqs = new IRequirement[] {MetadataFactory.createRequiredCapability(NAMESPACE_ECLIPSE_TYPE, TYPE_ECLIPSE_SOURCE, VersionRange.emptyRange, null, true, true, false)};
cu.setHost(reqs);
- Map touchpointData = new HashMap();
+ Map<String, String> touchpointData = new HashMap<String, String>();
touchpointData.put("install", "addSourceBundle(bundle:${artifact})"); //$NON-NLS-1$ //$NON-NLS-2$
touchpointData.put("uninstall", "removeSourceBundle(bundle:${artifact})"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -199,26 +200,26 @@ public class PublisherHelper {
return MetadataFactory.createInstallableUnit(cu);
}
- private static void addExtraProperties(IInstallableUnit iiu, Properties extraProperties) {
+ private static void addExtraProperties(IInstallableUnit iiu, Map<String, String> extraProperties) {
if (iiu instanceof InstallableUnit) {
InstallableUnit iu = (InstallableUnit) iiu;
- for (Enumeration e = extraProperties.propertyNames(); e.hasMoreElements();) {
- String name = (String) e.nextElement();
- iu.setProperty(name, extraProperties.getProperty(name));
+ for (Iterator<Entry<String, String>> iter = extraProperties.entrySet().iterator(); iter.hasNext();) {
+ Entry<String, String> entry = iter.next();
+ iu.setProperty(entry.getKey(), entry.getValue());
}
}
}
- public static IInstallableUnit[] createEclipseIU(BundleDescription bd, boolean isFolderPlugin, IArtifactKey key, Properties extraProperties) {
- ArrayList iusCreated = new ArrayList(1);
+ public static IInstallableUnit[] createEclipseIU(BundleDescription bd, boolean isFolderPlugin, IArtifactKey key, Map<String, String> extraProperties) {
+ ArrayList<IInstallableUnit> iusCreated = new ArrayList<IInstallableUnit>(1);
IPublisherInfo info = new PublisherInfo();
String shape = isFolderPlugin ? IBundleShapeAdvice.DIR : IBundleShapeAdvice.JAR;
info.addAdvice(new BundleShapeAdvice(bd.getSymbolicName(), Version.fromOSGiVersion(bd.getVersion()), shape));
IInstallableUnit iu = BundlesAction.createBundleIU(bd, key, info);
addExtraProperties(iu, extraProperties);
iusCreated.add(iu);
- return (IInstallableUnit[]) (iusCreated.toArray(new IInstallableUnit[iusCreated.size()]));
+ return (iusCreated.toArray(new IInstallableUnit[iusCreated.size()]));
}
public static ArtifactKey createBinaryArtifactKey(String id, Version version) {
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/AbstractPublishTask.java b/bundles/org.eclipse.equinox.p2.publisher/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/AbstractPublishTask.java
index 989716458..c2edc0716 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/AbstractPublishTask.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/AbstractPublishTask.java
@@ -85,7 +85,7 @@ public abstract class AbstractPublishTask extends Task {
protected URI artifactLocation;
protected String artifactRepoName;
protected PublisherInfo provider = null;
- protected List contextRepositories = new ArrayList();
+ protected List<RepoEntry> contextRepositories = new ArrayList<RepoEntry>();
protected IProvisioningAgent getProvisioningAgent() {
return (IProvisioningAgent) ServiceHelper.getService(Activator.context, IProvisioningAgent.SERVICE_NAME);
@@ -108,8 +108,8 @@ public abstract class AbstractPublishTask extends Task {
CompositeMetadataRepository contextMetadata = CompositeMetadataRepository.createMemoryComposite(getProvisioningAgent());
CompositeArtifactRepository contextArtifact = CompositeArtifactRepository.createMemoryComposite(getProvisioningAgent());
- for (Iterator iterator = contextRepositories.iterator(); iterator.hasNext();) {
- RepoEntry entry = (RepoEntry) iterator.next();
+ for (Iterator<RepoEntry> iterator = contextRepositories.iterator(); iterator.hasNext();) {
+ RepoEntry entry = iterator.next();
if (contextMetadata != null && entry.isMetadataRepository())
contextMetadata.addChild(entry.getRepositoryLocation());
if (contextArtifact != null && entry.isArtifactRepository())
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/FeaturesAndBundlesPublisherTask.java b/bundles/org.eclipse.equinox.p2.publisher/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/FeaturesAndBundlesPublisherTask.java
index bd276c160..344b94a3b 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/FeaturesAndBundlesPublisherTask.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/FeaturesAndBundlesPublisherTask.java
@@ -21,8 +21,8 @@ import org.eclipse.equinox.p2.publisher.eclipse.BundlesAction;
import org.eclipse.equinox.p2.publisher.eclipse.FeaturesAction;
public class FeaturesAndBundlesPublisherTask extends AbstractPublishTask {
- private ArrayList features = new ArrayList();
- private ArrayList bundles = new ArrayList();
+ private ArrayList<Object> features = new ArrayList<Object>();
+ private ArrayList<Object> bundles = new ArrayList<Object>();
public void execute() throws BuildException {
try {
@@ -34,19 +34,19 @@ public class FeaturesAndBundlesPublisherTask extends AbstractPublishTask {
File[] f = getLocations(features);
File[] b = getLocations(bundles);
- ArrayList actions = new ArrayList();
+ ArrayList<IPublisherAction> actions = new ArrayList<IPublisherAction>();
if (f.length > 0)
actions.add(new FeaturesAction(f));
if (b.length > 0)
actions.add(new BundlesAction(b));
if (actions.size() > 0)
- new Publisher(getInfo()).publish((IPublisherAction[]) actions.toArray(new IPublisherAction[actions.size()]), new NullProgressMonitor());
+ new Publisher(getInfo()).publish(actions.toArray(new IPublisherAction[actions.size()]), new NullProgressMonitor());
}
- private File[] getLocations(List collection) {
- ArrayList results = new ArrayList();
- for (Iterator iterator = collection.iterator(); iterator.hasNext();) {
+ private File[] getLocations(List<Object> collection) {
+ ArrayList<Object> results = new ArrayList<Object>();
+ for (Iterator<Object> iterator = collection.iterator(); iterator.hasNext();) {
Object obj = iterator.next();
if (obj instanceof FileSet) {
FileSet set = (FileSet) obj;
@@ -62,7 +62,7 @@ public class FeaturesAndBundlesPublisherTask extends AbstractPublishTask {
results.add(obj);
}
}
- return (File[]) results.toArray(new File[results.size()]);
+ return results.toArray(new File[results.size()]);
}
public FileSet createFeatures() {
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/ProductPublisherTask.java b/bundles/org.eclipse.equinox.p2.publisher/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/ProductPublisherTask.java
index 79ce8a789..58b2119cf 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/ProductPublisherTask.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/ProductPublisherTask.java
@@ -61,8 +61,8 @@ public class ProductPublisherTask extends AbstractPublishTask {
private String productFile;
private String executables;
private String source;
- private List configurations = new ArrayList(3);
- private List advice = new ArrayList(3);
+ private List<ConfigElement> configurations = new ArrayList<ConfigElement>(3);
+ private List<AdviceElement> advice = new ArrayList<AdviceElement>(3);
public void execute() throws BuildException {
try {
@@ -99,8 +99,8 @@ public class ProductPublisherTask extends AbstractPublishTask {
}
protected void processAdvice(PublisherInfo info) {
- for (Iterator iterator = advice.iterator(); iterator.hasNext();) {
- AdviceElement element = (AdviceElement) iterator.next();
+ for (Iterator<AdviceElement> iterator = advice.iterator(); iterator.hasNext();) {
+ AdviceElement element = iterator.next();
if (element.kind == null || element.file == null)
continue;
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/.classpath b/bundles/org.eclipse.equinox.p2.repository.tools/.classpath
index 75116d75c..834ea833e 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/.classpath
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <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.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" output="bin_ant" path="src_ant"/>
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.repository.tools/.settings/org.eclipse.jdt.core.prefs
index ec3a85149..81133f856 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,4 @@
-#Fri Dec 04 17:47:22 EST 2009
+#Mon Dec 28 06:58:36 CET 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
org.eclipse.jdt.core.builder.duplicateResourceTask=warning
@@ -7,17 +7,17 @@ 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.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.compliance=1.5
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.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
org.eclipse.jdt.core.compiler.problem.deadCode=warning
@@ -26,7 +26,7 @@ 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.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
@@ -89,7 +89,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enab
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.compiler.source=1.5
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
@@ -161,7 +161,6 @@ 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
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.repository.tools/META-INF/MANIFEST.MF
index 30434d6c8..db68f4dc9 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/META-INF/MANIFEST.MF
@@ -5,8 +5,9 @@ Bundle-SymbolicName: org.eclipse.equinox.p2.repository.tools;singleton:=true
Bundle-Version: 1.0.100.qualifier
Bundle-Activator: org.eclipse.equinox.p2.internal.repository.tools.Activator
Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
- J2SE-1.4
+Bundle-RequiredExecutionEnvironment: J2SE-1.5,
+ J2SE-1.4,
+ CDC-1.1/Foundation-1.1
Import-Package: org.eclipse.core.runtime;version="3.4.0",
org.eclipse.equinox.app;version="1.0.0",
org.eclipse.equinox.internal.p2.artifact.repository,
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/build.properties b/bundles/org.eclipse.equinox.p2.repository.tools/build.properties
index a1a83243a..9062e527a 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/build.properties
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/build.properties
@@ -24,3 +24,5 @@ jars.extra.classpath=platform:/plugin/org.apache.ant/lib/ant.jar,\
platform:/plugin/org.eclipse.equinox.p2.jarprocessor/lib/jarprocessor-ant.jar,\
platform:/plugin/org.eclipse.equinox.p2.artifact.repository/ant_tasks/artifactRepository-ant.jar
src.includes = about.html
+javacTarget=jsr14
+javacSource=1.5
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/Disassembler.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/Disassembler.java
index f96d48823..b02209751 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/Disassembler.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/Disassembler.java
@@ -1040,10 +1040,8 @@ public class Disassembler {
private void disassembleTypeMembers(ClassFileReader classFileReader, char[] className, StringBuffer buffer, String lineSeparator, int tabNumber, int mode, boolean isEnum) {
FieldInfo[] fields = classFileReader.getFieldInfos();
// sort fields
- Arrays.sort(fields, new Comparator() {
- public int compare(Object o1, Object o2) {
- FieldInfo fieldInfo1 = (FieldInfo) o1;
- FieldInfo fieldInfo2 = (FieldInfo) o2;
+ Arrays.sort(fields, new Comparator<FieldInfo>() {
+ public int compare(FieldInfo fieldInfo1, FieldInfo fieldInfo2) {
int compare = new String(fieldInfo1.getName()).compareTo(new String(fieldInfo2.getName()));
if (compare == 0) {
return new String(fieldInfo1.getDescriptor()).compareTo(new String(fieldInfo2.getDescriptor()));
@@ -1057,10 +1055,8 @@ public class Disassembler {
}
MethodInfo[] methods = classFileReader.getMethodInfos();
// sort methods
- Arrays.sort(methods, new Comparator() {
- public int compare(Object o1, Object o2) {
- MethodInfo methodInfo1 = (MethodInfo) o1;
- MethodInfo methodInfo2 = (MethodInfo) o2;
+ Arrays.sort(methods, new Comparator<MethodInfo>() {
+ public int compare(MethodInfo methodInfo1, MethodInfo methodInfo2) {
int compare = new String(methodInfo1.getName()).compareTo(new String(methodInfo2.getName()));
if (compare == 0) {
return new String(methodInfo1.getDescriptor()).compareTo(new String(methodInfo2.getDescriptor()));
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/JarComparator.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/JarComparator.java
index e3e09d3a9..e643eb798 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/JarComparator.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/JarComparator.java
@@ -12,6 +12,7 @@ package org.eclipse.equinox.p2.internal.repository.comparator;
import java.io.*;
import java.util.*;
+import java.util.Map.Entry;
import java.util.jar.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
@@ -82,8 +83,8 @@ public class JarComparator implements IArtifactComparator {
if (firstFileSize != secondFileSize) {
return newErrorStatus(NLS.bind(Messages.differentNumberOfEntries, new String[] {descriptorString, sourceLocation, Integer.toString(firstFileSize), destinationLocation, Integer.toString(secondFileSize)}));
}
- for (Enumeration enumeration = firstFile.entries(); enumeration.hasMoreElements();) {
- ZipEntry entry = (ZipEntry) enumeration.nextElement();
+ for (Enumeration<? extends ZipEntry> enumeration = firstFile.entries(); enumeration.hasMoreElements();) {
+ ZipEntry entry = enumeration.nextElement();
String entryName = entry.getName();
final ZipEntry entry2 = secondFile.getEntry(entryName);
if (!entry.isDirectory() && entry2 != null) {
@@ -147,8 +148,8 @@ public class JarComparator implements IArtifactComparator {
Attributes attributes2 = manifest2.getMainAttributes();
if (attributes.size() != attributes2.size())
return false;
- for (Iterator iterator = attributes.entrySet().iterator(); iterator.hasNext();) {
- Map.Entry entry = (Map.Entry) iterator.next();
+ for (Iterator<Entry<Object, Object>> iterator = attributes.entrySet().iterator(); iterator.hasNext();) {
+ Entry<Object, Object> entry = iterator.next();
Object value2 = attributes2.get(entry.getKey());
if (value2 == null) {
return false;
@@ -194,7 +195,7 @@ public class JarComparator implements IArtifactComparator {
return false;
props1.keys();
- for (Iterator iterator = props1.keySet().iterator(); iterator.hasNext();) {
+ for (Iterator<Object> iterator = props1.keySet().iterator(); iterator.hasNext();) {
String key = (String) iterator.next();
if (!props2.containsKey(key))
return false;
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/Signature.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/Signature.java
index e530f1e40..51b008b8d 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/Signature.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/Signature.java
@@ -577,7 +577,7 @@ public final class Signature {
if (methodOrTypeSignature[0] != C_GENERIC_START)
return CharOperation.NO_CHAR_CHAR;
- ArrayList paramList = new ArrayList(1);
+ ArrayList<char[]> paramList = new ArrayList<char[]>(1);
int paramStart = 1, i = 1; // start after leading '<'
while (i < length) {
if (methodOrTypeSignature[i] == C_GENERIC_END) {
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/Mirroring.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/Mirroring.java
index f88e609ae..eae358402 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/Mirroring.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/Mirroring.java
@@ -37,7 +37,7 @@ public class Mirroring {
private boolean validate = false;
private IArtifactComparator comparator;
private String comparatorID;
- private List keysToMirror;
+ private List<IArtifactKey> keysToMirror;
private IArtifactMirrorLog comparatorLog;
private IArtifactComparator getComparator() {
@@ -78,15 +78,15 @@ public class Mirroring {
if (compare)
getComparator(); //initialize the comparator. Only needed if we're comparing. Used to force error if comparatorID is invalid.
MultiStatus multiStatus = new MultiStatus(Activator.ID, IStatus.OK, Messages.message_mirroringStatus, null);
- Iterator keys = null;
+ Iterator<IArtifactKey> keys = null;
if (keysToMirror != null)
keys = keysToMirror.iterator();
else {
- IQueryResult result = source.query(ArtifactKeyQuery.ALL_KEYS, null);
+ IQueryResult<IArtifactKey> result = source.query(ArtifactKeyQuery.ALL_KEYS, null);
keys = result.iterator();
}
while (keys.hasNext()) {
- IArtifactKey key = (IArtifactKey) keys.next();
+ IArtifactKey key = keys.next();
IArtifactDescriptor[] descriptors = source.getArtifactDescriptors(key);
for (int j = 0; j < descriptors.length; j++) {
IStatus result = mirror(descriptors[j], verbose);
@@ -209,15 +209,15 @@ public class Mirroring {
MultiStatus status = new MultiStatus(Activator.ID, 0, Messages.Mirroring_ValidationError, null);
// The keys that were mirrored in this session
- Iterator keys = null;
+ Iterator<IArtifactKey> keys = null;
if (keysToMirror != null) {
keys = keysToMirror.iterator();
} else {
- IQueryResult result = source.query(ArtifactKeyQuery.ALL_KEYS, null);
+ IQueryResult<IArtifactKey> result = source.query(ArtifactKeyQuery.ALL_KEYS, null);
keys = result.iterator();
}
while (keys.hasNext()) {
- IArtifactKey artifactKey = (IArtifactKey) keys.next();
+ IArtifactKey artifactKey = keys.next();
IArtifactDescriptor[] srcDescriptors = source.getArtifactDescriptors(artifactKey);
IArtifactDescriptor[] destDescriptors = destination.getArtifactDescriptors(artifactKey);
@@ -239,8 +239,8 @@ public class Mirroring {
}
} else {
// check properties for differences
- Map destMap = destDescriptors[dest].getProperties();
- Map srcProperties = null;
+ Map<String, String> destMap = destDescriptors[dest].getProperties();
+ Map<String, String> srcProperties = null;
if (baseline != null) {
IArtifactDescriptor baselineDescriptor = getBaselineDescriptor(destDescriptors[dest]);
if (baselineDescriptor != null)
@@ -251,8 +251,8 @@ public class Mirroring {
srcProperties = srcDescriptors[src].getProperties();
// Cycle through properties of the originating descriptor & compare
- for (Iterator iter = srcProperties.keySet().iterator(); iter.hasNext();) {
- String key = (String) iter.next();
+ for (Iterator<String> iter = srcProperties.keySet().iterator(); iter.hasNext();) {
+ String key = iter.next();
if (!srcProperties.get(key).equals(destMap.get(key))) {
if (verbose)
System.out.println(NLS.bind(Messages.Mirroring_differentDescriptorProperty, new Object[] {destDescriptors[dest], key, srcProperties.get(key), destMap.get(key)}));
@@ -276,9 +276,9 @@ public class Mirroring {
}
// Simple comparator for ArtifactDescriptors
- protected class ArtifactDescriptorComparator implements Comparator {
+ protected class ArtifactDescriptorComparator implements Comparator<IArtifactDescriptor> {
- public int compare(Object arg0, Object arg1) {
+ public int compare(IArtifactDescriptor arg0, IArtifactDescriptor arg1) {
if (arg0 != null && arg1 != null)
return arg0.toString().compareTo(arg1.toString());
else if (arg1 == null && arg0 == null)
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/AbstractApplication.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/AbstractApplication.java
index 14e1ccfe4..260d23c19 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/AbstractApplication.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/AbstractApplication.java
@@ -23,6 +23,7 @@ import org.eclipse.equinox.internal.p2.repository.helpers.RepositoryHelper;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.core.IProvisioningAgentProvider;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.repository.*;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
@@ -34,11 +35,11 @@ import org.osgi.framework.ServiceReference;
public abstract class AbstractApplication {
protected boolean removeAddedRepositories = true;
- protected List sourceRepositories = new ArrayList(); //List of repository descriptors
- protected List artifactReposToRemove = new ArrayList();
- protected List metadataReposToRemove = new ArrayList();
- protected List sourceIUs = new ArrayList();
- private List destinationRepos = new ArrayList();
+ protected List<RepositoryDescriptor> sourceRepositories = new ArrayList<RepositoryDescriptor>(); //List of repository descriptors
+ protected List<URI> artifactReposToRemove = new ArrayList<URI>();
+ protected List<URI> metadataReposToRemove = new ArrayList<URI>();
+ protected List<IInstallableUnit> sourceIUs = new ArrayList();
+ private List<RepositoryDescriptor> destinationRepos = new ArrayList<RepositoryDescriptor>();
protected IArtifactRepository destinationArtifactRepository = null;
protected IMetadataRepository destinationMetadataRepository = null;
@@ -78,18 +79,18 @@ public abstract class AbstractApplication {
Activator.getBundleContext().ungetService(providerRef);
}
- public void setSourceIUs(List ius) {
+ public void setSourceIUs(List<IInstallableUnit> ius) {
sourceIUs = ius;
}
protected void finalizeRepositories() throws ProvisionException {
if (removeAddedRepositories) {
IArtifactRepositoryManager artifactRepositoryManager = getArtifactRepositoryManager();
- for (Iterator iter = artifactReposToRemove.iterator(); iter.hasNext();)
- artifactRepositoryManager.removeRepository((URI) iter.next());
+ for (Iterator<URI> iter = artifactReposToRemove.iterator(); iter.hasNext();)
+ artifactRepositoryManager.removeRepository(iter.next());
IMetadataRepositoryManager metadataRepositoryManager = getMetadataRepositoryManager();
- for (Iterator iter = metadataReposToRemove.iterator(); iter.hasNext();)
- metadataRepositoryManager.removeRepository((URI) iter.next());
+ for (Iterator<URI> iter = metadataReposToRemove.iterator(); iter.hasNext();)
+ metadataRepositoryManager.removeRepository(iter.next());
}
metadataReposToRemove = null;
artifactReposToRemove = null;
@@ -112,8 +113,8 @@ public abstract class AbstractApplication {
IMetadataRepositoryManager metadataRepositoryManager = getMetadataRepositoryManager();
URI curLocation = null;
try {
- for (Iterator iter = sourceRepositories.iterator(); iter.hasNext();) {
- RepositoryDescriptor repo = (RepositoryDescriptor) iter.next();
+ for (Iterator<RepositoryDescriptor> iter = sourceRepositories.iterator(); iter.hasNext();) {
+ RepositoryDescriptor repo = iter.next();
curLocation = repo.getRepoLocation();
if (repo.isBoth()) {
addRepository(artifactRepositoryManager, curLocation, 0, progress);
@@ -152,9 +153,9 @@ public abstract class AbstractApplication {
RepositoryDescriptor artifactRepoDescriptor = null;
RepositoryDescriptor metadataRepoDescriptor = null;
- Iterator iter = destinationRepos.iterator();
+ Iterator<RepositoryDescriptor> iter = destinationRepos.iterator();
while (iter.hasNext() && (artifactRepoDescriptor == null || metadataRepoDescriptor == null)) {
- RepositoryDescriptor repo = (RepositoryDescriptor) iter.next();
+ RepositoryDescriptor repo = iter.next();
if (repo.isArtifact() && artifactRepoDescriptor == null)
artifactRepoDescriptor = repo;
if (repo.isMetadata() && metadataRepoDescriptor == null)
@@ -234,12 +235,12 @@ public abstract class AbstractApplication {
}
}
- protected boolean initDestinationRepository(IRepository repository, RepositoryDescriptor descriptor) {
+ protected boolean initDestinationRepository(IRepository<?> repository, RepositoryDescriptor descriptor) {
if (repository != null && repository.isModifiable()) {
if (descriptor.getName() != null)
repository.setName(descriptor.getName());
- if (repository instanceof ICompositeRepository && !descriptor.isAppend())
- ((ICompositeRepository) repository).removeAllChildren();
+ if (repository instanceof ICompositeRepository<?> && !descriptor.isAppend())
+ ((ICompositeRepository<?>) repository).removeAllChildren();
else if (repository instanceof IMetadataRepository && !descriptor.isAppend())
((IMetadataRepository) repository).removeAll();
else if (repository instanceof IArtifactRepository && !descriptor.isAppend())
@@ -258,8 +259,8 @@ public abstract class AbstractApplication {
} catch (URISyntaxException e) {
//Can't happen
}
- for (Iterator iter = sourceRepositories.iterator(); iter.hasNext();) {
- RepositoryDescriptor repo = (RepositoryDescriptor) iter.next();
+ for (Iterator<RepositoryDescriptor> iter = sourceRepositories.iterator(); iter.hasNext();) {
+ RepositoryDescriptor repo = iter.next();
if (repo.isMetadata())
compositeMetadataRepository.addChild(repo.getRepoLocation());
}
@@ -276,8 +277,8 @@ public abstract class AbstractApplication {
} catch (URISyntaxException e) {
//Can't happen
}
- for (Iterator iter = sourceRepositories.iterator(); iter.hasNext();) {
- RepositoryDescriptor repo = (RepositoryDescriptor) iter.next();
+ for (Iterator<RepositoryDescriptor> iter = sourceRepositories.iterator(); iter.hasNext();) {
+ RepositoryDescriptor repo = iter.next();
if (repo.isArtifact())
compositeArtifactRepository.addChild(repo.getRepoLocation());
}
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/CompositeRepositoryApplication.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/CompositeRepositoryApplication.java
index 840da049a..c1ae3095d 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/CompositeRepositoryApplication.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/CompositeRepositoryApplication.java
@@ -16,6 +16,7 @@ import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepository;
import org.eclipse.equinox.internal.p2.repository.helpers.RepositoryHelper;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.repository.ICompositeRepository;
import org.eclipse.equinox.p2.repository.IRepository;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
@@ -25,8 +26,8 @@ import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
import org.eclipse.osgi.util.NLS;
public class CompositeRepositoryApplication extends AbstractApplication {
- private List childrenToAdd = new ArrayList();
- private List childrenToRemove = new ArrayList();
+ private List<RepositoryDescriptor> childrenToAdd = new ArrayList<RepositoryDescriptor>();
+ private List<RepositoryDescriptor> childrenToRemove = new ArrayList<RepositoryDescriptor>();
private boolean failOnExists = false;
private String comparatorID = null;
@@ -34,12 +35,12 @@ public class CompositeRepositoryApplication extends AbstractApplication {
try {
initializeRepos(new NullProgressMonitor());
// load repository
- ICompositeRepository metadataRepo = (ICompositeRepository) destinationMetadataRepository;
+ ICompositeRepository<IInstallableUnit> metadataRepo = (ICompositeRepository<IInstallableUnit>) destinationMetadataRepository;
CompositeArtifactRepository artifactRepo = (CompositeArtifactRepository) destinationArtifactRepository;
// Remove children from the Composite Repositories
- for (Iterator iterator = childrenToRemove.iterator(); iterator.hasNext();) {
- RepositoryDescriptor child = (RepositoryDescriptor) iterator.next();
+ for (Iterator<RepositoryDescriptor> iterator = childrenToRemove.iterator(); iterator.hasNext();) {
+ RepositoryDescriptor child = iterator.next();
if (child.isArtifact() && artifactRepo != null)
artifactRepo.removeChild(child.getOriginalRepoLocation());
if (child.isMetadata() && metadataRepo != null)
@@ -47,8 +48,8 @@ public class CompositeRepositoryApplication extends AbstractApplication {
}
// Add children to the Composite Repositories
- for (Iterator iterator = childrenToAdd.iterator(); iterator.hasNext();) {
- RepositoryDescriptor child = (RepositoryDescriptor) iterator.next();
+ for (Iterator<RepositoryDescriptor> iterator = childrenToAdd.iterator(); iterator.hasNext();) {
+ RepositoryDescriptor child = iterator.next();
if (child.isArtifact() && artifactRepo != null)
artifactRepo.addChild(child.getOriginalRepoLocation());
if (child.isMetadata() && metadataRepo != null)
@@ -155,8 +156,8 @@ public class CompositeRepositoryApplication extends AbstractApplication {
/*
* Determine if the repository is valid for this operation
*/
- private boolean validRepositoryLocation(IRepository repository) throws ProvisionException {
- if (repository instanceof ICompositeRepository) {
+ private boolean validRepositoryLocation(IRepository<?> repository) throws ProvisionException {
+ if (repository instanceof ICompositeRepository<?>) {
// if we have an already existing repository at that location, then throw an error
// if the user told us to
if (failOnExists)
@@ -171,7 +172,7 @@ public class CompositeRepositoryApplication extends AbstractApplication {
/*
* Initialize a new repository
*/
- private void initRepository(IRepository repository, RepositoryDescriptor desc) {
+ private void initRepository(IRepository<?> repository, RepositoryDescriptor desc) {
RepositoryHelper.validDestinationRepository(repository);
if (desc.isCompressed() && !repository.getProperties().containsKey(IRepository.PROP_COMPRESSED))
repository.setProperty(IRepository.PROP_COMPRESSED, String.valueOf(true));
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/MirrorApplication.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/MirrorApplication.java
index 732b93733..d9203bdb2 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/MirrorApplication.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/MirrorApplication.java
@@ -59,7 +59,7 @@ public class MirrorApplication extends AbstractApplication implements IApplicati
public static String[] getArrayArgsFromString(String list, String separator) {
if (list == null || list.trim().equals("")) //$NON-NLS-1$
return new String[0];
- List result = new ArrayList();
+ List<String> result = new ArrayList<String>();
for (StringTokenizer tokens = new StringTokenizer(list, separator); tokens.hasMoreTokens();) {
String token = tokens.nextToken().trim();
if (!token.equals("")) { //$NON-NLS-1$
@@ -69,11 +69,11 @@ public class MirrorApplication extends AbstractApplication implements IApplicati
result.add(token);
}
}
- return (String[]) result.toArray(new String[result.size()]);
+ return result.toArray(new String[result.size()]);
}
public Object start(IApplicationContext context) throws Exception {
- Map args = context.getArguments();
+ Map<?, ?> args = context.getArguments();
initializeFromArguments((String[]) args.get(IApplicationContext.APPLICATION_ARGS));
run(null);
return IApplication.EXIT_OK;
@@ -89,8 +89,8 @@ public class MirrorApplication extends AbstractApplication implements IApplicati
* Similary, "org.eclipse.equinox.p2.metadata.repository.mirrorApplication" only does metadata
*/
public void setInitializationData(IConfigurationElement config, String propertyName, Object data) {
- if (data instanceof Map && ((Map) data).containsKey(MIRROR_MODE)) {
- metadataOrArtifacts = (String) ((Map) data).get(MIRROR_MODE);
+ if (data instanceof Map<?, ?> && ((Map<?, ?>) data).containsKey(MIRROR_MODE)) {
+ metadataOrArtifacts = (String) ((Map<?, ?>) data).get(MIRROR_MODE);
}
}
@@ -177,7 +177,7 @@ public class MirrorApplication extends AbstractApplication implements IApplicati
initializeLogs();
validate();
initializeIUs();
- IQueryable slice = slice(new NullProgressMonitor());
+ IQueryable<IInstallableUnit> slice = slice(new NullProgressMonitor());
if (destinationArtifactRepository != null) {
mirrorStatus = mirrorArtifacts(slice, new NullProgressMonitor());
if (mirrorStatus.getSeverity() == IStatus.ERROR)
@@ -194,16 +194,13 @@ public class MirrorApplication extends AbstractApplication implements IApplicati
return mirrorStatus;
}
- private IStatus mirrorArtifacts(IQueryable slice, IProgressMonitor monitor) throws ProvisionException {
+ private IStatus mirrorArtifacts(IQueryable<IInstallableUnit> slice, IProgressMonitor monitor) throws ProvisionException {
// Obtain ArtifactKeys from IUs
- IQueryResult ius = slice.query(InstallableUnitQuery.ANY, monitor);
- ArrayList keys = new ArrayList();
- for (Iterator iterator = ius.iterator(); iterator.hasNext();) {
- IInstallableUnit iu = (IInstallableUnit) iterator.next();
- IArtifactKey[] iuKeys = iu.getArtifacts();
- for (int i = 0; i < iuKeys.length; i++) {
- keys.add(iuKeys[i]);
- }
+ IQueryResult<IInstallableUnit> ius = slice.query(InstallableUnitQuery.ANY, monitor);
+ ArrayList<IArtifactKey> keys = new ArrayList<IArtifactKey>();
+ for (Iterator<IInstallableUnit> iterator = ius.iterator(); iterator.hasNext();) {
+ IInstallableUnit iu = iterator.next();
+ keys.addAll(iu.getArtifacts());
}
Mirroring mirror = new Mirroring(getCompositeArtifactRepository(), destinationArtifactRepository, raw);
@@ -214,7 +211,7 @@ public class MirrorApplication extends AbstractApplication implements IApplicati
// If IUs have been specified then only they should be mirrored, otherwise mirror everything.
if (keys.size() > 0)
- mirror.setArtifactKeys((IArtifactKey[]) keys.toArray(new IArtifactKey[keys.size()]));
+ mirror.setArtifactKeys(keys.toArray(new IArtifactKey[keys.size()]));
if (comparatorLog != null)
mirror.setComparatorLog(comparatorLog);
@@ -234,9 +231,9 @@ public class MirrorApplication extends AbstractApplication implements IApplicati
return addRepository(getArtifactRepositoryManager(), baseline, 0, null);
}
- private void mirrorMetadata(IQueryable slice, IProgressMonitor monitor) {
- IQueryResult allIUs = slice.query(InstallableUnitQuery.ANY, monitor);
- destinationMetadataRepository.addInstallableUnits((IInstallableUnit[]) allIUs.toArray(IInstallableUnit.class));
+ private void mirrorMetadata(IQueryable<IInstallableUnit> slice, IProgressMonitor monitor) {
+ IQueryResult<IInstallableUnit> allIUs = slice.query(InstallableUnitQuery.ANY, monitor);
+ destinationMetadataRepository.addInstallableUnits(allIUs.toArray(IInstallableUnit.class));
}
/*
@@ -261,17 +258,17 @@ public class MirrorApplication extends AbstractApplication implements IApplicati
IMetadataRepository metadataRepo = getCompositeMetadataRepository();
if (rootIUs != null) {
- sourceIUs = new ArrayList();
+ sourceIUs = new ArrayList<IInstallableUnit>();
for (int i = 0; i < rootIUs.length; i++) {
String[] segments = getArrayArgsFromString(rootIUs[i], "/"); //$NON-NLS-1$
VersionRange range = segments.length > 1 ? new VersionRange(segments[i]) : null;
- Iterator queryResult = metadataRepo.query(new InstallableUnitQuery(segments[i], range), null).iterator();
+ Iterator<IInstallableUnit> queryResult = metadataRepo.query(new InstallableUnitQuery(segments[i], range), null).iterator();
while (queryResult.hasNext())
sourceIUs.add(queryResult.next());
}
} else if (sourceIUs == null || sourceIUs.isEmpty()) {
- sourceIUs = new ArrayList();
- Iterator queryResult = metadataRepo.query(InstallableUnitQuery.ANY, null).iterator();
+ sourceIUs = new ArrayList<IInstallableUnit>();
+ Iterator<IInstallableUnit> queryResult = metadataRepo.query(InstallableUnitQuery.ANY, null).iterator();
while (queryResult.hasNext())
sourceIUs.add(queryResult.next());
/* old metadata mirroring app did not throw an exception here */
@@ -310,14 +307,14 @@ public class MirrorApplication extends AbstractApplication implements IApplicati
return new FileMirrorLog(absolutePath, 0, root);
}
- private IQueryable slice(IProgressMonitor monitor) throws ProvisionException {
+ private IQueryable<IInstallableUnit> slice(IProgressMonitor monitor) throws ProvisionException {
if (slicingOptions == null)
slicingOptions = new SlicingOptions();
PermissiveSlicer slicer = new PermissiveSlicer(getCompositeMetadataRepository(), slicingOptions.getFilter(), slicingOptions.includeOptionalDependencies(), slicingOptions.isEverythingGreedy(), slicingOptions.forceFilterTo(), slicingOptions.considerStrictDependencyOnly(), slicingOptions.followOnlyFilteredRequirements());
- IQueryable slice = slicer.slice((IInstallableUnit[]) sourceIUs.toArray(new IInstallableUnit[sourceIUs.size()]), monitor);
+ IQueryable<IInstallableUnit> slice = slicer.slice(sourceIUs.toArray(new IInstallableUnit[sourceIUs.size()]), monitor);
if (slice != null && slicingOptions.latestVersionOnly()) {
- IQueryResult queryResult = slice.query(new LatestIUVersionQuery(), monitor);
+ IQueryResult<IInstallableUnit> queryResult = slice.query(new LatestIUVersionQuery<IInstallableUnit>(), monitor);
slice = queryResult;
}
if (slicer.getStatus().getSeverity() != IStatus.OK && mirrorLog != null) {
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/RecreateRepositoryApplication.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/RecreateRepositoryApplication.java
index e8da53e1b..779cc3c35 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/RecreateRepositoryApplication.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/RecreateRepositoryApplication.java
@@ -31,8 +31,8 @@ public class RecreateRepositoryApplication extends AbstractApplication {
private RepositoryDescriptor descriptor;
private String repoName = null;
boolean removeArtifactRepo = true;
- private Map repoProperties = null;
- private Map repoMap = null;
+ private Map<String, String> repoProperties = null;
+ private Map<IArtifactKey, IArtifactDescriptor[]> repoMap = null;
public IStatus run(IProgressMonitor monitor) throws ProvisionException {
try {
@@ -67,10 +67,10 @@ public class RecreateRepositoryApplication extends AbstractApplication {
repoName = repository.getName();
repoProperties = repository.getProperties();
- repoMap = new HashMap();
- IQueryResult keys = repository.query(ArtifactKeyQuery.ALL_KEYS, null);
- for (Iterator iterator = keys.iterator(); iterator.hasNext();) {
- IArtifactKey key = (IArtifactKey) iterator.next();
+ repoMap = new HashMap<IArtifactKey, IArtifactDescriptor[]>();
+ IQueryResult<IArtifactKey> keys = repository.query(ArtifactKeyQuery.ALL_KEYS, null);
+ for (Iterator<IArtifactKey> iterator = keys.iterator(); iterator.hasNext();) {
+ IArtifactKey key = iterator.next();
IArtifactDescriptor[] descriptors = repository.getArtifactDescriptors(key);
repoMap.put(key, descriptors);
}
@@ -82,7 +82,7 @@ public class RecreateRepositoryApplication extends AbstractApplication {
IArtifactRepositoryManager manager = getArtifactRepositoryManager();
manager.removeRepository(repository.getLocation());
- boolean compressed = Boolean.valueOf((String) repoProperties.get(IRepository.PROP_COMPRESSED)).booleanValue();
+ boolean compressed = Boolean.valueOf(repoProperties.get(IRepository.PROP_COMPRESSED)).booleanValue();
try {
URI realLocation = SimpleArtifactRepository.getActualLocation(repository.getLocation(), compressed);
File realFile = URIUtil.toFile(realLocation);
@@ -97,20 +97,20 @@ public class RecreateRepositoryApplication extends AbstractApplication {
IArtifactRepositoryManager manager = getArtifactRepositoryManager();
//add pack200 mappings, the existing repoProperties is not modifiable
- Map newProperties = new HashMap(repoProperties);
+ Map<String, String> newProperties = new HashMap<String, String>(repoProperties);
newProperties.put(PUBLISH_PACK_FILES_AS_SIBLINGS, "true"); //$NON-NLS-1$
IArtifactRepository repository = manager.createRepository(descriptor.getRepoLocation(), repoName, IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, newProperties);
if (!(repository instanceof IFileArtifactRepository))
throw new ProvisionException(NLS.bind(Messages.exception_notLocalFileRepo, repository.getLocation()));
IFileArtifactRepository simple = (IFileArtifactRepository) repository;
- for (Iterator iterator = repoMap.keySet().iterator(); iterator.hasNext();) {
- IArtifactKey key = (IArtifactKey) iterator.next();
- IArtifactDescriptor[] descriptors = (IArtifactDescriptor[]) repoMap.get(key);
+ for (Iterator<IArtifactKey> iterator = repoMap.keySet().iterator(); iterator.hasNext();) {
+ IArtifactKey key = iterator.next();
+ IArtifactDescriptor[] descriptors = repoMap.get(key);
String unpackedSize = null;
File packFile = null;
- Set files = new HashSet();
+ Set<File> files = new HashSet<File>();
for (int i = 0; i < descriptors.length; i++) {
File artifactFile = simple.getArtifactFile(descriptors[i]);
files.add(artifactFile);
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/Repo2Runnable.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/Repo2Runnable.java
index ba2494613..409c63f86 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/Repo2Runnable.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/Repo2Runnable.java
@@ -46,25 +46,26 @@ public class Repo2Runnable extends AbstractApplication implements IApplication {
private static final String PARM_OPERAND = "operand"; //$NON-NLS-1$
protected class CollectNativesAction extends ProvisioningAction {
- public IStatus execute(Map parameters) {
+ public IStatus execute(Map<String, Object> parameters) {
InstallableUnitOperand operand = (InstallableUnitOperand) parameters.get(PARM_OPERAND);
IInstallableUnit installableUnit = operand.second();
IArtifactRepositoryManager manager = getArtifactRepositoryManager();
- IArtifactKey[] toDownload = installableUnit.getArtifacts();
+ List<IArtifactKey> toDownload = installableUnit.getArtifacts();
if (toDownload == null)
return Status.OK_STATUS;
- List artifactRequests = (List) parameters.get(NATIVE_ARTIFACTS);
+ @SuppressWarnings("unchecked")
+ List<IArtifactRequest> artifactRequests = (List<IArtifactRequest>) parameters.get(NATIVE_ARTIFACTS);
- for (int i = 0; i < toDownload.length; i++) {
- IArtifactRequest request = manager.createMirrorRequest(toDownload[i], destinationArtifactRepository, null, null);
+ for (int i = 0; i < toDownload.size(); i++) {
+ IArtifactRequest request = manager.createMirrorRequest(toDownload.get(i), destinationArtifactRepository, null, null);
artifactRequests.add(request);
}
return Status.OK_STATUS;
}
- public IStatus undo(Map parameters) {
+ public IStatus undo(Map<String, Object> parameters) {
// nothing to do for now
return Status.OK_STATUS;
}
@@ -75,27 +76,28 @@ public class Repo2Runnable extends AbstractApplication implements IApplication {
super(NATIVE_ARTIFACTS, weight);
}
- protected ProvisioningAction[] getActions(InstallableUnitOperand operand) {
+ protected List<ProvisioningAction> getActions(InstallableUnitOperand operand) {
IInstallableUnit unit = operand.second();
if (unit.getTouchpointType().getId().equals(NATIVE_TYPE)) {
- return new ProvisioningAction[] {new CollectNativesAction()};
+ return Collections.<ProvisioningAction> singletonList(new CollectNativesAction());
}
return null;
}
- protected IStatus initializePhase(IProgressMonitor monitor, IProfile profile, Map parameters) {
+ protected IStatus initializePhase(IProgressMonitor monitor, IProfile profile, Map<String, Object> parameters) {
parameters.put(NATIVE_ARTIFACTS, new ArrayList());
return null;
}
- protected IStatus completePhase(IProgressMonitor monitor, IProfile profile, Map parameters) {
- List artifactRequests = (List) parameters.get(NATIVE_ARTIFACTS);
+ protected IStatus completePhase(IProgressMonitor monitor, IProfile profile, Map<String, Object> parameters) {
+ @SuppressWarnings("unchecked")
+ List<IArtifactRequest> artifactRequests = (List<IArtifactRequest>) parameters.get(NATIVE_ARTIFACTS);
ProvisioningContext context = (ProvisioningContext) parameters.get(PARM_CONTEXT);
IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT);
IArtifactRepositoryManager repositoryManager = (IArtifactRepositoryManager) agent.getService(IArtifactRepositoryManager.SERVICE_NAME);
DownloadManager dm = new DownloadManager(context, repositoryManager);
- for (Iterator it = artifactRequests.iterator(); it.hasNext();) {
- dm.add((IArtifactRequest) it.next());
+ for (Iterator<IArtifactRequest> it = artifactRequests.iterator(); it.hasNext();) {
+ dm.add(it.next());
}
return dm.start(monitor);
}
@@ -103,7 +105,7 @@ public class Repo2Runnable extends AbstractApplication implements IApplication {
// the list of IUs that we actually transformed... could have come from the repo
// or have been user-specified.
- private Collection processedIUs = new ArrayList();
+ private Collection<IInstallableUnit> processedIUs = new ArrayList<IInstallableUnit>();
/*
* Perform the transformation.
@@ -124,7 +126,7 @@ public class Repo2Runnable extends AbstractApplication implements IApplication {
try {
ProfileChangeRequest request = new ProfileChangeRequest(profile);
request.setAbsoluteMode(true);
- request.addInstallableUnits((IInstallableUnit[]) processedIUs.toArray(new IInstallableUnit[processedIUs.size()]));
+ request.addInstallableUnits(processedIUs.toArray(new IInstallableUnit[processedIUs.size()]));
ProvisioningContext context = new ProvisioningContext();
IEngine engine = (IEngine) ServiceHelper.getService(Activator.getBundleContext(), IEngine.SERVICE_NAME);
if (engine == null)
@@ -172,7 +174,7 @@ public class Repo2Runnable extends AbstractApplication implements IApplication {
if (!hasMetadataSources())
throw new ProvisionException(Messages.exception_needIUsOrNonEmptyRepo);
- Iterator itor = getAllIUs(getCompositeMetadataRepository(), monitor).iterator();
+ Iterator<IInstallableUnit> itor = getAllIUs(getCompositeMetadataRepository(), monitor).iterator();
while (itor.hasNext())
processedIUs.add(itor.next());
@@ -188,13 +190,13 @@ public class Repo2Runnable extends AbstractApplication implements IApplication {
// publishing the metadata is optional
if (destinationMetadataRepository == null)
return;
- destinationMetadataRepository.addInstallableUnits((IInstallableUnit[]) processedIUs.toArray(new IInstallableUnit[processedIUs.size()]));
+ destinationMetadataRepository.addInstallableUnits(processedIUs.toArray(new IInstallableUnit[processedIUs.size()]));
}
/*
* Return a collector over all the IUs contained in the given repository.
*/
- private IQueryResult getAllIUs(IMetadataRepository repository, IProgressMonitor monitor) {
+ private IQueryResult<IInstallableUnit> getAllIUs(IMetadataRepository repository, IProgressMonitor monitor) {
SubMonitor progress = SubMonitor.convert(monitor, 2);
try {
return repository.query(InstallableUnitQuery.ANY, progress.newChild(1));
@@ -215,7 +217,7 @@ public class Repo2Runnable extends AbstractApplication implements IApplication {
* Create and return a new profile.
*/
private IProfile createProfile() throws ProvisionException {
- Map properties = new Properties();
+ Map<String, String> properties = new HashMap<String, String>();
properties.put(IProfile.PROP_CACHE, URIUtil.toFile(destinationArtifactRepository.getLocation()).getAbsolutePath());
properties.put(IProfile.PROP_INSTALL_FOLDER, URIUtil.toFile(destinationArtifactRepository.getLocation()).getAbsolutePath());
IProfileRegistry registry = Activator.getProfileRegistry();
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/SlicingOptions.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/SlicingOptions.java
index 6531d3696..639279ba6 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/SlicingOptions.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/SlicingOptions.java
@@ -11,7 +11,7 @@
package org.eclipse.equinox.p2.internal.repository.tools;
import java.util.Dictionary;
-import java.util.Properties;
+import java.util.Hashtable;
public class SlicingOptions {
private boolean includeOptionalDependencies = true;
@@ -20,7 +20,7 @@ public class SlicingOptions {
private boolean considerStrictDependencyOnly = false;
private boolean followOnlyFilteredRequirements = false;
private boolean latestVersion = false;
- private Dictionary filter = null;
+ private Dictionary<String, Object> filter = null;
public boolean includeOptionalDependencies() {
return includeOptionalDependencies;
@@ -54,13 +54,13 @@ public class SlicingOptions {
this.considerStrictDependencyOnly = strict;
}
- public Dictionary getFilter() {
+ public Dictionary<String, Object> getFilter() {
if (filter == null)
- filter = new Properties();
+ filter = new Hashtable<String, Object>();
return filter;
}
- public void setFilter(Dictionary filter) {
+ public void setFilter(Dictionary<String, Object> filter) {
this.filter = filter;
}
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/HostCheckAnalyzer.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/HostCheckAnalyzer.java
index 87c228953..42479d108 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/HostCheckAnalyzer.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/HostCheckAnalyzer.java
@@ -36,7 +36,7 @@ public class HostCheckAnalyzer extends IUAnalyzer {
if (hosts[i] instanceof IRequiredCapability)
theHost = (IRequiredCapability) hosts[i];
if (theHost.getNamespace().equals("osgi.bundle")) {
- IQueryResult results = repository.query(new InstallableUnitQuery(theHost.getName(), theHost.getRange()), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> results = repository.query(new InstallableUnitQuery(theHost.getName(), theHost.getRange()), new NullProgressMonitor());
if (results.isEmpty()) {
error(iu, "IU Fragment: " + iu.getId() + " cannot find host" + theHost.getName() + " : " + theHost.getRange());
return;
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/LicenseAnalyzer.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/LicenseAnalyzer.java
index 58284c35f..c0aa31b12 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/LicenseAnalyzer.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/LicenseAnalyzer.java
@@ -9,6 +9,7 @@
******************************************************************************/
package org.eclipse.equinox.p2.internal.repository.tools.analyzer;
+import java.util.List;
import org.eclipse.equinox.internal.provisional.p2.metadata.ILicense;
import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory.InstallableUnitDescription;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
@@ -22,17 +23,18 @@ public class LicenseAnalyzer extends IUAnalyzer {
public void analyzeIU(IInstallableUnit iu) {
if (Boolean.valueOf(iu.getProperty(InstallableUnitDescription.PROP_TYPE_GROUP)).booleanValue()) {
- if (iu.getLicenses() == null || iu.getLicenses().length == 0) {
+ List<ILicense> licenses = iu.getLicenses();
+ if (iu.getLicenses() == null || licenses.size() == 0) {
// If there is no license then this is an error
error(iu, "[ERROR] " + iu.getId() + " has no license");
return;
- } else if (iu.getLicenses()[0].getBody().length() == 0) {
+ } else if (licenses.get(0).getBody().length() == 0) {
error(iu, "[ERROR] " + iu.getId() + " has no license");
return;
}
- for (int i = 0; i < iu.getLicenses().length; i++) {
- ILicense license = iu.getLicenses()[i];
+ for (int i = 0; i < licenses.size(); i++) {
+ ILicense license = licenses.get(i);
if (license.getBody().startsWith("%")) {
String licenseProperty = license.getBody().substring(1);
if (iu.getProperty("df_LT." + licenseProperty) == null) {
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/UniqueIUAnalyzer.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/UniqueIUAnalyzer.java
index 320d2f56c..8e589bf05 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/UniqueIUAnalyzer.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/UniqueIUAnalyzer.java
@@ -20,7 +20,7 @@ import org.eclipse.equinox.p2.repository.tools.analyzer.IUAnalyzer;
*/
public class UniqueIUAnalyzer extends IUAnalyzer {
- Set versionedNames = null;
+ Set<String> versionedNames = null;
public void analyzeIU(IInstallableUnit iu) {
// Create a unique name / version pair and cache it
@@ -33,6 +33,6 @@ public class UniqueIUAnalyzer extends IUAnalyzer {
}
public void preAnalysis(IMetadataRepository repo) {
- versionedNames = new HashSet();
+ versionedNames = new HashSet<String>();
}
}
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/UnzipFeatureJarAnalyzer.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/UnzipFeatureJarAnalyzer.java
index 1d92ad518..0cecd9b49 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/UnzipFeatureJarAnalyzer.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/UnzipFeatureJarAnalyzer.java
@@ -9,6 +9,7 @@
******************************************************************************/
package org.eclipse.equinox.p2.internal.repository.tools.analyzer;
+import java.util.List;
import org.eclipse.equinox.internal.provisional.p2.metadata.ITouchpointData;
import org.eclipse.equinox.internal.provisional.p2.metadata.ITouchpointInstruction;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
@@ -22,13 +23,13 @@ public class UnzipFeatureJarAnalyzer extends IUAnalyzer {
public void analyzeIU(IInstallableUnit iu) {
if (iu.getId().indexOf("feature.jar") > -1) {
- ITouchpointData[] touchpointData = iu.getTouchpointData();
- if (touchpointData.length == 0) {
+ List<ITouchpointData> touchpointData = iu.getTouchpointData();
+ if (touchpointData.size() == 0) {
error(iu, "[ERROR] No unzip touchpoint for: " + iu.getId());
} else {
boolean found = false;
- for (int i = 0; i < touchpointData.length; i++) {
- ITouchpointInstruction instruction = touchpointData[i].getInstruction("zipped");
+ for (int i = 0; i < touchpointData.size(); i++) {
+ ITouchpointInstruction instruction = touchpointData.get(i).getInstruction("zipped");
if (instruction.getBody().equals("true"))
found = true;
}
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/repository/tools/analyzer/IUAnalyzer.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/repository/tools/analyzer/IUAnalyzer.java
index cb9671ebd..4d5bc0ca3 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/repository/tools/analyzer/IUAnalyzer.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/repository/tools/analyzer/IUAnalyzer.java
@@ -22,7 +22,7 @@ import org.eclipse.equinox.p2.metadata.IInstallableUnit;
*/
public abstract class IUAnalyzer implements IIUAnalyzer {
- private List errors = null;
+ private List<IStatus> errors = null;
private String analyzerName;
public void setName(String name) {
@@ -31,7 +31,7 @@ public abstract class IUAnalyzer implements IIUAnalyzer {
protected void error(IInstallableUnit iu, String error) {
if (errors == null)
- errors = new ArrayList();
+ errors = new ArrayList<IStatus>();
errors.add(new Status(IStatus.ERROR, Activator.ID, error));
}
@@ -41,6 +41,6 @@ public abstract class IUAnalyzer implements IIUAnalyzer {
public IStatus postAnalysis() {
if (errors == null || errors.size() == 0)
return Status.OK_STATUS;
- return new MultiStatus(Activator.ID, IStatus.ERROR, (IStatus[]) errors.toArray(new IStatus[errors.size()]), analyzerName, null);
+ return new MultiStatus(Activator.ID, IStatus.ERROR, errors.toArray(new IStatus[errors.size()]), analyzerName, null);
}
}
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/repository/tools/analyzer/RepositoryAnalyzer.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/repository/tools/analyzer/RepositoryAnalyzer.java
index 4d32d1c2d..4195d1721 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/repository/tools/analyzer/RepositoryAnalyzer.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/repository/tools/analyzer/RepositoryAnalyzer.java
@@ -35,7 +35,7 @@ public class RepositoryAnalyzer {
IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(IIUAnalyzer.ID);
for (int i = 0; i < repositories.length; i++) {
- IQueryResult queryResult = repositories[i].query(InstallableUnitQuery.ANY, sub);
+ IQueryResult<IInstallableUnit> queryResult = repositories[i].query(InstallableUnitQuery.ANY, sub);
SubMonitor repositoryMonitor = SubMonitor.convert(sub, IProgressMonitor.UNKNOWN);
for (int j = 0; j < config.length; j++) {
@@ -46,9 +46,9 @@ public class RepositoryAnalyzer {
((IUAnalyzer) verifier).setName(analyizerName);
}
verifier.preAnalysis(repositories[i]);
- Iterator iter = queryResult.iterator();
+ Iterator<IInstallableUnit> iter = queryResult.iterator();
while (iter.hasNext()) {
- IInstallableUnit iu = (IInstallableUnit) iter.next();
+ IInstallableUnit iu = iter.next();
verifier.analyzeIU(iu);
}
IStatus postAnalysisResult = verifier.postAnalysis();
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/AbstractRepositoryTask.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/AbstractRepositoryTask.java
index de45bb783..2bf388c36 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/AbstractRepositoryTask.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/AbstractRepositoryTask.java
@@ -19,6 +19,7 @@ import org.apache.tools.ant.types.FileSet;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.URIUtil;
import org.eclipse.equinox.p2.internal.repository.tools.*;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.query.IQuery;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
import org.eclipse.osgi.util.NLS;
@@ -26,9 +27,9 @@ import org.eclipse.osgi.util.NLS;
public abstract class AbstractRepositoryTask extends Task {
protected static final String ANT_PREFIX = "${"; //$NON-NLS-1$
protected AbstractApplication application;
- protected List iuTasks = new ArrayList();
- protected List sourceRepos = new ArrayList();
- protected List destinations = new ArrayList();
+ protected List<IUDescription> iuTasks = new ArrayList<IUDescription>();
+ protected List<FileSet> sourceRepos = new ArrayList<FileSet>();
+ protected List<DestinationRepository> destinations = new ArrayList<DestinationRepository>();
protected void addMetadataSourceRepository(URI repoLocation) {
RepositoryDescriptor source = new RepositoryDescriptor();
@@ -101,13 +102,13 @@ public abstract class AbstractRepositoryTask extends Task {
* Add source repositories to mirror from
*/
public void addConfiguredSource(RepositoryList sourceList) {
- for (Iterator iter = sourceList.getRepositoryList().iterator(); iter.hasNext();) {
- DestinationRepository repo = (DestinationRepository) iter.next();
+ for (Iterator<DestinationRepository> iter = sourceList.getRepositoryList().iterator(); iter.hasNext();) {
+ DestinationRepository repo = iter.next();
application.addSource(repo.getDescriptor());
}
- for (Iterator iter = sourceList.getFileSetList().iterator(); iter.hasNext();) {
- FileSet fileSet = (FileSet) iter.next();
+ for (Iterator<FileSet> iter = sourceList.getFileSetList().iterator(); iter.hasNext();) {
+ FileSet fileSet = iter.next();
sourceRepos.add(fileSet);
// Added to the application later through prepareSourceRepos
}
@@ -120,7 +121,7 @@ public abstract class AbstractRepositoryTask extends Task {
protected void prepareSourceRepos() {
if (sourceRepos == null || sourceRepos.isEmpty())
return;
- for (Iterator iter = sourceRepos.iterator(); iter.hasNext();) {
+ for (Iterator<FileSet> iter = sourceRepos.iterator(); iter.hasNext();) {
RepositoryFileSet fileset = (RepositoryFileSet) iter.next();
if (fileset.getRepoLocation() != null) {
@@ -156,17 +157,17 @@ public abstract class AbstractRepositoryTask extends Task {
sourceRepos.clear();
}
- protected List prepareIUs() {
+ protected List<IInstallableUnit> prepareIUs() {
if (iuTasks == null || iuTasks.isEmpty())
return null;
IMetadataRepository repository = application.getCompositeMetadataRepository();
- List result = new ArrayList();
- for (Iterator iter = iuTasks.iterator(); iter.hasNext();) {
- IUDescription iu = (IUDescription) iter.next();
- IQuery iuQuery = iu.createQuery();
+ List<IInstallableUnit> result = new ArrayList<IInstallableUnit>();
+ for (Iterator<IUDescription> iter = iuTasks.iterator(); iter.hasNext();) {
+ IUDescription iu = iter.next();
+ IQuery<IInstallableUnit> iuQuery = iu.createQuery();
- Iterator queryResult = repository.query(iuQuery, null).iterator();
+ Iterator<IInstallableUnit> queryResult = repository.query(iuQuery, null).iterator();
if (iu.isRequired() && !queryResult.hasNext())
throw new BuildException(NLS.bind(Messages.AbstractRepositoryTask_unableToFind, iu.toString()));
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/CompositeRepositoryTask.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/CompositeRepositoryTask.java
index f1e8e9e9c..0859f34fc 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/CompositeRepositoryTask.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/CompositeRepositoryTask.java
@@ -40,8 +40,8 @@ public class CompositeRepositoryTask extends AbstractRepositoryTask {
* Add the listed repositories to the composite repository
*/
public void addConfiguredAdd(RepositoryList list) {
- for (Iterator iter = list.getRepositoryList().iterator(); iter.hasNext();) {
- DestinationRepository repo = (DestinationRepository) iter.next();
+ for (Iterator<DestinationRepository> iter = list.getRepositoryList().iterator(); iter.hasNext();) {
+ DestinationRepository repo = iter.next();
((CompositeRepositoryApplication) application).addChild(repo.getDescriptor());
}
}
@@ -50,8 +50,8 @@ public class CompositeRepositoryTask extends AbstractRepositoryTask {
* Remove the listed repositories from the composite repository
*/
public void addConfiguredRemove(RepositoryList list) {
- for (Iterator iter = list.getRepositoryList().iterator(); iter.hasNext();) {
- DestinationRepository repo = (DestinationRepository) iter.next();
+ for (Iterator<DestinationRepository> iter = list.getRepositoryList().iterator(); iter.hasNext();) {
+ DestinationRepository repo = iter.next();
((CompositeRepositoryApplication) application).removeChild(repo.getDescriptor());
}
}
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/IUDescription.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/IUDescription.java
index ad96cd7a4..03ae60493 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/IUDescription.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/IUDescription.java
@@ -12,9 +12,11 @@ package org.eclipse.equinox.p2.internal.repository.tools.tasks;
import java.util.*;
import org.apache.tools.ant.types.DataType;
+import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils;
import org.eclipse.equinox.internal.provisional.p2.metadata.Version;
import org.eclipse.equinox.internal.provisional.p2.metadata.query.*;
import org.eclipse.equinox.p2.internal.repository.tools.Activator;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.query.IQuery;
import org.osgi.framework.Filter;
import org.osgi.framework.InvalidSyntaxException;
@@ -101,29 +103,32 @@ public class IUDescription extends DataType {
return buffer.toString();
}
- public IQuery createQuery() {
- List queries = new ArrayList();
+ public IQuery<IInstallableUnit> createQuery() {
+ List<IQuery<IInstallableUnit>> queries = new ArrayList<IQuery<IInstallableUnit>>();
if (id != null) {
if (version == null || version.length() == 0) {
// Get the latest version of the iu
queries.add(new InstallableUnitQuery(id));
- queries.add(new LatestIUVersionQuery());
+ queries.add(new LatestIUVersionQuery<IInstallableUnit>());
} else {
Version iuVersion = Version.parseVersion(version);
queries.add(new InstallableUnitQuery(id, iuVersion));
}
}
- IQuery iuQuery = processQueryString();
+ IQuery<IInstallableUnit> iuQuery = processQueryString();
if (iuQuery != null)
queries.add(iuQuery);
if (queries.size() == 1)
- return (IQuery) queries.get(0);
- return new PipedQuery((IQuery[]) queries.toArray(new IQuery[queries.size()]));
+ return queries.get(0);
+
+ @SuppressWarnings("unchecked")
+ IQuery<IInstallableUnit> query = new PipedQuery<IInstallableUnit>(queries.toArray(new IQuery[queries.size()]));
+ return query;
}
- private IQuery processQueryString() {
+ private IQuery<IInstallableUnit> processQueryString() {
if (queryString == null)
return null;
int startIdx = queryString.indexOf('[');
@@ -131,10 +136,10 @@ public class IUDescription extends DataType {
if (startIdx == -1 || endIdx == -1 || endIdx < startIdx)
return null;
String element = queryString.substring(0, startIdx);
- Map attributes = processQueryAttributes(queryString.substring(startIdx + 1, endIdx));
+ Map<String, String> attributes = processQueryAttributes(queryString.substring(startIdx + 1, endIdx));
if (element.equals(QUERY_PROPERTY)) {
- String name = (String) attributes.get(QUERY_NAME);
- String value = (String) attributes.get(QUERY_VALUE);
+ String name = attributes.get(QUERY_NAME);
+ String value = attributes.get(QUERY_VALUE);
if (name == null)
return null;
return new IUPropertyQuery(name, value);
@@ -143,11 +148,11 @@ public class IUDescription extends DataType {
return null;
}
- private Map processQueryAttributes(String attributes) {
+ private Map<String, String> processQueryAttributes(String attributes) {
if (attributes == null || attributes.length() == 0)
- return Collections.EMPTY_MAP;
+ return CollectionUtils.emptyMap();
- Map result = new HashMap();
+ Map<String, String> result = new HashMap<String, String>();
int start = 0;
int idx = 0;
while ((idx = attributes.indexOf('@', start)) > -1) {
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/MirrorTask.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/MirrorTask.java
index d2a220bb2..33029aecb 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/MirrorTask.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/MirrorTask.java
@@ -17,6 +17,7 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
import org.eclipse.equinox.p2.internal.repository.tools.Messages;
import org.eclipse.equinox.p2.internal.repository.tools.MirrorApplication;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
public class MirrorTask extends AbstractRepositoryTask {
@@ -50,7 +51,7 @@ public class MirrorTask extends AbstractRepositoryTask {
prepareSourceRepos();
application.initializeRepos(null);
- List ius = prepareIUs();
+ List<IInstallableUnit> ius = prepareIUs();
application.setSourceIUs(ius);
IStatus result = application.run(null);
if (result.matches(IStatus.ERROR))
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/RemoveIUTask.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/RemoveIUTask.java
index 7f3366de5..198e6e0cd 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/RemoveIUTask.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/RemoveIUTask.java
@@ -60,19 +60,19 @@ public class RemoveIUTask extends AbstractRepositoryTask {
IMetadataRepository repository = application.getDestinationMetadataRepository();
IArtifactRepository artifacts = application.getDestinationArtifactRepository();
- final Set toRemove = new HashSet();
- for (Iterator iter = iuTasks.iterator(); iter.hasNext();) {
- IUDescription iu = (IUDescription) iter.next();
- IQuery iuQuery = iu.createQuery();
+ final Set<IInstallableUnit> toRemove = new HashSet<IInstallableUnit>();
+ for (Iterator<IUDescription> iter = iuTasks.iterator(); iter.hasNext();) {
+ IUDescription iu = iter.next();
+ IQuery<IInstallableUnit> iuQuery = iu.createQuery();
- IQueryResult queryResult = repository.query(iuQuery, null);
+ IQueryResult<IInstallableUnit> queryResult = repository.query(iuQuery, null);
if (queryResult.isEmpty())
getProject().log(NLS.bind(Messages.AbstractRepositoryTask_unableToFind, iu.toString()));
else {
- for (Iterator iterator = queryResult.iterator(); iterator.hasNext();) {
- IInstallableUnit unit = (IInstallableUnit) iterator.next();
- IArtifactKey[] keys = unit.getArtifacts();
+ for (Iterator<IInstallableUnit> iterator = queryResult.iterator(); iterator.hasNext();) {
+ IInstallableUnit unit = iterator.next();
+ List<IArtifactKey> keys = unit.getArtifacts();
Filter filter = null;
try {
filter = iu.getArtifactFilter();
@@ -83,11 +83,11 @@ public class RemoveIUTask extends AbstractRepositoryTask {
//we will only remove the metadata if all artifacts were removed
boolean removeMetadata = true;
- for (int i = 0; i < keys.length; i++) {
+ for (int i = 0; i < keys.size(); i++) {
if (filter == null) {
- artifacts.removeDescriptor(keys[i]);
+ artifacts.removeDescriptor(keys.get(i));
} else {
- IArtifactDescriptor[] descriptors = artifacts.getArtifactDescriptors(keys[i]);
+ IArtifactDescriptor[] descriptors = artifacts.getArtifactDescriptors(keys.get(i));
for (int j = 0; j < descriptors.length; j++) {
if (filter.match(createDictionary(descriptors[j]))) {
artifacts.removeDescriptor(descriptors[j]);
@@ -104,7 +104,7 @@ public class RemoveIUTask extends AbstractRepositoryTask {
}
if (toRemove.size() > 0) {
- repository.removeInstallableUnits((IInstallableUnit[]) toRemove.toArray(new IInstallableUnit[toRemove.size()]), null);
+ repository.removeInstallableUnits(toRemove.toArray(new IInstallableUnit[toRemove.size()]), null);
}
} catch (ProvisionException e) {
throw new BuildException(e);
@@ -117,8 +117,8 @@ public class RemoveIUTask extends AbstractRepositoryTask {
}
}
- private Dictionary createDictionary(IArtifactDescriptor descriptor) {
- Hashtable result = new Hashtable(5);
+ private Dictionary<String, Object> createDictionary(IArtifactDescriptor descriptor) {
+ Hashtable<String, Object> result = new Hashtable<String, Object>(5);
result.putAll(descriptor.getProperties());
IArtifactKey key = descriptor.getArtifactKey();
result.put(CLASSIFIER, key.getClassifier());
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/Repo2RunnableTask.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/Repo2RunnableTask.java
index 345fe23ec..28354fa02 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/Repo2RunnableTask.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/Repo2RunnableTask.java
@@ -17,6 +17,7 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
import org.eclipse.equinox.p2.internal.repository.tools.Messages;
import org.eclipse.equinox.p2.internal.repository.tools.Repo2Runnable;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.osgi.util.NLS;
/**
@@ -48,7 +49,7 @@ public class Repo2RunnableTask extends AbstractRepositoryTask {
try {
prepareSourceRepos();
application.initializeRepos(null);
- List ius = prepareIUs();
+ List<IInstallableUnit> ius = prepareIUs();
if ((ius == null || ius.size() == 0) && !(application.hasArtifactSources() || application.hasMetadataSources()))
throw new BuildException(Messages.exception_needIUsOrNonEmptyRepo);
application.setSourceIUs(ius);
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/RepositoryList.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/RepositoryList.java
index a76d3218d..8f31ce3a7 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/RepositoryList.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/RepositoryList.java
@@ -12,11 +12,12 @@ package org.eclipse.equinox.p2.internal.repository.tools.tasks;
import java.util.ArrayList;
import java.util.List;
+import org.apache.tools.ant.types.FileSet;
public class RepositoryList extends RepositoryFileSet {
// TODO this class should extend DataType, currently RepoFileSet to support <source location="xxx" />
- List repositories = new ArrayList();
- List sourceFileSets = new ArrayList();
+ List<DestinationRepository> repositories = new ArrayList<DestinationRepository>();
+ List<FileSet> sourceFileSets = new ArrayList<FileSet>();
public DestinationRepository createRepository() {
DestinationRepository repo = new DestinationRepository();
@@ -30,11 +31,11 @@ public class RepositoryList extends RepositoryFileSet {
return fileSet;
}
- public List getRepositoryList() {
+ public List<DestinationRepository> getRepositoryList() {
return repositories;
}
- public List getFileSetList() {
+ public List<FileSet> getFileSetList() {
//TODO this should eventually be removed
sourceFileSets.add(this);
return sourceFileSets;
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/SlicingOption.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/SlicingOption.java
index fcd8a6b37..774201a83 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/SlicingOption.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/SlicingOption.java
@@ -56,7 +56,7 @@ public class SlicingOption extends Task {
StringTokenizer tok = new StringTokenizer(platformFilter, ","); //$NON-NLS-1$
if (tok.countTokens() != 3)
throw new BuildException(NLS.bind(Messages.SlicingOption_invalid_platform, platformFilter));
- Dictionary filter = options.getFilter();
+ Dictionary<String, Object> filter = options.getFilter();
filter.put("osgi.os", tok.nextToken().trim()); //$NON-NLS-1$
filter.put("osgi.ws", tok.nextToken().trim()); //$NON-NLS-1$
filter.put("osgi.arch", tok.nextToken().trim()); //$NON-NLS-1$
@@ -68,7 +68,7 @@ public class SlicingOption extends Task {
}
public void setIncludeFeatures(boolean includeFeatures) {
- Dictionary filter = options.getFilter();
+ Dictionary<String, Object> filter = options.getFilter();
filter.put("org.eclipse.update.install.features", String.valueOf(includeFeatures)); //$NON-NLS-1$
options.setFilter(filter);
}
@@ -76,7 +76,7 @@ public class SlicingOption extends Task {
public void setFilter(String filterString) {
if (filterString == null || filterString.trim().equals("")) //$NON-NLS-1$
return;
- Dictionary filter = options.getFilter();
+ Dictionary<String, Object> filter = options.getFilter();
StringTokenizer tok = new StringTokenizer(filterString, ","); //$NON-NLS-1$
while (tok.hasMoreTokens()) {
String rule = tok.nextToken().trim();
diff --git a/bundles/org.eclipse.equinox.p2.repository/.classpath b/bundles/org.eclipse.equinox.p2.repository/.classpath
index 2fbb7a23e..64c5e31b7 100644
--- a/bundles/org.eclipse.equinox.p2.repository/.classpath
+++ b/bundles/org.eclipse.equinox.p2.repository/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <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.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
diff --git a/bundles/org.eclipse.equinox.p2.repository/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.repository/.settings/org.eclipse.jdt.core.prefs
index fe9a0e76d..50383c15a 100644
--- a/bundles/org.eclipse.equinox.p2.repository/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.equinox.p2.repository/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,4 @@
-#Mon May 04 16:59:04 EDT 2009
+#Tue Dec 22 19:20:12 CET 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
org.eclipse.jdt.core.builder.duplicateResourceTask=warning
@@ -7,17 +7,17 @@ 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.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.compliance=1.5
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.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
org.eclipse.jdt.core.compiler.problem.deadCode=warning
@@ -26,7 +26,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
@@ -88,7 +88,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enab
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.compiler.source=1.5
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
diff --git a/bundles/org.eclipse.equinox.p2.repository/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.repository/META-INF/MANIFEST.MF
index 7b5474923..fe190a10d 100644
--- a/bundles/org.eclipse.equinox.p2.repository/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.repository/META-INF/MANIFEST.MF
@@ -12,7 +12,8 @@ Require-Bundle: org.eclipse.equinox.common,
org.eclipse.equinox.registry;bundle-version="3.3.0",
org.eclipse.ecf.provider.filetransfer;bundle-version="3.0.1"
Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: J2SE-1.4,
+Bundle-RequiredExecutionEnvironment: J2SE-1.5,
+ J2SE-1.4,
CDC-1.1/Foundation-1.1
Bundle-Vendor: %providerName
Import-Package: javax.xml.parsers,
diff --git a/bundles/org.eclipse.equinox.p2.repository/build.properties b/bundles/org.eclipse.equinox.p2.repository/build.properties
index 42c5dd351..7ac06b41b 100644
--- a/bundles/org.eclipse.equinox.p2.repository/build.properties
+++ b/bundles/org.eclipse.equinox.p2.repository/build.properties
@@ -15,3 +15,5 @@ bin.includes = META-INF/,\
about.html,\
plugin.properties
src.includes = about.html
+javacTarget=jsr14
+javacSource=1.5
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/CompositeParser.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/CompositeParser.java
index 521e1966e..3944fe1c2 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/CompositeParser.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/CompositeParser.java
@@ -34,20 +34,20 @@ public class CompositeParser extends XMLParser implements XMLConstants {
private CompositeRepositoryState theState;
protected class ChildrenHandler extends AbstractHandler {
- private ArrayList children;
+ private ArrayList<URI> children;
public ChildrenHandler(AbstractHandler parentHandler, Attributes attributes) {
super(parentHandler, CHILDREN_ELEMENT);
String size = parseOptionalAttribute(attributes, COLLECTION_SIZE_ATTRIBUTE);
- children = (size != null ? new ArrayList(new Integer(size).intValue()) : new ArrayList(4));
+ children = (size != null ? new ArrayList<URI>(new Integer(size).intValue()) : new ArrayList<URI>(4));
}
public URI[] getChildren() {
int size = children.size();
URI[] result = new URI[size];
int i = 0;
- for (Iterator it = children.iterator(); it.hasNext(); i++) {
- result[i] = (URI) it.next();
+ for (Iterator<URI> it = children.iterator(); it.hasNext(); i++) {
+ result[i] = it.next();
}
return result;
}
@@ -67,9 +67,9 @@ public class CompositeParser extends XMLParser implements XMLConstants {
URI currentRepo = null;
- private List repos;
+ private List<URI> repos;
- public ChildHandler(AbstractHandler parentHandler, Attributes attributes, List repos) {
+ public ChildHandler(AbstractHandler parentHandler, Attributes attributes, List<URI> repos) {
super(parentHandler, CHILD_ELEMENT);
String[] values = parseAttributes(attributes, required, optional);
this.repos = repos;
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/CompositeRepositoryState.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/CompositeRepositoryState.java
index 83f7795a6..8a5fe9841 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/CompositeRepositoryState.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/CompositeRepositoryState.java
@@ -24,7 +24,7 @@ public class CompositeRepositoryState {
private String provider;
private String description;
private URI location;
- private Map properties;
+ private Map<String, String> properties;
private URI[] children;
public void setName(String value) {
@@ -75,11 +75,11 @@ public class CompositeRepositoryState {
return location;
}
- public void setProperties(Map value) {
+ public void setProperties(Map<String, String> value) {
properties = value;
}
- public Map getProperties() {
+ public Map<String, String> getProperties() {
return properties;
}
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/XMLParser.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/XMLParser.java
index 62b3087f0..4266d2539 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/XMLParser.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/XMLParser.java
@@ -454,7 +454,7 @@ public abstract class XMLParser extends DefaultHandler implements XMLConstants {
parseAttributes(attributes, noAttributes, noAttributes);
}
- public TextHandler(AbstractHandler parent, String elementName, Attributes attributes, List texts) {
+ public TextHandler(AbstractHandler parent, String elementName, Attributes attributes, List<String> texts) {
super(parent, elementName);
parseAttributes(attributes, noAttributes, noAttributes);
}
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/XMLWriter.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/XMLWriter.java
index eb11327ce..2a7252bba 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/XMLWriter.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/XMLWriter.java
@@ -12,6 +12,7 @@ package org.eclipse.equinox.internal.p2.persistence;
import java.io.*;
import java.util.*;
+import java.util.Map.Entry;
import org.eclipse.equinox.internal.provisional.p2.metadata.Version;
public class XMLWriter implements XMLConstants {
@@ -51,7 +52,7 @@ public class XMLWriter implements XMLConstants {
}
}
- private Stack elements; // XML elements that have not yet been closed
+ private Stack<String> elements; // XML elements that have not yet been closed
private boolean open; // Can attributes be added to the current element?
private String indent; // used for each level of indentation
@@ -60,7 +61,7 @@ public class XMLWriter implements XMLConstants {
public XMLWriter(OutputStream output, ProcessingInstruction[] piElements) throws UnsupportedEncodingException {
this.pw = new PrintWriter(new OutputStreamWriter(output, "UTF8"), false); //$NON-NLS-1$
println(ProcessingInstruction.XML_UTF8);
- this.elements = new Stack();
+ this.elements = new Stack<String>();
this.open = false;
this.indent = " "; //$NON-NLS-1$
if (piElements != null) {
@@ -101,7 +102,7 @@ public class XMLWriter implements XMLConstants {
if (this.elements.empty()) {
throw new EndWithoutStartError();
}
- String name = (String) this.elements.pop();
+ String name = this.elements.pop();
if (this.open) {
println("/>"); //$NON-NLS-1$
} else {
@@ -217,17 +218,17 @@ public class XMLWriter implements XMLConstants {
this.pw.flush();
}
- public void writeProperties(Map properties) {
+ public void writeProperties(Map<String, String> properties) {
writeProperties(PROPERTIES_ELEMENT, properties);
}
- public void writeProperties(String propertiesElement, Map properties) {
+ public void writeProperties(String propertiesElement, Map<String, String> properties) {
if (properties != null && properties.size() > 0) {
start(propertiesElement);
attribute(COLLECTION_SIZE_ATTRIBUTE, properties.size());
- for (Iterator iter = properties.keySet().iterator(); iter.hasNext();) {
- String name = (String) iter.next();
- writeProperty(name, (String) properties.get(name));
+ for (Iterator<Entry<String, String>> iter = properties.entrySet().iterator(); iter.hasNext();) {
+ Entry<String, String> entry = iter.next();
+ writeProperty(entry.getKey(), entry.getValue());
}
end(propertiesElement);
}
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/CacheManager.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/CacheManager.java
index e4fa76fc7..6e69be2fe 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/CacheManager.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/CacheManager.java
@@ -77,7 +77,7 @@ public class CacheManager {
private static final String RESUME_DEFAULT = "true"; //$NON-NLS-1$
private static final String XML_EXTENSION = ".xml"; //$NON-NLS-1$
- private final HashSet knownPrefixes = new HashSet(5);
+ private final HashSet<String> knownPrefixes = new HashSet<String>(5);
/**
* Returns a hash of the repository location.
@@ -216,8 +216,8 @@ public class CacheManager {
* @param repositoryLocation
*/
void deleteCache(URI repositoryLocation) {
- for (Iterator it = knownPrefixes.iterator(); it.hasNext();) {
- String prefix = (String) it.next();
+ for (Iterator<String> it = knownPrefixes.iterator(); it.hasNext();) {
+ String prefix = it.next();
File[] cacheFiles = getCacheFiles(repositoryLocation, prefix);
for (int i = 0; i < cacheFiles.length; i++) {
// delete the cache file if it exists
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/Credentials.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/Credentials.java
index 958e1b512..1e9c143b4 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/Credentials.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/Credentials.java
@@ -39,13 +39,13 @@ public class Credentials {
/**
* Cache of auth information that is not persisted, and modified auth info.
*/
- private static final Map savedAuthInfo = Collections.synchronizedMap(new HashMap());
+ private static final Map<String, AuthenticationInfo> savedAuthInfo = Collections.synchronizedMap(new HashMap<String, AuthenticationInfo>());
/**
* Information about retry counts, and prompts canceled by user. The SoftReference is
* a Map if not null. The keys are also used as serialization per host.
*/
- private static Map remembered;
+ private static Map<String, HostEntry> remembered;
/**
* Serializes pop up of login/password prompt
@@ -118,8 +118,8 @@ public class Credentials {
// Start by getting a key to lock on
HostEntry hostLock = null;
synchronized (Credentials.class) {
- Map r = getRemembered();
- hostLock = (HostEntry) r.get(host);
+ Map<String, HostEntry> r = getRemembered();
+ hostLock = r.get(host);
if (hostLock == null) {
hostLock = new HostEntry(0);
r.put(host, hostLock);
@@ -321,7 +321,7 @@ public class Credentials {
* or <code>null</code> if no information is stored.
*/
private static AuthenticationInfo restoreFromMemory(String nodeName) {
- return (AuthenticationInfo) savedAuthInfo.get(nodeName);
+ return savedAuthInfo.get(nodeName);
}
/**
@@ -336,7 +336,7 @@ public class Credentials {
* @param host
*/
private static void rememberCancel(String host) {
- Map r = getRemembered();
+ Map<String, HostEntry> r = getRemembered();
if (r != null)
r.put(host, new HostEntry(-1));
}
@@ -348,7 +348,7 @@ public class Credentials {
* @throws LoginCanceledException
*/
private static void checkRememberedCancel(String host) throws LoginCanceledException {
- Map r = getRemembered();
+ Map<String, HostEntry> r = getRemembered();
if (r != null) {
Object x = r.get(host);
if (x != null && x instanceof HostEntry)
@@ -370,9 +370,9 @@ public class Credentials {
* @param host
*/
private static void incrementPromptCount(String host) {
- Map r = getRemembered();
+ Map<String, HostEntry> r = getRemembered();
if (r != null) {
- HostEntry value = (HostEntry) r.get(host);
+ HostEntry value = r.get(host);
if (value == null)
r.put(host, value = new HostEntry(1));
else {
@@ -389,9 +389,9 @@ public class Credentials {
* @return number of time prompt has been performed for a host (or 0 if information is stale)
*/
private static int getPromptCount(String host) {
- Map r = getRemembered();
+ Map<String, HostEntry> r = getRemembered();
if (r != null) {
- HostEntry value = (HostEntry) r.get(host);
+ HostEntry value = r.get(host);
if (value != null && !value.isStale())
return value.getCount();
}
@@ -406,14 +406,14 @@ public class Credentials {
public static synchronized void clearPromptCache() {
if (remembered == null)
return;
- Map r = remembered;
+ Map<String, HostEntry> r = remembered;
if (r == null || r.isEmpty())
return;
// reset entries rather than creating a new empty map since the entries
// are also used as locks
- Iterator itor = r.entrySet().iterator();
+ Iterator<HostEntry> itor = r.values().iterator();
while (itor.hasNext())
- ((HostEntry) itor.next()).reset();
+ itor.next().reset();
}
/**
@@ -433,17 +433,17 @@ public class Credentials {
public static synchronized void clearPromptCache(String host) {
if (remembered == null)
return;
- Map r = remembered;
+ Map<String, HostEntry> r = remembered;
if (r == null)
return;
- HostEntry value = (HostEntry) r.get(host);
+ HostEntry value = r.get(host);
if (value != null)
value.reset();
}
- private static synchronized Map getRemembered() {
+ private static synchronized Map<String, HostEntry> getRemembered() {
if (remembered == null)
- remembered = Collections.synchronizedMap(new HashMap());
+ remembered = Collections.synchronizedMap(new HashMap<String, HostEntry>());
return remembered;
}
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/ProgressStatistics.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/ProgressStatistics.java
index 4fb5f157e..311c8b42f 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/ProgressStatistics.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/ProgressStatistics.java
@@ -15,7 +15,6 @@ package org.eclipse.equinox.internal.p2.repository;
import java.net.URI;
import java.text.NumberFormat;
import java.util.*;
-import java.util.Map.Entry;
import org.eclipse.osgi.util.NLS;
/**
@@ -54,7 +53,7 @@ public class ProgressStatistics {
private int m_reportInterval;
- private SortedMap m_recentSpeedMap;
+ private SortedMap<Long, Long> m_recentSpeedMap;
private long m_recentSpeedMapKey;
@@ -69,7 +68,7 @@ public class ProgressStatistics {
m_current = 0;
m_lastReportTime = 0;
m_reportInterval = DEFAULT_REPORT_INTERVAL;
- m_recentSpeedMap = new TreeMap();
+ m_recentSpeedMap = new TreeMap<Long, Long>();
m_recentSpeedMapKey = 0L;
m_uri = uri;
}
@@ -96,13 +95,12 @@ public class ProgressStatistics {
removeObsoleteRecentSpeedData(getDuration() / SPEED_RESOLUTION);
long dur = 0L;
long amount = 0L;
- SortedMap relevantData = m_recentSpeedMap.headMap(new Long(m_recentSpeedMapKey));
+ SortedMap<Long, Long> relevantData = m_recentSpeedMap.headMap(new Long(m_recentSpeedMapKey));
- Iterator itor = relevantData.entrySet().iterator();
+ Iterator<Long> itor = relevantData.values().iterator();
while (itor.hasNext()) {
- Entry entry = (Entry) itor.next();
dur += SPEED_RESOLUTION;
- amount += ((Long) entry.getValue()).longValue();
+ amount += itor.next().longValue();
}
if (dur >= 1000)
@@ -147,7 +145,7 @@ public class ProgressStatistics {
synchronized private void registerRecentSpeed(long key, long inc) {
Long keyL = new Long(key);
- Long currentValueL = (Long) m_recentSpeedMap.get(keyL);
+ Long currentValueL = m_recentSpeedMap.get(keyL);
long currentValue = 0L;
if (currentValueL != null)
currentValue = currentValueL.longValue();
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/RepositoryStatusHelper.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/RepositoryStatusHelper.java
index 601a2da4d..b3d5d5ec6 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/RepositoryStatusHelper.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/RepositoryStatusHelper.java
@@ -122,7 +122,7 @@ public abstract class RepositoryStatusHelper {
public static Throwable unwind(Throwable t) {
for (;;) {
- Class tc = t.getClass();
+ Class<? extends Throwable> tc = t.getClass();
// We don't use instanceof operator since we want
// the explicit class, not subclasses.
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java
index a52eae1fb..2908a0df4 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java
@@ -37,15 +37,15 @@ import org.osgi.service.prefs.Preferences;
/**
* Common code shared between artifact and metadata repository managers.
*/
-public abstract class AbstractRepositoryManager implements IRepositoryManager, ProvisioningListener {
- protected static class RepositoryInfo {
+public abstract class AbstractRepositoryManager<T> implements IRepositoryManager<T>, ProvisioningListener {
+ protected static class RepositoryInfo<R> {
public String description;
public boolean isEnabled = true;
public boolean isSystem = false;
public URI location;
public String name;
public String nickname;
- public SoftReference repository;
+ public SoftReference<IRepository<R>> repository;
public String suffix;
public RepositoryInfo() {
@@ -74,7 +74,7 @@ public abstract class AbstractRepositoryManager implements IRepositoryManager, P
* Map of String->RepositoryInfo, where String is the repository key
* obtained via getKey(URI).
*/
- protected Map repositories = null;
+ protected Map<String, RepositoryInfo<T>> repositories = null;
//lock object to be held when referring to the repositories field
protected final Object repositoryLock = new Object();
@@ -83,12 +83,12 @@ public abstract class AbstractRepositoryManager implements IRepositoryManager, P
* Cache List of repositories that are not reachable. Maintain cache
* for short duration because repository may become available at any time.
*/
- protected SoftReference unavailableRepositories;
+ protected SoftReference<List<URI>> unavailableRepositories;
/**
* Set used to manage exclusive load locks on repository locations.
*/
- private Map loadLocks = new HashMap();
+ private Map<URI, Thread> loadLocks = new HashMap<URI, Thread>();
protected IProvisioningEventBus eventBus;
private IAgentLocation agentLocation;
protected IProvisioningAgent agent;
@@ -103,23 +103,23 @@ public abstract class AbstractRepositoryManager implements IRepositoryManager, P
* @param signalAdd whether a repository change event should be fired
* @param suffix the suffix used to load the repository, or <code>null</code> if unknown
*/
- protected void addRepository(IRepository repository, boolean signalAdd, String suffix) {
+ protected void addRepository(IRepository<T> repository, boolean signalAdd, String suffix) {
boolean added = false;
synchronized (repositoryLock) {
if (repositories == null)
restoreRepositories();
String key = getKey(repository.getLocation());
- RepositoryInfo info = (RepositoryInfo) repositories.get(key);
+ RepositoryInfo<T> info = repositories.get(key);
if (info == null) {
- info = new RepositoryInfo();
+ info = new RepositoryInfo<T>();
added = true;
repositories.put(key, info);
}
- info.repository = new SoftReference(repository);
+ info.repository = new SoftReference<IRepository<T>>(repository);
info.name = repository.getName();
info.description = repository.getDescription();
info.location = repository.getLocation();
- String value = (String) repository.getProperties().get(IRepository.PROP_SYSTEM);
+ String value = repository.getProperties().get(IRepository.PROP_SYSTEM);
if (value != null)
info.isSystem = Boolean.valueOf(value).booleanValue();
info.suffix = suffix;
@@ -149,7 +149,7 @@ public abstract class AbstractRepositoryManager implements IRepositoryManager, P
* <code>false</code> otherwise.
*/
private boolean addRepository(URI location, boolean isEnabled, boolean signalAdd) {
- RepositoryInfo info = new RepositoryInfo();
+ RepositoryInfo<T> info = new RepositoryInfo<T>();
info.location = location;
info.isEnabled = isEnabled;
boolean added = true;
@@ -167,15 +167,15 @@ public abstract class AbstractRepositoryManager implements IRepositoryManager, P
return added;
}
- protected IRepository basicGetRepository(URI location) {
+ protected IRepository<T> basicGetRepository(URI location) {
checkValidLocation(location);
synchronized (repositoryLock) {
if (repositories == null)
restoreRepositories();
- RepositoryInfo info = (RepositoryInfo) repositories.get(getKey(location));
+ RepositoryInfo<T> info = repositories.get(getKey(location));
if (info == null || info.repository == null)
return null;
- IRepository repo = (IRepository) info.repository.get();
+ IRepository<T> repo = info.repository.get();
//update our repository info because the repository may have changed
if (repo != null)
addRepository(repo, false, null);
@@ -183,7 +183,7 @@ public abstract class AbstractRepositoryManager implements IRepositoryManager, P
}
}
- public IRepository basicRefreshRepository(URI location, IProgressMonitor monitor) throws ProvisionException {
+ public IRepository<T> basicRefreshRepository(URI location, IProgressMonitor monitor) throws ProvisionException {
checkValidLocation(location);
clearNotFound(location);
boolean wasEnabled = isEnabled(location);
@@ -193,7 +193,7 @@ public abstract class AbstractRepositoryManager implements IRepositoryManager, P
fail(location, ProvisionException.REPOSITORY_NOT_FOUND);
boolean loaded = false;
try {
- IRepository result = loadRepository(location, monitor, null, 0);
+ IRepository<T> result = loadRepository(location, monitor, null, 0);
loaded = true;
setEnabled(location, wasEnabled);
return result;
@@ -219,7 +219,7 @@ public abstract class AbstractRepositoryManager implements IRepositoryManager, P
private boolean checkNotFound(URI location) {
if (unavailableRepositories == null)
return false;
- List badRepos = (List) unavailableRepositories.get();
+ List<URI> badRepos = unavailableRepositories.get();
if (badRepos == null)
return false;
return badRepos.contains(location);
@@ -229,9 +229,9 @@ public abstract class AbstractRepositoryManager implements IRepositoryManager, P
* Clear the fact that we tried to load a repository at this location and did not find anything.
*/
private void clearNotFound(URI location) {
- List badRepos;
+ List<URI> badRepos;
if (unavailableRepositories != null) {
- badRepos = (List) unavailableRepositories.get();
+ badRepos = unavailableRepositories.get();
if (badRepos != null) {
badRepos.remove(location);
return;
@@ -254,11 +254,11 @@ public abstract class AbstractRepositoryManager implements IRepositoryManager, P
/* (non-Javadoc)
* @see org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager#createRepository(java.net.URL, java.lang.String, java.lang.String, java.util.Map)
*/
- protected IRepository doCreateRepository(URI location, String name, String type, Map properties) throws ProvisionException {
+ protected IRepository<T> doCreateRepository(URI location, String name, String type, Map<String, String> properties) throws ProvisionException {
checkValidLocation(location);
Assert.isNotNull(name);
Assert.isNotNull(type);
- IRepository result = null;
+ IRepository<T> result = null;
try {
enterLoad(location, new NullProgressMonitor());
boolean loaded = false;
@@ -326,7 +326,7 @@ public abstract class AbstractRepositoryManager implements IRepositoryManager, P
Thread current = Thread.currentThread();
synchronized (loadLocks) {
while (true) {
- Thread owner = (Thread) loadLocks.get(location);
+ Thread owner = loadLocks.get(location);
if (owner == null || current.equals(owner))
break;
if (monitor.isCanceled())
@@ -357,13 +357,13 @@ public abstract class AbstractRepositoryManager implements IRepositoryManager, P
* Creates and returns a repository using the given repository factory extension. Returns
* null if no factory could be found associated with that extension.
*/
- protected abstract IRepository factoryCreate(URI location, String name, String type, Map properties, IExtension extension) throws ProvisionException;
+ protected abstract IRepository<T> factoryCreate(URI location, String name, String type, Map<String, String> properties, IExtension extension) throws ProvisionException;
/**
* Loads and returns a repository using the given repository factory extension. Returns
* null if no factory could be found associated with that extension.
*/
- protected abstract IRepository factoryLoad(URI location, IExtension extension, int flags, SubMonitor monitor) throws ProvisionException;
+ protected abstract IRepository<T> factoryLoad(URI location, IExtension extension, int flags, SubMonitor monitor) throws ProvisionException;
private void fail(URI location, int code) throws ProvisionException {
String msg = null;
@@ -419,7 +419,7 @@ public abstract class AbstractRepositoryManager implements IRepositoryManager, P
protected String[] getAllSuffixes() {
IConfigurationElement[] elements = RegistryFactory.getRegistry().getConfigurationElementsFor(getRepositoryProviderExtensionPointId());
- ArrayList result = new ArrayList(elements.length);
+ ArrayList<String> result = new ArrayList<String>(elements.length);
result.add(getDefaultSuffix());
for (int i = 0; i < elements.length; i++) {
if (elements[i].getName().equals(EL_FILTER)) {
@@ -428,7 +428,7 @@ public abstract class AbstractRepositoryManager implements IRepositoryManager, P
result.add(suffix);
}
}
- return (String[]) result.toArray(new String[result.size()]);
+ return result.toArray(new String[result.size()]);
}
/**
@@ -463,14 +463,14 @@ public abstract class AbstractRepositoryManager implements IRepositoryManager, P
synchronized (repositoryLock) {
if (repositories == null)
restoreRepositories();
- ArrayList result = new ArrayList();
+ ArrayList<URI> result = new ArrayList<URI>();
int i = 0;
- for (Iterator it = repositories.values().iterator(); it.hasNext(); i++) {
- RepositoryInfo info = (RepositoryInfo) it.next();
+ for (Iterator<RepositoryInfo<T>> it = repositories.values().iterator(); it.hasNext(); i++) {
+ RepositoryInfo<T> info = it.next();
if (matchesFlags(info, flags))
result.add(info.location);
}
- return (URI[]) result.toArray(new URI[result.size()]);
+ return result.toArray(new URI[result.size()]);
}
}
@@ -532,7 +532,7 @@ public abstract class AbstractRepositoryManager implements IRepositoryManager, P
synchronized (repositoryLock) {
if (repositories == null)
restoreRepositories();
- RepositoryInfo info = (RepositoryInfo) repositories.get(getKey(location));
+ RepositoryInfo<T> info = repositories.get(getKey(location));
if (info == null)
return null;// Repository not found
if (IRepository.PROP_DESCRIPTION.equals(key))
@@ -556,7 +556,7 @@ public abstract class AbstractRepositoryManager implements IRepositoryManager, P
synchronized (repositoryLock) {
if (repositories == null)
restoreRepositories();
- RepositoryInfo info = (RepositoryInfo) repositories.get(getKey(location));
+ RepositoryInfo<T> info = repositories.get(getKey(location));
if (info == null)
return;// Repository not found
if (IRepository.PROP_DESCRIPTION.equals(key))
@@ -595,7 +595,7 @@ public abstract class AbstractRepositoryManager implements IRepositoryManager, P
synchronized (repositoryLock) {
if (repositories == null)
restoreRepositories();
- RepositoryInfo info = (RepositoryInfo) repositories.get(getKey(location));
+ RepositoryInfo<T> info = repositories.get(getKey(location));
if (info != null)
return info.isEnabled;
// Repository not found, return false
@@ -603,12 +603,12 @@ public abstract class AbstractRepositoryManager implements IRepositoryManager, P
}
}
- protected IRepository loadRepository(URI location, IProgressMonitor monitor, String type, int flags) throws ProvisionException {
+ protected IRepository<T> loadRepository(URI location, IProgressMonitor monitor, String type, int flags) throws ProvisionException {
checkValidLocation(location);
if (monitor == null)
monitor = new NullProgressMonitor();
boolean added = false;
- IRepository result = null;
+ IRepository<T> result = null;
try {
enterLoad(location, monitor);
@@ -673,13 +673,13 @@ public abstract class AbstractRepositoryManager implements IRepositoryManager, P
return location;
}
- private IRepository loadRepository(URI location, String suffix, String type, int flags, SubMonitor monitor) throws ProvisionException {
+ private IRepository<T> loadRepository(URI location, String suffix, String type, int flags, SubMonitor monitor) throws ProvisionException {
IExtension[] providers = findMatchingRepositoryExtensions(suffix, type);
// Loop over the candidates and return the first one that successfully loads
monitor.beginTask("", providers.length * 10); //$NON-NLS-1$
for (int i = 0; i < providers.length; i++)
try {
- IRepository repo = factoryLoad(location, providers[i], flags, monitor);
+ IRepository<T> repo = factoryLoad(location, providers[i], flags, monitor);
if (repo != null)
return repo;
} catch (ProvisionException e) {
@@ -702,7 +702,7 @@ public abstract class AbstractRepositoryManager implements IRepositoryManager, P
LogHelper.log(new Status(IStatus.ERROR, getBundleId(), message, t));
}
- private boolean matchesFlags(RepositoryInfo info, int flags) {
+ private boolean matchesFlags(RepositoryInfo<T> info, int flags) {
if ((flags & REPOSITORIES_SYSTEM) == REPOSITORIES_SYSTEM)
if (!info.isSystem)
return false;
@@ -751,7 +751,7 @@ public abstract class AbstractRepositoryManager implements IRepositoryManager, P
/*
* Add the given repository object to the preferences and save.
*/
- private void remember(IRepository repository, String suffix) {
+ private void remember(IRepository<T> repository, String suffix) {
boolean changed = false;
Preferences node = getPreferences();
// Ensure we retrieved preferences
@@ -768,7 +768,7 @@ public abstract class AbstractRepositoryManager implements IRepositoryManager, P
changed |= putValue(node, KEY_TYPE, repository.getType());
changed |= putValue(node, KEY_VERSION, repository.getVersion());
//allow repository manager to define system property if it is undefined in the repository itself
- String value = (String) repository.getProperties().get(IRepository.PROP_SYSTEM);
+ String value = repository.getProperties().get(IRepository.PROP_SYSTEM);
if (value != null)
changed |= putValue(node, KEY_SYSTEM, value);
changed |= putValue(node, KEY_SUFFIX, suffix);
@@ -786,7 +786,7 @@ public abstract class AbstractRepositoryManager implements IRepositoryManager, P
* @param flush <code>true</code> if the preference node should be flushed to
* disk, and <code>false</code> otherwise
*/
- private boolean remember(RepositoryInfo info, boolean flush) {
+ private boolean remember(RepositoryInfo<T> info, boolean flush) {
boolean changed = false;
Preferences node = getPreferences();
// Ensure we retrieved preferences
@@ -815,17 +815,17 @@ public abstract class AbstractRepositoryManager implements IRepositoryManager, P
* Cache the fact that we tried to load a repository at this location and did not find anything.
*/
private void rememberNotFound(URI location) {
- List badRepos;
+ List<URI> badRepos;
if (unavailableRepositories != null) {
- badRepos = (List) unavailableRepositories.get();
+ badRepos = unavailableRepositories.get();
if (badRepos != null) {
badRepos.add(location);
return;
}
}
- badRepos = new ArrayList();
+ badRepos = new ArrayList<URI>();
badRepos.add(location);
- unavailableRepositories = new SoftReference(badRepos);
+ unavailableRepositories = new SoftReference<List<URI>>(badRepos);
}
public boolean removeRepository(URI toRemove) {
@@ -889,7 +889,7 @@ public abstract class AbstractRepositoryManager implements IRepositoryManager, P
log("Error removing invalid repository", e); //$NON-NLS-1$
}
}
- RepositoryInfo info = new RepositoryInfo();
+ RepositoryInfo<T> info = new RepositoryInfo<T>();
info.location = location;
info.name = child.get(KEY_NAME, null);
info.nickname = child.get(KEY_NICKNAME, null);
@@ -922,7 +922,7 @@ public abstract class AbstractRepositoryManager implements IRepositoryManager, P
*/
private void restoreRepositories() {
synchronized (repositoryLock) {
- repositories = new HashMap();
+ repositories = new HashMap<String, RepositoryInfo<T>>();
restoreSpecialRepositories();
restoreFromSystemProperty();
restoreFromPreferences();
@@ -957,7 +957,7 @@ public abstract class AbstractRepositoryManager implements IRepositoryManager, P
synchronized (repositoryLock) {
if (repositories == null)
restoreRepositories();
- RepositoryInfo info = (RepositoryInfo) repositories.get(getKey(location));
+ RepositoryInfo<T> info = repositories.get(getKey(location));
if (info == null || info.isEnabled == enablement)
return;
info.isEnabled = enablement;
@@ -1018,8 +1018,8 @@ public abstract class AbstractRepositoryManager implements IRepositoryManager, P
boolean changed = false;
synchronized (repositoryLock) {
if (repositories != null) {
- for (Iterator it = repositories.values().iterator(); it.hasNext();) {
- RepositoryInfo info = (RepositoryInfo) it.next();
+ for (Iterator<RepositoryInfo<T>> it = repositories.values().iterator(); it.hasNext();) {
+ RepositoryInfo<T> info = it.next();
changed |= remember(info, false);
}
}
@@ -1041,7 +1041,7 @@ public abstract class AbstractRepositoryManager implements IRepositoryManager, P
synchronized (repositoryLock) {
if (repositories == null)
restoreRepositories();
- RepositoryInfo info = (RepositoryInfo) repositories.get(getKey(location));
+ RepositoryInfo<T> info = repositories.get(getKey(location));
if (info == null || info.suffix == null)
return suffixes;
//move lastSuffix to the front of the list but preserve order of remaining entries
@@ -1076,9 +1076,9 @@ public abstract class AbstractRepositoryManager implements IRepositoryManager, P
* reporting is not desired
* @return A collector containing the results of the query
*/
- public IQueryResult query(IQuery query, IProgressMonitor monitor) {
+ public IQueryResult<T> query(IQuery<T> query, IProgressMonitor monitor) {
URI[] locations = getKnownRepositories(REPOSITORIES_ALL);
- List queryables = new ArrayList(locations.length); // use a list since we don't know exactly how many will load
+ List<IRepository<T>> queryables = new ArrayList<IRepository<T>>(locations.length); // use a list since we don't know exactly how many will load
SubMonitor sub = SubMonitor.convert(monitor, locations.length * 10);
for (int i = 0; i < locations.length; i++) {
try {
@@ -1090,8 +1090,9 @@ public abstract class AbstractRepositoryManager implements IRepositoryManager, P
}
}
try {
- IQueryable[] queryablesArray = (IQueryable[]) queryables.toArray(new IQueryable[queryables.size()]);
- CompoundQueryable compoundQueryable = new CompoundQueryable(queryablesArray);
+ @SuppressWarnings("unchecked")
+ IQueryable<T>[] queryablesArray = queryables.toArray(new IQueryable[queryables.size()]);
+ CompoundQueryable<T> compoundQueryable = new CompoundQueryable<T>(queryablesArray);
return compoundQueryable.query(query, sub.newChild(locations.length * 1));
} finally {
sub.done();
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/DebugHelper.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/DebugHelper.java
index f230f47c5..7c391de48 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/DebugHelper.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/DebugHelper.java
@@ -11,6 +11,7 @@
package org.eclipse.equinox.internal.p2.repository.helpers;
import java.util.*;
+import java.util.Map.Entry;
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
import org.eclipse.equinox.internal.p2.repository.Activator;
import org.eclipse.osgi.service.debug.DebugOptions;
@@ -49,7 +50,7 @@ public class DebugHelper {
if (keyValueArray == null || keyValueArray.length == 0)
debug(name, message);
else {
- Map params = new LinkedHashMap(keyValueArray.length / 2);
+ Map<Object, Object> params = new LinkedHashMap<Object, Object>(keyValueArray.length / 2);
for (int i = 0; i < keyValueArray.length; i += 2)
params.put(keyValueArray[i], keyValueArray[i + 1]);
StringBuffer buffer = new StringBuffer();
@@ -95,15 +96,15 @@ public class DebugHelper {
return buffer.toString();
}
- public static String formatMap(Map map, boolean toString, boolean newLines) {
+ public static String formatMap(Map<?, ?> map, boolean toString, boolean newLines) {
if (map == null || map.size() == 0)
return "[]"; //$NON-NLS-1$
StringBuffer buffer = new StringBuffer();
buffer.append('[');
- Iterator itor = map.entrySet().iterator();
+ Iterator<? extends Entry<?, ?>> itor = map.entrySet().iterator();
while (itor.hasNext()) {
- Map.Entry e = (Map.Entry) itor.next();
+ Entry<?, ?> e = itor.next();
buffer.append(e.getKey());
buffer.append('=');
if (toString)
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/RepositoryHelper.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/RepositoryHelper.java
index 9b235f148..050693f9e 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/RepositoryHelper.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/RepositoryHelper.java
@@ -53,7 +53,7 @@ public class RepositoryHelper {
* @param repository the repository to test
* @return the repository
*/
- public static IRepository validDestinationRepository(IRepository repository) {
+ public static <T> IRepository<T> validDestinationRepository(IRepository<T> repository) {
if (!repository.isModifiable())
throw new IllegalStateException(NLS.bind(Messages.DestinationNotModifiable, repository.getLocation()));
return repository;
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/repository/AbstractRepository.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/repository/AbstractRepository.java
index cdc7c22ce..d4ba3de13 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/repository/AbstractRepository.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/repository/AbstractRepository.java
@@ -23,16 +23,16 @@ import org.eclipse.equinox.p2.repository.IRepository;
* Clients may extend this class.
* </p>
*/
-public abstract class AbstractRepository extends PlatformObject implements IRepository {
+public abstract class AbstractRepository<T> extends PlatformObject implements IRepository<T> {
protected String description;
protected transient URI location;
protected String name;
- protected Map properties = new OrderedProperties();
+ protected Map<String, String> properties = new OrderedProperties();
protected String provider;
protected String type;
protected String version;
- protected AbstractRepository(String name, String type, String version, URI location, String description, String provider, Map properties) {
+ protected AbstractRepository(String name, String type, String version, URI location, String description, String provider, Map<String, String> properties) {
this.name = name;
this.type = type;
this.version = version;
@@ -83,7 +83,7 @@ public abstract class AbstractRepository extends PlatformObject implements IRepo
* Returns a read-only collection of the properties of the repository.
* @return the properties of this repository.
*/
- public synchronized Map getProperties() {
+ public synchronized Map<String, String> getProperties() {
return OrderedProperties.unmodifiableProperties(properties);
}
@@ -125,7 +125,7 @@ public abstract class AbstractRepository extends PlatformObject implements IRepo
public synchronized String setProperty(String key, String value) {
assertModifiable();
- return (String) (value == null ? properties.remove(key) : properties.put(key, value));
+ return (value == null ? properties.remove(key) : properties.put(key, value));
}
public synchronized void setProvider(String provider) {
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/ICompositeRepository.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/ICompositeRepository.java
index aed6bc7f3..1bfada5b9 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/ICompositeRepository.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/ICompositeRepository.java
@@ -16,12 +16,12 @@ import java.util.List;
/**
* @since 2.0
*/
-public interface ICompositeRepository extends IRepository {
+public interface ICompositeRepository<T> extends IRepository<T> {
/**
*
* @return a list of URIs containing the locations of the children repositories
*/
- public abstract List getChildren();
+ public abstract List<URI> getChildren();
/**
* Removes all child repositories
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/IRepository.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/IRepository.java
index 91b4f9138..c5795994e 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/IRepository.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/IRepository.java
@@ -22,7 +22,7 @@ import org.eclipse.equinox.internal.provisional.p2.metadata.query.IQueryable;
* @noimplement This interface is not intended to be implemented by clients.
* @since 2.0
*/
-public interface IRepository extends IAdaptable, IQueryable {
+public interface IRepository<T> extends IAdaptable, IQueryable<T> {
/**
* The key for a boolean property indicating that the repository
* is a system repository. System repositories are implementation details
@@ -154,7 +154,7 @@ public interface IRepository extends IAdaptable, IQueryable {
* Returns a read-only collection of the properties of the repository.
* @return the properties of this repository.
*/
- public Map getProperties();
+ public Map<String, String> getProperties();
/**
* Returns <code>true</code> if this repository can be modified.
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/IRepositoryManager.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/IRepositoryManager.java
index dfe7bfe40..b235f094f 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/IRepositoryManager.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/IRepositoryManager.java
@@ -29,7 +29,7 @@ import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryEvent;
* @noimplement This interface is not intended to be implemented by clients.
* @since 2.0
*/
-public interface IRepositoryManager extends IQueryable {
+public interface IRepositoryManager<T> extends IQueryable<T> {
/**
* Constant used to indicate that all enabled repositories are of interest.
*/
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/ArtifactDescriptorQuery.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/ArtifactDescriptorQuery.java
index c3ae1ba97..353753615 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/ArtifactDescriptorQuery.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/ArtifactDescriptorQuery.java
@@ -19,7 +19,7 @@ import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor;
* An implementation of IArtifactQuery that matches IArtifactDescriptors
* @since 2.0
*/
-public class ArtifactDescriptorQuery extends MatchQuery {
+public class ArtifactDescriptorQuery extends MatchQuery<IArtifactDescriptor> {
public static final ArtifactDescriptorQuery ALL_DESCRIPTORS = new ArtifactDescriptorQuery();
private VersionRange range = null;
private String id = null;
@@ -66,24 +66,20 @@ public class ArtifactDescriptorQuery extends MatchQuery {
this.descriptor = (descriptor.getClass() == ArtifactDescriptor.class) ? (ArtifactDescriptor) descriptor : new ArtifactDescriptor(descriptor);
}
- public boolean isMatch(Object candidate) {
- if (!(candidate instanceof IArtifactDescriptor))
- return false;
-
+ public boolean isMatch(IArtifactDescriptor candidate) {
if (descriptor != null)
- return matchDescriptor((IArtifactDescriptor) candidate);
+ return matchDescriptor(candidate);
- IArtifactDescriptor candidateDescriptor = (IArtifactDescriptor) candidate;
- if (id != null && !id.equals(candidateDescriptor.getArtifactKey().getId()))
+ if (id != null && !id.equals(candidate.getArtifactKey().getId()))
return false;
- if (range != null && !range.isIncluded(candidateDescriptor.getArtifactKey().getVersion()))
+ if (range != null && !range.isIncluded(candidate.getArtifactKey().getVersion()))
return false;
- if (format != null && !format.equals(candidateDescriptor.getProperty(IArtifactDescriptor.FORMAT)))
+ if (format != null && !format.equals(candidate.getProperty(IArtifactDescriptor.FORMAT)))
return false;
- if (repository != null && repository != candidateDescriptor.getRepository())
+ if (repository != null && repository != candidate.getRepository())
return false;
return true;
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/ArtifactKeyQuery.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/ArtifactKeyQuery.java
index 58faaa892..06b060b40 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/ArtifactKeyQuery.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/ArtifactKeyQuery.java
@@ -19,7 +19,7 @@ import org.eclipse.equinox.p2.metadata.IArtifactKey;
* An IArtifactQuery returning matching IArtifactKey objects.
* @since 2.0
*/
-public class ArtifactKeyQuery extends MatchQuery {
+public class ArtifactKeyQuery extends MatchQuery<IArtifactKey> {
public static final ArtifactKeyQuery ALL_KEYS = new ArtifactKeyQuery();
private String id;
@@ -48,14 +48,9 @@ public class ArtifactKeyQuery extends MatchQuery {
this.artifactKey = key;
}
- public boolean isMatch(Object candidate) {
- if (!(candidate instanceof IArtifactKey))
- return false;
-
+ public boolean isMatch(IArtifactKey key) {
if (artifactKey != null)
- return matchKey((IArtifactKey) candidate);
-
- IArtifactKey key = (IArtifactKey) candidate;
+ return matchKey(key);
if (classifier != null && !key.getClassifier().equals(classifier))
return false;
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/IArtifactDescriptor.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/IArtifactDescriptor.java
index 84f23b209..0ada118dd 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/IArtifactDescriptor.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/IArtifactDescriptor.java
@@ -86,7 +86,7 @@ public interface IArtifactDescriptor {
* Returns a read-only collection of the properties of the artifact descriptor.
* @return the properties of this artifact descriptor.
*/
- public Map getProperties();
+ public Map<String, String> getProperties();
/**
* Return the list of processing steps associated with this descriptor.
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/IArtifactRepository.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/IArtifactRepository.java
index 045373537..db7b97332 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/IArtifactRepository.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/IArtifactRepository.java
@@ -14,8 +14,8 @@ import java.io.OutputStream;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
+import org.eclipse.equinox.internal.provisional.p2.metadata.query.IQueryable;
import org.eclipse.equinox.p2.metadata.IArtifactKey;
-import org.eclipse.equinox.p2.metadata.query.IQuery;
import org.eclipse.equinox.p2.repository.IRepository;
/**
@@ -28,19 +28,7 @@ import org.eclipse.equinox.p2.repository.IRepository;
* @noimplement This interface is not intended to be implemented by clients.
* @since 2.0
*/
-public interface IArtifactRepository extends IRepository {
-
- /**
- * See {@link IQuery#getProperty(String)}. A query should implement "getExcludeArtifactKeys" returning
- * Boolean.TRUE to indicate that it is not interested in {@link IArtifactKey}s.
- */
- public static final String QUERY_EXCLUDE_KEYS = "ExcludeArtifactKeys"; //$NON-NLS-1$
-
- /**
- * See {@link IQuery#getProperty(String)}. A query should implement "getExcludeArtifactDescriptors" returning
- * Boolean.TRUE to indicate that it is not interested in {@link IArtifactDescriptor}s.
- */
- public static final String QUERY_EXCLUDE_DESCRIPTORS = "ExcludeArtifactDescriptors"; //$NON-NLS-1$
+public interface IArtifactRepository extends IRepository<IArtifactKey> {
/**
* The return code to use when a client could/should retry a failed getArtifact() operation.
@@ -128,6 +116,14 @@ public interface IArtifactRepository extends IRepository {
public OutputStream getOutputStream(IArtifactDescriptor descriptor) throws ProvisionException;
/**
+ * Returns a queryable that can be queried for artifact descriptors contained in this repository
+ * @param query The artifact descriptor query
+ * @param monitor The progress montior
+ * @return The query result
+ */
+ public IQueryable<IArtifactDescriptor> descriptorQueryable();
+
+ /**
* Remove the all keys, descriptors, and contents from this repository.
*/
public void removeAll();
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/IArtifactRepositoryManager.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/IArtifactRepositoryManager.java
index 9446215a4..01c2728e4 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/IArtifactRepositoryManager.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/IArtifactRepositoryManager.java
@@ -12,7 +12,6 @@ package org.eclipse.equinox.p2.repository.artifact;
import java.net.URI;
import java.util.Map;
-import java.util.Properties;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
import org.eclipse.equinox.p2.metadata.IArtifactKey;
@@ -26,7 +25,7 @@ import org.eclipse.equinox.p2.repository.IRepositoryManager;
* @noimplement This interface is not intended to be implemented by clients.
* @since 2.0
*/
-public interface IArtifactRepositoryManager extends IRepositoryManager {
+public interface IArtifactRepositoryManager extends IRepositoryManager<IArtifactKey> {
/**
* The name used for obtaining a reference to the metadata repository manager service
*/
@@ -50,7 +49,7 @@ public interface IArtifactRepositoryManager extends IRepositoryManager {
* , or <code>null</code> to indicate no additional properties are needed
* @return the newly created request object
*/
- public IArtifactRequest createMirrorRequest(IArtifactKey key, IArtifactRepository destination, Properties destinationDescriptorProperties, Properties destinationRepositoryProperties);
+ public IArtifactRequest createMirrorRequest(IArtifactKey key, IArtifactRepository destination, Map<String, String> destinationDescriptorProperties, Map<String, String> destinationRepositoryProperties);
/**
* Creates and returns a new empty artifact repository of the given type at
@@ -74,7 +73,7 @@ public interface IArtifactRepositoryManager extends IRepositoryManager {
* <li>A repository already exists at that location.</li>
* </ul>
*/
- public IArtifactRepository createRepository(URI location, String name, String type, Map properties) throws ProvisionException;
+ public IArtifactRepository createRepository(URI location, String name, String type, Map<String, String> properties) throws ProvisionException;
/**
* Loads the repository at the given location. The location is expected to contain
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/spi/ArtifactDescriptor.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/spi/ArtifactDescriptor.java
index 4e51f0596..a1587c9d2 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/spi/ArtifactDescriptor.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/spi/ArtifactDescriptor.java
@@ -29,7 +29,7 @@ public class ArtifactDescriptor implements IArtifactDescriptor {
// has been downloaded (e.g, unpack, then md5 checksum, then...)
protected ProcessingStepDescriptor[] processingSteps = EMPTY_STEPS;
- protected Map properties = new OrderedProperties();
+ protected Map<String, String> properties = new OrderedProperties();
protected transient IArtifactRepository repository;
public ArtifactDescriptor(IArtifactDescriptor base) {
@@ -58,7 +58,7 @@ public class ArtifactDescriptor implements IArtifactDescriptor {
}
public String getProperty(String propertyKey) {
- return (String) properties.get(propertyKey);
+ return properties.get(propertyKey);
}
public void setProperty(String key, String value) {
@@ -68,7 +68,7 @@ public class ArtifactDescriptor implements IArtifactDescriptor {
properties.put(key, value);
}
- public void addProperties(Map additionalProperties) {
+ public void addProperties(Map<String, String> additionalProperties) {
properties.putAll(additionalProperties);
}
@@ -76,7 +76,7 @@ public class ArtifactDescriptor implements IArtifactDescriptor {
* Returns a read-only collection of the properties of the artifact descriptor.
* @return the properties of this artifact descriptor.
*/
- public Map getProperties() {
+ public Map<String, String> getProperties() {
return OrderedProperties.unmodifiableProperties(properties);
}
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/metadata/IMetadataRepository.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/metadata/IMetadataRepository.java
index b186caa54..1decf77c4 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/metadata/IMetadataRepository.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/metadata/IMetadataRepository.java
@@ -25,7 +25,7 @@ import org.eclipse.equinox.p2.repository.IRepository;
* @noimplement This interface is not intended to be implemented by clients.
* @since 2.0
*/
-public interface IMetadataRepository extends IRepository {
+public interface IMetadataRepository extends IRepository<IInstallableUnit> {
/**
* Add the given installable units to this repository
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/metadata/IMetadataRepositoryManager.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/metadata/IMetadataRepositoryManager.java
index 2fd873dc7..330ad7148 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/metadata/IMetadataRepositoryManager.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/metadata/IMetadataRepositoryManager.java
@@ -15,6 +15,7 @@ import java.util.Map;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.repository.IRepositoryManager;
/**
@@ -25,7 +26,7 @@ import org.eclipse.equinox.p2.repository.IRepositoryManager;
* @noimplement This interface is not intended to be implemented by clients.
* @since 2.0
*/
-public interface IMetadataRepositoryManager extends IRepositoryManager {
+public interface IMetadataRepositoryManager extends IRepositoryManager<IInstallableUnit> {
/**
* The name used for obtaining a reference to the metadata repository manager service
*/
@@ -59,7 +60,7 @@ public interface IMetadataRepositoryManager extends IRepositoryManager {
* <li>A repository already exists at that location.</li>
* </ul>
*/
- public IMetadataRepository createRepository(URI location, String name, String type, Map properties) throws ProvisionException;
+ public IMetadataRepository createRepository(URI location, String name, String type, Map<String, String> properties) throws ProvisionException;
/**
* Loads a repository corresponding to the given URL. If a repository has
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/All p2 UI tests.launch b/bundles/org.eclipse.equinox.p2.tests.ui/All p2 UI tests.launch
index 04ba3f074..3d7b444d3 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/All p2 UI tests.launch
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/All p2 UI tests.launch
@@ -54,6 +54,7 @@
<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.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/java-1.6.0-openjdk-1.6.0.0.x86_64"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.equinox.p2.tests.ui.AutomatedTests"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -console -consoleLog"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.equinox.p2.tests.ui"/>
@@ -61,8 +62,8 @@
<stringAttribute key="pde.version" value="3.3"/>
<stringAttribute key="product" value="org.eclipse.sdk.ide"/>
<booleanAttribute key="run_in_ui_thread" value="true"/>
-<stringAttribute key="selected_target_plugins" value="org.eclipse.jface.text@default:default,org.eclipse.rcp@default:default,org.apache.commons.logging@default:default,org.mortbay.jetty.util@default:default,org.apache.ant@default:default,org.eclipse.ui.navigator.resources@default:default,org.eclipse.compare@default:default,org.eclipse.core.net@default:default,org.eclipse.jdt.junit.core@default:default,org.eclipse.update.configurator@3:true,org.eclipse.equinox.security.ui@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.ui.presentations.r21@default:default,org.eclipse.osgi.services@default:default,org.eclipse.core.resources@default:default,org.eclipse.equinox.app@default:default,org.eclipse.jsch.ui@default:default,org.eclipse.pde.build@default:default,org.eclipse.jdt.core.manipulation@default:default,org.eclipse.team.cvs.core@default:default,org.eclipse.ui.intro@default:default,org.hamcrest.core@default:default,org.eclipse.ui.editors@default:default,org.eclipse.ui.views@default:default,org.eclipse.jdt.launching@default:default,org.apache.commons.httpclient@default:default,org.eclipse.ui.ide.application@default:default,org.mortbay.jetty.server@default:default,org.eclipse.pde.api.tools.ui@default:default,org.eclipse.pde.junit.runtime@default:default,org.eclipse.ecf.provider.filetransfer.ssl@default:false,org.eclipse.help@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.ui.net@default:default,org.eclipse.ui.cheatsheets@default:default,org.eclipse.ecf.provider.filetransfer@default:default,org.apache.lucene@default:default,javax.servlet.jsp@default:default,org.eclipse.ecf@default:default,org.sat4j.pb@default:default,org.eclipse.debug.ui@default:default,org.eclipse.jdt.junit4.runtime@default:default,org.eclipse.equinox.util@default:default,org.eclipse.pde.api.tools@default:default,org.eclipse.jdt.compiler.tool@default:false,org.eclipse.core.runtime.compatibility@default:default,org.junit4@default:default,org.eclipse.search@default:default,org.eclipse.equinox.ds@1:true,org.junit*4.7.0.v20091118-1515@default:default,org.eclipse.equinox.jsp.jasper@default:default,org.eclipse.jdt.junit@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.update.core@default:default,org.eclipse.ant.core@default:default,org.eclipse.sdk@default:default,org.eclipse.osgi.util@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.help.ui@default:default,org.eclipse.pde.doc.user@default:default,org.eclipse.team.ui@default:default,org.eclipse.core.databinding@default:default,com.jcraft.jsch@default:default,org.eclipse.core.commands@default:default,org.eclipse.ui.workbench@default:default,org.eclipse.ui.views.log@default:default,org.eclipse.ui.browser@default:default,org.junit*3.8.2.v20090203-1005@default:default,org.eclipse.ecf.provider.filetransfer.httpclient.ssl@default:false,org.eclipse.core.expressions@default:default,org.eclipse.ant.ui@default:default,org.eclipse.jdt@default:default,org.eclipse.core.jobs@default:default,org.eclipse.jdt.debug@default:default,org.eclipse.pde.ds.core@default:default,org.eclipse.pde@default:default,org.eclipse.ltk.core.refactoring@default:default,org.eclipse.pde.ua.ui@default:default,org.eclipse.ui.console@default:default,org.eclipse.debug.core@default:default,org.eclipse.platform@default:default,org.sat4j.core@default:default,org.eclipse.pde.ui@default:default,org.eclipse.equinox.http.jetty@default:default,org.eclipse.equinox.launcher@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.jdt.apt.ui@default:default,org.eclipse.osgi@-1:true,org.eclipse.ecf.filetransfer@default:default,org.eclipse.help.base@default:default,org.eclipse.ui.intro.universal@default:default,org.eclipse.compare.core@default:default,org.eclipse.core.runtime@default:true,org.apache.jasper@default:default,org.eclipse.jdt.junit.runtime@default:default,org.eclipse.ui@default:default,org.eclipse.core.variables@default:default,org.eclipse.jdt.debug.ui@default:default,org.eclipse.team.core@default:default,org.eclipse.jdt.apt.core@default:default,org.eclipse.pde.runtime@default:default,org.eclipse.update.scheduler@default:default,org.eclipse.jdt.ui@default:default,org.eclipse.pde.ds.ui@default:default,org.eclipse.equinox.concurrent@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.update.ui@default:default,org.eclipse.ui.navigator@default:default,org.eclipse.ui.externaltools@default:default,org.eclipse.text@default:default,org.apache.commons.el@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.ant.launching@default:default,org.eclipse.ui.views.properties.tabbed@default:default,org.eclipse.help.webapp@default:default,org.eclipse.pde.ui.templates@default:default,org.eclipse.pde.launching@default:default,org.eclipse.pde.ua.core@default:default,org.eclipse.swt@default:default,com.ibm.icu@default:default,org.eclipse.cvs@default:default,org.eclipse.ui.forms@default:default,org.eclipse.ecf.ssl@default:false,org.eclipse.equinox.jsp.jasper.registry@default:default,org.eclipse.jface@default:default,org.eclipse.ui.workbench.compatibility@default:false,org.eclipse.team.cvs.ssh2@default:default,org.apache.commons.codec@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.help.appserver@default:default,org.eclipse.ui.ide@default:default,org.eclipse.team.cvs.ui@default:default,org.eclipse.jsch.core@default:default,org.eclipse.core.externaltools@default:default,org.eclipse.ecf.provider.filetransfer.httpclient@default:default,org.eclipse.ui.workbench.texteditor@default:default,org.eclipse.swt.gtk.linux.x86_64@default:false,org.eclipse.core.filesystem@default:default,org.eclipse.core.databinding.beans@default:default,org.eclipse.jdt.core@default:default,org.eclipse.equinox.security@default:default,org.eclipse.jdt.doc.user@default:default,org.eclipse.equinox.event@default:default,org.eclipse.equinox.common@2:true,org.eclipse.pde.core@default:default,org.objectweb.asm@default:default,org.apache.lucene.analysis@default:default,org.eclipse.core.boot@default:default,org.eclipse.ltk.ui.refactoring@default:default,org.eclipse.jdt.compiler.apt@default:false,org.eclipse.equinox.registry@default:default,org.eclipse.jdt.apt.pluggable.core@default:default,org.eclipse.core.filebuffers@default:default,javax.servlet@default:default,org.eclipse.equinox.http.registry@default:default,org.eclipse.jdt.doc.isv@default:default"/>
-<stringAttribute key="selected_workspace_plugins" value="org.eclipse.equinox.simpleconfigurator@1:true,org.eclipse.equinox.frameworkadmin.test@default:default,org.eclipse.equinox.frameworkadmin@default:default,org.eclipse.equinox.p2.garbagecollector@default:default,org.eclipse.equinox.p2.artifact.optimizers@default:default,org.eclipse.equinox.p2.ui.sdk.scheduler@default:default,org.eclipse.equinox.p2.artifact.processors@default:default,org.eclipse.equinox.p2.metadata@default:default,org.eclipse.equinox.p2.diagnostic@default:default,org.eclipse.equinox.frameworkadmin.equinox@default:default,org.eclipse.equinox.p2.installer@default:default,org.eclipse.equinox.p2.ui@default:default,org.eclipse.equinox.p2.updatesite@default:default,org.eclipse.equinox.p2.repository.tools@default:default,org.eclipse.equinox.p2.director.app@default:default,org.easymock@default:default,org.eclipse.equinox.p2.extensionlocation@default:default,org.eclipse.equinox.p2.afterthefact@default:default,org.eclipse.equinox.p2.common@default:default,org.eclipse.equinox.p2.tests@default:default,org.eclipse.equinox.p2.ui.sdk@default:default,org.eclipse.equinox.p2.tests.verifier@default:default,org.eclipse.equinox.simpleconfigurator.manipulator@default:default,org.eclipse.equinox.p2.director@default:default,ie.wombat.jbdiff.test@default:default,org.eclipse.equinox.p2.updatechecker@default:default,org.eclipse.equinox.p2.operations@default:default,org.eclipse.equinox.p2.engine@default:default,org.eclipse.equinox.p2.exemplarysetup@default:default,org.eclipse.equinox.p2.console@default:default,org.eclipse.equinox.p2.sar@default:default,org.eclipse.equinox.p2.jarprocessor@default:default,org.eclipse.equinox.p2.artifact.repository@default:default,org.eclipse.equinox.p2.touchpoint.natives@default:default,org.eclipse.equinox.p2.core@default:default,org.eclipse.equinox.p2.touchpoint.osgi@default:default,org.eclipse.equinox.p2.touchpoint.eclipse@default:default,org.eclipse.osgi@-1:true,org.eclipse.equinox.p2.publisher@default:default,org.eclipse.equinox.p2.tags@default:default,org.eclipse.equinox.p2.ql@default:default,org.eclipse.equinox.p2.tests.ui@default:default,org.eclipse.test.performance@default:default,org.eclipse.equinox.p2.directorywatcher@default:default,org.eclipse.equinox.p2.metadata.generator@default:default,org.eclipse.equinox.p2.weblistener@default:default,ie.wombat.jbdiff@default:default,org.eclipse.equinox.p2.repository@default:default,org.eclipse.equinox.p2.metadata.repository@default:default,org.eclipse.equinox.p2.reconciler.dropins@default:default,org.eclipse.core.tests.harness@default:default"/>
+<stringAttribute key="selected_target_plugins" value="org.objectweb.asm@default:default,org.eclipse.ui.ide.application@default:default,org.eclipse.core.resources@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.equinox.security.ui@default:default,org.eclipse.core.runtime@default:true,org.eclipse.core.databinding.beans@default:default,org.eclipse.debug.core@default:default,com.ibm.icu@default:default,org.eclipse.core.commands@default:default,org.eclipse.compare.core@default:default,org.eclipse.ui.workbench@default:default,org.eclipse.help.webapp@default:default,org.eclipse.ecf.provider.filetransfer.httpclient@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.ecf.ssl@default:false,org.apache.jasper@default:default,org.eclipse.ecf.provider.filetransfer@default:default,org.eclipse.pde.core@default:default,org.eclipse.pde.doc.user@default:default,javax.servlet@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.pde.launching@default:default,org.eclipse.jface@default:default,org.eclipse.swt@default:default,org.eclipse.core.externaltools@default:default,org.eclipse.ui.externaltools@default:default,org.apache.commons.httpclient@default:default,org.eclipse.ui.navigator@default:default,org.apache.commons.codec@default:default,org.eclipse.ui.intro@default:default,javax.servlet.jsp@default:default,org.eclipse.ui.browser@default:default,org.eclipse.equinox.jsp.jasper.registry@default:default,org.eclipse.pde.ui.templates@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.debug.ui@default:default,org.eclipse.equinox.http.registry@default:default,org.eclipse.core.boot@default:default,org.apache.lucene@default:default,org.eclipse.jdt.core@default:default,org.eclipse.jdt.launching@default:default,org.eclipse.team.ui@default:default,org.eclipse.equinox.app@default:default,org.apache.lucene.analysis@default:default,org.eclipse.jdt.debug@default:default,org.eclipse.team.cvs.ssh2@default:default,org.eclipse.update.configurator@3:true,org.sat4j.pb@default:default,org.eclipse.osgi.services@default:default,org.eclipse.jdt.apt.pluggable.core@default:default,org.eclipse.jdt.junit4.runtime@default:default,org.mortbay.jetty.util@default:default,org.apache.ant@default:default,org.eclipse.core.jobs@default:default,org.eclipse.pde.ua.core@default:default,org.eclipse.help.appserver@default:default,org.eclipse.cvs@default:default,org.eclipse.ui.net@default:default,org.eclipse.pde.api.tools.ui@default:default,org.eclipse.team.core@default:default,org.eclipse.jdt.junit.runtime@default:default,org.eclipse.ecf.provider.filetransfer.httpclient.ssl@default:false,org.eclipse.equinox.security@default:default,org.junit4@default:default,org.eclipse.ecf@default:default,org.eclipse.jdt.apt.core@default:default,org.eclipse.ant.ui@default:default,org.eclipse.jdt.junit.core@default:default,org.eclipse.help.ui@default:default,org.eclipse.core.filesystem@default:default,org.eclipse.search@default:default,org.eclipse.help.base@default:default,org.eclipse.pde.build@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.core.runtime.compatibility@default:default,org.eclipse.pde.ui@default:default,org.eclipse.ltk.core.refactoring@default:default,org.eclipse.ui@default:default,org.eclipse.ui.ide@default:default,com.jcraft.jsch@default:default,org.eclipse.team.cvs.ui@default:default,org.eclipse.team.cvs.core@default:default,org.hamcrest.core@default:default,org.sat4j.core@default:default,org.eclipse.jdt.compiler.apt@default:false,org.eclipse.jdt.core.manipulation@default:default,org.eclipse.osgi.util@default:default,org.eclipse.equinox.concurrent@default:default,org.eclipse.equinox.jsp.jasper@default:default,org.eclipse.ui.views.log@default:default,org.junit*4.7.0.v20091118-1515@default:default,org.eclipse.pde.api.tools@default:default,org.eclipse.swt.gtk.linux.x86_64@default:false,org.eclipse.pde.runtime@default:default,org.eclipse.text@default:default,org.eclipse.jdt.junit@default:default,org.eclipse.ui.workbench.compatibility@default:false,org.eclipse.ecf.provider.filetransfer.ssl@default:false,org.eclipse.core.net@default:default,org.eclipse.ui.navigator.resources@default:default,org.eclipse.ui.views@default:default,org.eclipse.pde.ds.core@default:default,org.eclipse.update.scheduler@default:default,org.eclipse.pde.ua.ui@default:default,org.eclipse.core.filebuffers@default:default,org.eclipse.equinox.launcher@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.ui.intro.universal@default:default,org.eclipse.ui.presentations.r21@default:default,org.eclipse.jface.text@default:default,org.eclipse.equinox.http.jetty@default:default,org.eclipse.equinox.util@default:default,org.eclipse.ltk.ui.refactoring@default:default,org.eclipse.osgi@-1:true,org.eclipse.ui.workbench.texteditor@default:default,org.eclipse.ui.console@default:default,org.eclipse.equinox.event@default:default,org.eclipse.core.databinding@default:default,org.apache.commons.logging@default:default,org.eclipse.rcp@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.ui.forms@default:default,org.eclipse.compare@default:default,org.eclipse.jsch.core@default:default,org.eclipse.equinox.common@2:true,org.eclipse.ant.launching@default:default,org.eclipse.ui.views.properties.tabbed@default:default,org.eclipse.jdt@default:default,org.eclipse.jsch.ui@default:default,org.apache.commons.el@default:default,org.eclipse.jdt.compiler.tool@default:false,org.eclipse.update.ui@default:default,org.eclipse.core.variables@default:default,org.eclipse.equinox.ds@1:true,org.eclipse.core.expressions@default:default,org.eclipse.update.core@default:default,org.eclipse.jdt.ui@default:default,org.eclipse.ui.editors@default:default,org.junit*3.8.2.v20090203-1005@default:default,org.eclipse.jdt.debug.ui@default:default,org.eclipse.ui.cheatsheets@default:default,org.eclipse.pde.ds.ui@default:default,org.eclipse.jdt.doc.isv@default:default,org.eclipse.ant.core@default:default,org.mortbay.jetty.server@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.sdk@default:default,org.eclipse.help@default:default,org.eclipse.pde.junit.runtime@default:default,org.eclipse.pde@default:default,org.eclipse.jdt.doc.user@default:default,org.eclipse.jdt.apt.ui@default:default,org.eclipse.platform@default:default"/>
+<stringAttribute key="selected_workspace_plugins" value="org.eclipse.equinox.p2.tests.verifier@default:default,org.eclipse.equinox.p2.director@default:default,org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility@default:default,org.eclipse.equinox.p2.repository@default:default,org.eclipse.pde.core@default:default,org.eclipse.ui.ide@default:default,org.eclipse.equinox.p2.directorywatcher@default:default,org.eclipse.equinox.p2.ui.sdk@default:default,org.eclipse.pde.ui@default:default,org.eclipse.equinox.p2.jarprocessor@default:default,org.eclipse.equinox.p2.afterthefact@default:default,org.eclipse.equinox.p2.ui.sdk.scheduler@default:default,org.eclipse.equinox.p2.common@default:default,org.eclipse.equinox.p2.ql@default:default,org.eclipse.equinox.p2.touchpoint.eclipse@default:default,ie.wombat.jbdiff.test@default:default,org.eclipse.core.tests.harness@default:default,org.eclipse.equinox.p2.console@default:default,org.eclipse.equinox.p2.metadata.repository@default:default,org.eclipse.equinox.p2.artifact.repository@default:default,org.eclipse.equinox.p2.artifact.optimizers@default:default,org.eclipse.equinox.p2.garbagecollector@default:default,org.eclipse.equinox.frameworkadmin.equinox@default:default,org.eclipse.equinox.p2.updatesite@default:default,org.eclipse.equinox.p2.tests.ui@default:default,org.eclipse.equinox.p2.repository.tools@default:default,org.eclipse.equinox.p2.touchpoint.osgi@default:default,org.eclipse.equinox.p2.metadata@default:default,org.eclipse.equinox.p2.extensionlocation@default:default,org.eclipse.equinox.frameworkadmin.test@default:default,org.eclipse.equinox.simpleconfigurator.manipulator@default:default,org.easymock@default:default,org.eclipse.equinox.p2.publisher@default:default,org.eclipse.equinox.frameworkadmin@default:default,org.eclipse.equinox.p2.artifact.processors@default:default,org.eclipse.equinox.p2.sar@default:default,org.eclipse.test.performance@default:default,org.eclipse.equinox.p2.engine@default:default,ie.wombat.jbdiff@default:default,org.eclipse.equinox.p2.ui@default:default,org.eclipse.equinox.p2.examples.rcp.cloud@default:default,org.eclipse.equinox.p2.examples.rcp.prestartupdate@default:default,org.eclipse.pde.build.tests@default:default,org.eclipse.equinox.p2.diagnostic@default:default,org.eclipse.equinox.p2.weblistener@default:default,org.eclipse.equinox.p2.touchpoint.natives@default:default,org.eclipse.equinox.p2.exemplarysetup@default:default,org.eclipse.equinox.p2.updatechecker@default:default,org.eclipse.equinox.p2.metadata.generator@default:default,org.eclipse.equinox.p2.installer@default:default,org.eclipse.equinox.p2.operations@default:default,org.eclipse.equinox.p2.tests@default:default,org.eclipse.equinox.p2.reconciler.dropins@default:default,org.eclipse.pde.build@default:default,org.eclipse.pde.ui.tests@default:default,org.eclipse.equinox.p2.core@default:default,org.eclipse.equinox.simpleconfigurator@1:true,org.eclipse.equinox.p2.director.app@default:default"/>
<booleanAttribute key="show_selected_only" value="false"/>
<booleanAttribute key="tracing" value="false"/>
<booleanAttribute key="useDefaultConfig" value="true"/>
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/AnyRequiredCapabilityTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/AnyRequiredCapabilityTest.java
index 12677efa8..a728233a5 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/AnyRequiredCapabilityTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/AnyRequiredCapabilityTest.java
@@ -30,8 +30,6 @@ public class AnyRequiredCapabilityTest extends AbstractQueryTest {
List items = new ArrayList();
items.add(match);
items.add(noMatch);
- items.add(new Object());
- items.add(requires);
IQueryResult result = requires.getMatches().perform(items.iterator());
assertEquals("1.0", 1, queryResultSize(result));
assertEquals("1.1", match, result.iterator().next());
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/LatestIUVersionElementWrapperTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/LatestIUVersionElementWrapperTest.java
index 0aad76c68..affb18d42 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/LatestIUVersionElementWrapperTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/LatestIUVersionElementWrapperTest.java
@@ -35,19 +35,6 @@ public class LatestIUVersionElementWrapperTest extends AvailableIUWrapperTest {
}
/**
- * Tests collecting items that LatestIUVersionElementQuery should
- * discard.
- */
- public void testCollectObject() {
- LatestIUVersionQuery latestIuVersionElementQuery = new LatestIUVersionQuery();
- Object object = new Object();
- List list = new ArrayList();
- list.add(object);
- IQueryResult collector = latestIuVersionElementQuery.perform(list.iterator());
- assertTrue("1.0", collector.isEmpty());
- }
-
- /**
* Tests that only the latest version is collected.
*/
public void testCollectLatestIU() {
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryableArtifactRepositoryManagerTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryableArtifactRepositoryManagerTest.java
index 0c4005836..a1613b9dd 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryableArtifactRepositoryManagerTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryableArtifactRepositoryManagerTest.java
@@ -43,7 +43,7 @@ public class QueryableArtifactRepositoryManagerTest extends AbstractQueryTest {
public void testQuery() {
QueryableArtifactRepositoryManager manager = getQueryableManager();
- IQueryResult result = manager.query(new RepositoryLocationQuery(), getMonitor());
+ IQueryResult result = manager.locationsQueriable().query(new RepositoryLocationQuery(), getMonitor());
assertTrue(queryResultSize(result) == repoCount);
}
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryableMetadataRepositoryManagerTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryableMetadataRepositoryManagerTest.java
index 7d44982f4..1f82c7916 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryableMetadataRepositoryManagerTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryableMetadataRepositoryManagerTest.java
@@ -183,7 +183,7 @@ public class QueryableMetadataRepositoryManagerTest extends AbstractQueryTest {
assertEquals("1.1", "test.bundle", iu.getId());
//RepoLocationQuery collects repository URLs
- result = manager.query(new RepositoryLocationQuery(), getMonitor());
+ result = manager.locationsQueriable().query(new RepositoryLocationQuery(), getMonitor());
assertEquals("2.0", 3, queryResultSize(result));
assertContains("2.1", result, existing);
assertContains("2.1", result, nonExisting);
diff --git a/bundles/org.eclipse.equinox.p2.tests/.externalToolBuilders/New_Builder.launch b/bundles/org.eclipse.equinox.p2.tests/.externalToolBuilders/New_Builder.launch
new file mode 100644
index 000000000..b4809f0a4
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/.externalToolBuilders/New_Builder.launch
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
+<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/>
+<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
+<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
+<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
+<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="-apa"/>
+<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
+</launchConfiguration>
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
index 5f61adc2c..ef87a8665 100644
--- 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
@@ -1,4 +1,4 @@
-#Fri Dec 12 15:45:18 EST 2008
+#Mon Dec 28 06:14:12 CET 2009
eclipse.preferences.version=1
instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
diff --git a/bundles/org.eclipse.equinox.p2.tests/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.tests/META-INF/MANIFEST.MF
index e6529697d..e187d570b 100644
--- a/bundles/org.eclipse.equinox.p2.tests/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.tests/META-INF/MANIFEST.MF
@@ -83,7 +83,8 @@ Require-Bundle: org.eclipse.equinox.p2.metadata.generator,
org.eclipse.equinox.p2.ql
Bundle-ActivationPolicy: lazy
Eclipse-RegisterBuddy: org.eclipse.equinox.p2.artifact.repository
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-RequiredExecutionEnvironment: J2SE-1.5,
+ J2SE-1.4
Export-Package: org.eclipse.equinox.p2.tests,
org.eclipse.equinox.p2.tests.artifact.repository,
org.eclipse.equinox.p2.tests.artifact.repository.processing,
diff --git a/bundles/org.eclipse.equinox.p2.tests/build.properties b/bundles/org.eclipse.equinox.p2.tests/build.properties
index 1518f3c93..63bbf4dba 100644
--- a/bundles/org.eclipse.equinox.p2.tests/build.properties
+++ b/bundles/org.eclipse.equinox.p2.tests/build.properties
@@ -18,5 +18,7 @@ bin.includes = META-INF/,\
plugin.properties,\
test.xml
customCallBack=foo.xml
-javacWarnings..=-raw,-unchecked,-varargsCast
src.includes = about.html
+javacWarnings..=-raw,-unchecked,-varargsCast
+javacTarget=jsr14
+javacSource=1.5
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractAntProvisioningTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractAntProvisioningTest.java
index 8ab3276d2..cb04dd96e 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractAntProvisioningTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractAntProvisioningTest.java
@@ -17,10 +17,10 @@ import java.util.*;
import org.eclipse.ant.core.AntRunner;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.URIUtil;
-import org.eclipse.equinox.internal.p2.metadata.InstallableUnit;
import org.eclipse.equinox.internal.p2.persistence.XMLWriter;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
import org.eclipse.equinox.internal.provisional.p2.metadata.query.IQueryable;
+import org.eclipse.equinox.p2.metadata.IArtifactKey;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.query.IQueryResult;
import org.eclipse.equinox.p2.repository.artifact.ArtifactKeyQuery;
@@ -261,11 +261,11 @@ public class AbstractAntProvisioningTest extends AbstractProvisioningTest {
}
- protected static List getArtifactKeys(IQueryResult ius) {
- List keys = new ArrayList();
+ protected static List getArtifactKeys(IQueryResult<IInstallableUnit> ius) {
+ List<IArtifactKey> keys = new ArrayList<IArtifactKey>();
- for (Iterator iter = ius.iterator(); iter.hasNext();)
- keys.addAll(Arrays.asList(((InstallableUnit) iter.next()).getArtifacts()));
+ for (Iterator<IInstallableUnit> iter = ius.iterator(); iter.hasNext();)
+ keys.addAll(iter.next().getArtifacts());
return keys;
}
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java
index 46435c82f..af067ff5c 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java
@@ -53,7 +53,7 @@ public abstract class AbstractProvisioningTest extends TestCase {
protected static final VersionRange ANY_VERSION = VersionRange.emptyRange;
protected static final IProvidedCapability[] BUNDLE_CAPABILITY = new IProvidedCapability[] {MetadataFactory.createProvidedCapability("eclipse.touchpoint", "bundle", Version.createOSGi(1, 0, 0))};
- private static final IRequiredCapability[] BUNDLE_REQUIREMENT = new IRequiredCapability[] {(IRequiredCapability) MetadataFactory.createRequiredCapability("eclipse.touchpoint", "bundle", VersionRange.emptyRange, null, false, true)};
+ private static final IRequiredCapability[] BUNDLE_REQUIREMENT = new IRequiredCapability[] {MetadataFactory.createRequiredCapability("eclipse.touchpoint", "bundle", VersionRange.emptyRange, null, false, true)};
protected static final Version DEFAULT_VERSION = Version.createOSGi(1, 0, 0);
public static final ITouchpointType TOUCHPOINT_OSGI = MetadataFactory.createTouchpointType("org.eclipse.equinox.p2.osgi", Version.createOSGi(1, 0, 0));
@@ -467,39 +467,31 @@ public abstract class AbstractProvisioningTest extends TestCase {
}
public static void changeVersion(InstallableUnitDescription desc, Version newVersion) {
- IProvidedCapability[] capabilities = desc.getProvidedCapabilities();
- for (int i = 0; i < capabilities.length; i++) {
- if (desc.getVersion().equals(capabilities[i].getVersion()))
- capabilities[i] = MetadataFactory.createProvidedCapability(capabilities[i].getNamespace(), capabilities[i].getName(), newVersion);
+ List<IProvidedCapability> capabilities = new ArrayList(desc.getProvidedCapabilities());
+ for (int i = 0; i < capabilities.size(); i++) {
+ IProvidedCapability pc = capabilities.get(i);
+ if (desc.getVersion().equals(pc.getVersion()))
+ capabilities.set(i, MetadataFactory.createProvidedCapability(pc.getNamespace(), pc.getName(), newVersion));
}
desc.setVersion(newVersion);
+ desc.setCapabilities(capabilities.toArray(new IProvidedCapability[capabilities.size()]));
}
public static MetadataFactory.InstallableUnitDescription createIUDescriptor(IInstallableUnit prototype) {
InstallableUnitDescription desc = new MetadataFactory.InstallableUnitDescription();
- desc.setArtifacts(prototype.getArtifacts());
- IProvidedCapability originalCapabilities[] = prototype.getProvidedCapabilities();
- IProvidedCapability newCapabilities[] = new IProvidedCapability[originalCapabilities.length];
- for (int i = 0; i < originalCapabilities.length; i++) {
- newCapabilities[i] = MetadataFactory.createProvidedCapability(originalCapabilities[i].getNamespace(), originalCapabilities[i].getName(), originalCapabilities[i].getVersion());
- }
- desc.setCapabilities(newCapabilities);
+ List<IArtifactKey> originalArtifacts = prototype.getArtifacts();
+ desc.setArtifacts(originalArtifacts.toArray(new IArtifactKey[originalArtifacts.size()]));
+ List<IProvidedCapability> originalCapabilities = prototype.getProvidedCapabilities();
+ desc.setCapabilities(originalCapabilities.toArray(new IProvidedCapability[originalCapabilities.size()]));
desc.setCopyright(prototype.getCopyright());
desc.setFilter(prototype.getFilter() == null ? null : ((LDAPQuery) prototype.getFilter()).getFilter());
desc.setId(prototype.getId());
- desc.setLicenses(prototype.getLicenses());
- IRequirement[] originalRequirements = prototype.getRequiredCapabilities();
- IRequirement[] newRequirements = new IRequiredCapability[originalRequirements.length];
- for (int i = 0; i < newRequirements.length; i++) {
- if (originalRequirements[i] instanceof IRequirement) {
- IRequiredCapability reqCapability = (IRequiredCapability) originalRequirements[i];
- newRequirements[i] = MetadataFactory.createRequiredCapability(reqCapability.getNamespace(), reqCapability.getName(), reqCapability.getRange(), reqCapability.getFilter(), reqCapability.getMin(), reqCapability.getMax(), reqCapability.isGreedy());
- } else {
- throw new IllegalStateException();
- }
-
- }
- desc.setRequiredCapabilities(prototype.getRequiredCapabilities());
+ List<ILicense> originalLicenses = prototype.getLicenses();
+ desc.setLicenses(originalLicenses.toArray(new ILicense[originalLicenses.size()]));
+ List<IRequirement> originalRequirements = prototype.getRequiredCapabilities();
+ desc.setRequiredCapabilities(originalRequirements.toArray(new IRequirement[originalRequirements.size()]));
+ originalRequirements = prototype.getMetaRequiredCapabilities();
+ desc.setMetaRequiredCapabilities(originalRequirements.toArray(new IRequirement[originalRequirements.size()]));
desc.setSingleton(prototype.isSingleton());
desc.setTouchpointType(MetadataFactory.createTouchpointType(prototype.getTouchpointType().getId(), prototype.getTouchpointType().getVersion()));
desc.setUpdateDescriptor(MetadataFactory.createUpdateDescriptor(prototype.getUpdateDescriptor().getId(), prototype.getUpdateDescriptor().getRange(), prototype.getUpdateDescriptor().getSeverity(), prototype.getUpdateDescriptor().getDescription()));
@@ -528,7 +520,7 @@ public abstract class AbstractProvisioningTest extends TestCase {
* Creates and returns a required capability with the provided attributes.
*/
protected static IRequiredCapability[] createRequiredCapabilities(String namespace, String name, VersionRange range, String filter) {
- return new IRequiredCapability[] {(IRequiredCapability) MetadataFactory.createRequiredCapability(namespace, name, range, filter, false, false)};
+ return new IRequiredCapability[] {MetadataFactory.createRequiredCapability(namespace, name, range, filter, false, false)};
}
public static boolean delete(File file) {
@@ -1436,7 +1428,7 @@ public abstract class AbstractProvisioningTest extends TestCase {
int count = 0;
try {
IArtifactRepository repo = getArtifactRepositoryManager().loadRepository(location, null);
- IQueryResult descriptors = repo.query(ArtifactDescriptorQuery.ALL_DESCRIPTORS, null);
+ IQueryResult descriptors = repo.descriptorQueryable().query(ArtifactDescriptorQuery.ALL_DESCRIPTORS, null);
return queryResultSize(descriptors);
} catch (ProvisionException e) {
fail("Failed to load repository " + URIUtil.toUnencodedString(location) + " for ArtifactDescriptor count");
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractWrappedArtifactRepository.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractWrappedArtifactRepository.java
index ba05fd0c3..ad851cc5c 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractWrappedArtifactRepository.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractWrappedArtifactRepository.java
@@ -10,16 +10,16 @@
*******************************************************************************/
package org.eclipse.equinox.p2.tests;
-import org.eclipse.equinox.p2.metadata.query.IQueryResult;
-
import java.io.OutputStream;
import java.net.URI;
import java.util.Map;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
+import org.eclipse.equinox.internal.provisional.p2.metadata.query.IQueryable;
import org.eclipse.equinox.p2.metadata.IArtifactKey;
import org.eclipse.equinox.p2.metadata.query.IQuery;
+import org.eclipse.equinox.p2.metadata.query.IQueryResult;
import org.eclipse.equinox.p2.repository.artifact.*;
public class AbstractWrappedArtifactRepository implements IArtifactRepository {
@@ -134,7 +134,11 @@ public class AbstractWrappedArtifactRepository implements IArtifactRepository {
return delegate.createArtifactDescriptor(key);
}
- public IQueryResult query(IQuery query, IProgressMonitor monitor) {
+ public IQueryable<IArtifactDescriptor> descriptorQueryable() {
+ return delegate.descriptorQueryable();
+ }
+
+ public IQueryResult<IArtifactKey> query(IQuery<IArtifactKey> query, IProgressMonitor monitor) {
return delegate.query(query, monitor);
}
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/IUPropertyUtils.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/IUPropertyUtils.java
index 4858e1f86..fbfa8e7b7 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/IUPropertyUtils.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/IUPropertyUtils.java
@@ -63,10 +63,10 @@ public class IUPropertyUtils {
}
public ILicense[] getLicenses(IInstallableUnit iu, Locale locale) {
- ILicense[] licenses = iu.getLicenses();
- ILicense[] translatedLicenses = new ILicense[licenses.length];
- for (int i = 0; i < licenses.length; i++) {
- translatedLicenses[i] = getLicense(iu, licenses[i], locale);
+ List<ILicense> licenses = iu.getLicenses();
+ ILicense[] translatedLicenses = new ILicense[licenses.size()];
+ for (int i = 0; i < licenses.size(); i++) {
+ translatedLicenses[i] = getLicense(iu, licenses.get(i), locale);
}
return translatedLicenses;
}
@@ -125,7 +125,7 @@ public class IUPropertyUtils {
}
};
- IQuery iuQuery = new PipedQuery(new IQuery[] {new FragmentQuery(), hostLocalizationQuery});
+ IQuery iuQuery = new PipedQuery(new FragmentQuery(), hostLocalizationQuery);
IQueryResult collected = iuQuery.perform(localizationFragments.iterator());
if (!collected.isEmpty()) {
@@ -182,9 +182,9 @@ public class IUPropertyUtils {
boolean haveLocale = false;
if (object instanceof IInstallableUnitFragment) {
IInstallableUnitFragment fragment = (IInstallableUnitFragment) object;
- IProvidedCapability[] provides = fragment.getProvidedCapabilities();
- for (int j = 0; j < provides.length && !haveLocale; j++) {
- IProvidedCapability nextProvide = provides[j];
+ List<IProvidedCapability> provides = fragment.getProvidedCapabilities();
+ for (int j = 0; j < provides.size() && !haveLocale; j++) {
+ IProvidedCapability nextProvide = provides.get(j);
if (NAMESPACE_IU_LOCALIZATION.equals(nextProvide.getNamespace())) {
String providedLocale = nextProvide.getName();
if (providedLocale != null) {
@@ -202,7 +202,7 @@ public class IUPropertyUtils {
}
};
- IQuery iuQuery = new PipedQuery(new IQuery[] {new FragmentQuery(), localeFragmentQuery});
+ IQuery iuQuery = new PipedQuery(new FragmentQuery(), localeFragmentQuery);
IQueryResult collected = queryable.query(iuQuery, null);
LocaleCollectorCache.put(locale, new SoftReference(collected));
return collected;
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestArtifactRepository.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestArtifactRepository.java
index b16387019..bf5463e6c 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestArtifactRepository.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestArtifactRepository.java
@@ -10,8 +10,6 @@
*******************************************************************************/
package org.eclipse.equinox.p2.tests;
-import org.eclipse.equinox.p2.metadata.query.IQueryResult;
-
import java.io.*;
import java.lang.reflect.Method;
import java.net.URI;
@@ -23,10 +21,12 @@ import org.eclipse.equinox.internal.p2.artifact.repository.ArtifactRequest;
import org.eclipse.equinox.internal.p2.repository.Transport;
import org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager;
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.ProcessingStepHandler;
+import org.eclipse.equinox.internal.provisional.p2.metadata.query.IQueryable;
import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryCreationException;
import org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.AbstractArtifactRepository;
import org.eclipse.equinox.p2.metadata.IArtifactKey;
import org.eclipse.equinox.p2.metadata.query.IQuery;
+import org.eclipse.equinox.p2.metadata.query.IQueryResult;
import org.eclipse.equinox.p2.repository.IRepository;
import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRequest;
@@ -196,7 +196,12 @@ public class TestArtifactRepository extends AbstractArtifactRepository {
throw new UnsupportedOperationException("Method is not implemented by this repository");
}
- public IQueryResult query(IQuery query, IProgressMonitor monitor) {
+ public IQueryable<IArtifactDescriptor> descriptorQueryable() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public IQueryResult<IArtifactKey> query(IQuery<IArtifactKey> query, IProgressMonitor monitor) {
// TODO Auto-generated method stub
return null;
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/MirrorTaskTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/MirrorTaskTest.java
index cb75b7d95..f5ea965f6 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/MirrorTaskTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/MirrorTaskTest.java
@@ -753,7 +753,7 @@ public class MirrorTaskTest extends AbstractAntProvisioningTest {
protected int getArtifactKeyCount(IQueryResult ius) {
int count = 0;
for (Iterator iter = ius.iterator(); iter.hasNext();)
- count += ((InstallableUnit) iter.next()).getArtifacts().length;
+ count += ((InstallableUnit) iter.next()).getArtifacts().size();
return count;
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/Repo2RunnableTaskTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/Repo2RunnableTaskTests.java
index 54b4a1c17..ceced0b38 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/Repo2RunnableTaskTests.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/Repo2RunnableTaskTests.java
@@ -70,7 +70,7 @@ public class Repo2RunnableTaskTests extends AbstractAntProvisioningTest {
task.addElement(createIUElement(iu));
runAntTask();
- assertEquals("Number of artifact keys differs", iu.getArtifacts().length, getArtifactKeyCount(destination));
+ assertEquals("Number of artifact keys differs", iu.getArtifacts().size(), getArtifactKeyCount(destination));
assertTrue("Unexpected format", expectedFormat(destination));
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/Bug265577.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/Bug265577.java
index a0d591d47..a2076a7ed 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/Bug265577.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/Bug265577.java
@@ -63,7 +63,7 @@ public class Bug265577 extends AbstractProvisioningTest {
public void testZippedRepoWithFolderFeature() {
IQueryResult queryResult = metadataRepo.query(new InstallableUnitQuery("Field_Assist_Example.feature.jar"), null);
IInstallableUnit[] ius = (IInstallableUnit[]) queryResult.toArray(IInstallableUnit.class);
- IArtifactKey key = (ius[0].getArtifacts())[0];
+ IArtifactKey key = (ius[0].getArtifacts()).get(0);
IArtifactDescriptor[] descriptors = artifactRepo.getArtifactDescriptors(key);
ArtifactDescriptor desc = (ArtifactDescriptor) descriptors[0];
@@ -87,7 +87,7 @@ public class Bug265577 extends AbstractProvisioningTest {
public void testZippedRepo() {
IQueryResult queryResult = metadataRepo.query(new InstallableUnitQuery("valid.feature.jar"), null);
IInstallableUnit[] ius = (IInstallableUnit[]) queryResult.toArray(IInstallableUnit.class);
- IArtifactKey key = (ius[0].getArtifacts())[0];
+ IArtifactKey key = (ius[0].getArtifacts()).get(0);
IArtifactDescriptor[] descriptors = artifactRepo.getArtifactDescriptors(key);
IArtifactDescriptor desc = descriptors[0];
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MD5Tests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MD5Tests.java
index 22f89b277..614233041 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MD5Tests.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MD5Tests.java
@@ -35,9 +35,9 @@ public class MD5Tests extends AbstractProvisioningTest {
}
public void testCheckMD5() {
- IQueryResult descriptors = repo.query(ArtifactDescriptorQuery.ALL_DESCRIPTORS, null);
- for (Iterator iterator = descriptors.iterator(); iterator.hasNext();) {
- IArtifactDescriptor desc = (IArtifactDescriptor) iterator.next();
+ IQueryResult<IArtifactDescriptor> descriptors = repo.descriptorQueryable().query(ArtifactDescriptorQuery.ALL_DESCRIPTORS, null);
+ for (Iterator<IArtifactDescriptor> iterator = descriptors.iterator(); iterator.hasNext();) {
+ IArtifactDescriptor desc = iterator.next();
IStatus status = repo.getArtifact(desc, new ByteArrayOutputStream(500), new NullProgressMonitor());
//All artifacts that are expected to fail MD5 check are those whose id starts with bogus
if (desc.getArtifactKey().getId().startsWith("bogus")) {
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorRequestTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorRequestTest.java
index 3e04f8fe6..a0beda09a 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorRequestTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorRequestTest.java
@@ -24,6 +24,7 @@ import org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifact
import org.eclipse.equinox.internal.p2.metadata.ArtifactKey;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
import org.eclipse.equinox.internal.provisional.p2.metadata.Version;
+import org.eclipse.equinox.internal.provisional.p2.metadata.query.IQueryable;
import org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.AbstractArtifactRepository;
import org.eclipse.equinox.internal.provisional.spi.p2.repository.AbstractRepository;
import org.eclipse.equinox.p2.metadata.IArtifactKey;
@@ -67,7 +68,7 @@ public class MirrorRequestTest extends AbstractProvisioningTest {
public void testInvalidZipFileInTheSource() {
IArtifactKey key = new ArtifactKey("org.eclipse.update.feature", "HelloWorldFeature", Version.createOSGi(1, 0, 0));
- Properties targetProperties = new Properties();
+ Map<String, String> targetProperties = new HashMap<String, String>();
targetProperties.put("artifact.folder", "true");
MirrorRequest request = new MirrorRequest(key, targetRepository, null, targetProperties);
request.setSourceRepository(sourceRepository);
@@ -80,7 +81,7 @@ public class MirrorRequestTest extends AbstractProvisioningTest {
public void testMissingArtifact() {
IArtifactKey key = new ArtifactKey("org.eclipse.update.feature", "Missing", Version.createOSGi(1, 0, 0));
- Properties targetProperties = new Properties();
+ Map<String, String> targetProperties = new HashMap<String, String>();
targetProperties.put("artifact.folder", "true");
MirrorRequest request = new MirrorRequest(key, targetRepository, null, targetProperties);
request.setSourceRepository(sourceRepository);
@@ -303,7 +304,11 @@ public class MirrorRequestTest extends AbstractProvisioningTest {
return delegate.getRawArtifact(descriptor, destination, monitor);
}
- public IQueryResult query(IQuery query, IProgressMonitor monitor) {
+ public IQueryable<IArtifactDescriptor> descriptorQueryable() {
+ return delegate.descriptorQueryable();
+ }
+
+ public IQueryResult<IArtifactKey> query(IQuery<IArtifactKey> query, IProgressMonitor monitor) {
return delegate.query(query, monitor);
}
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/SimpleArtifactRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/SimpleArtifactRepositoryTest.java
index f36b579b0..466e42a3f 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/SimpleArtifactRepositoryTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/SimpleArtifactRepositoryTest.java
@@ -24,7 +24,7 @@ import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processin
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
import org.eclipse.equinox.internal.provisional.p2.metadata.Version;
import org.eclipse.equinox.internal.provisional.p2.metadata.VersionRange;
-import org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.MappedCollectionIterator;
+import org.eclipse.equinox.internal.provisional.p2.metadata.query.IQueryable;
import org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.SimpleArtifactRepositoryFactory;
import org.eclipse.equinox.p2.metadata.IArtifactKey;
import org.eclipse.equinox.p2.metadata.query.IQueryResult;
@@ -364,98 +364,17 @@ public class SimpleArtifactRepositoryTest extends AbstractProvisioningTest {
repo.addDescriptor(d2);
repo.addDescriptor(d3);
- IQueryResult result = repo.query(new ArtifactDescriptorQuery("a", null, null), null);
+ IQueryable<IArtifactDescriptor> descQueryable = repo.descriptorQueryable();
+ IQueryResult<IArtifactDescriptor> result = descQueryable.query(new ArtifactDescriptorQuery("a", null, null), null);
assertEquals(3, queryResultSize(result));
- result = repo.query(new ArtifactDescriptorQuery(null, new VersionRange("[2.0.0, 3.0.0)"), null), null);
+ result = descQueryable.query(new ArtifactDescriptorQuery(null, new VersionRange("[2.0.0, 3.0.0)"), null), null);
assertEquals(2, queryResultSize(result));
assertNotContains(result, d1);
- result = repo.query(new ArtifactDescriptorQuery(null, null, IArtifactDescriptor.FORMAT_PACKED), null);
+ result = descQueryable.query(new ArtifactDescriptorQuery(null, null, IArtifactDescriptor.FORMAT_PACKED), null);
assertEquals(1, queryResultSize(result));
- IArtifactDescriptor resultDescriptor = (IArtifactDescriptor) result.iterator().next();
+ IArtifactDescriptor resultDescriptor = result.iterator().next();
assertEquals(d3.getArtifactKey(), resultDescriptor.getArtifactKey());
}
-
- public void testArtifactIterator() throws Exception {
- HashMap map = new HashMap();
-
- IArtifactKey key = new ArtifactKey("osgi.bundle", "a", Version.create("1.0.0"));
- map.put(key, new ArtifactDescriptor(key));
-
- Collection collection = new ArrayList(2);
- key = new ArtifactKey("osgi.bundle", "a", Version.create("2.0.0"));
- collection.add(new ArtifactDescriptor(key));
- ArtifactDescriptor d = new ArtifactDescriptor(key);
- d.setProperty(IArtifactDescriptor.FORMAT, IArtifactDescriptor.FORMAT_PACKED);
- collection.add(d);
- map.put(key, collection);
-
- MappedCollectionIterator iterator = new MappedCollectionIterator(map, true);
- assertTrue(iterator.hasNext());
- Object o = iterator.next();
- assertTrue(o instanceof IArtifactKey);
- if (((IArtifactKey) o).getVersion().equals(Version.parseVersion("1.0.0"))) {
- assertTrue(iterator.hasNext());
- assertTrue(iterator.next() instanceof IArtifactDescriptor);
- assertTrue(iterator.hasNext());
- assertTrue(iterator.next() instanceof IArtifactKey);
- assertTrue(iterator.hasNext());
- assertFalse(iterator.hasNextKey());
- assertTrue(iterator.next() instanceof IArtifactDescriptor);
- assertTrue(iterator.hasNext());
- assertTrue(iterator.next() instanceof IArtifactDescriptor);
- assertFalse(iterator.hasNext());
- } else {
- assertTrue(iterator.hasNext());
- assertTrue(iterator.next() instanceof IArtifactDescriptor);
- assertTrue(iterator.hasNext());
- assertTrue(iterator.next() instanceof IArtifactDescriptor);
- assertTrue(iterator.hasNext());
- assertTrue(iterator.hasNextKey());
- assertTrue(iterator.next() instanceof IArtifactKey);
- assertTrue(iterator.hasNext());
- assertFalse(iterator.hasNextKey());
- assertTrue(iterator.next() instanceof IArtifactDescriptor);
- assertFalse(iterator.hasNext());
- }
- }
-
- public void testArtifactIterator_2() throws Exception {
- HashMap map = new HashMap();
-
- IArtifactKey key = new ArtifactKey("osgi.bundle", "a", Version.create("1.0.0"));
- map.put(key, new ArtifactDescriptor(key));
-
- Collection collection = new ArrayList(2);
- key = new ArtifactKey("osgi.bundle", "a", Version.create("2.0.0"));
- collection.add(new ArtifactDescriptor(key));
- ArtifactDescriptor d = new ArtifactDescriptor(key);
- d.setProperty(IArtifactDescriptor.FORMAT, IArtifactDescriptor.FORMAT_PACKED);
- collection.add(d);
- map.put(key, collection);
-
- MappedCollectionIterator iterator = new MappedCollectionIterator(map, false);
- assertFalse(iterator.hasNextKey());
- assertTrue(iterator.hasNext());
- assertTrue(iterator.next() instanceof IArtifactDescriptor);
- assertTrue(iterator.next() instanceof IArtifactDescriptor);
- assertTrue(iterator.next() instanceof IArtifactDescriptor);
- assertFalse(iterator.hasNext());
-
- iterator = new MappedCollectionIterator(map, true);
- Object o = iterator.next();
- assertTrue(o instanceof IArtifactKey);
- if (((IArtifactKey) o).getVersion().equals(Version.parseVersion("1.0.0"))) {
- assertNotNull(iterator.nextKey());
- assertFalse(iterator.hasNextKey());
- assertTrue(iterator.next() instanceof IArtifactDescriptor);
- assertTrue(iterator.next() instanceof IArtifactDescriptor);
- } else {
- assertNotNull(iterator.nextKey());
- assertFalse(iterator.hasNextKey());
- assertTrue(iterator.next() instanceof IArtifactDescriptor);
- }
- assertFalse(iterator.hasNext());
- }
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/AggregateQueryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/AggregateQueryTest.java
index 416bd45cf..4a45f777c 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/AggregateQueryTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/AggregateQueryTest.java
@@ -116,11 +116,11 @@ public class AggregateQueryTest extends TestCase {
}
};
- PipedQuery compoundQuery = new PipedQuery(new IQuery[] {getLatest, getAllBut3});
+ PipedQuery compoundQuery = new PipedQuery(getLatest, getAllBut3);
IQueryResult result = compoundQuery.perform(get123().iterator());
assertEquals(0, AbstractProvisioningTest.queryResultSize(result));
- compoundQuery = new PipedQuery(new IQuery[] {getAllBut3, getLatest});
+ compoundQuery = new PipedQuery(getAllBut3, getLatest);
result = compoundQuery.perform(get123().iterator());
assertEquals(1, AbstractProvisioningTest.queryResultSize(result));
assertEquals("2", result.iterator().next());
@@ -145,10 +145,10 @@ public class AggregateQueryTest extends TestCase {
};
CompoundQuery compoundQuery = CompoundQuery.createCompoundQuery(new IQuery[] {A, B, C}, true);
assertTrue("1.0", compoundQuery instanceof IMatchQuery);
- assertEquals("1.1", 3, compoundQuery.getQueries().length);
- assertEquals("1.2", A, compoundQuery.getQueries()[0]);
- assertEquals("1.3", B, compoundQuery.getQueries()[1]);
- assertEquals("1.4", C, compoundQuery.getQueries()[2]);
+ assertEquals("1.1", 3, compoundQuery.getQueries().size());
+ assertEquals("1.2", A, compoundQuery.getQueries().get(0));
+ assertEquals("1.3", B, compoundQuery.getQueries().get(1));
+ assertEquals("1.4", C, compoundQuery.getQueries().get(2));
}
public void testCompoundSomeMatchQueries() {
@@ -170,10 +170,10 @@ public class AggregateQueryTest extends TestCase {
};
CompoundQuery compoundQuery = CompoundQuery.createCompoundQuery(new IQuery[] {A, B, C}, true);
assertTrue("1.0", !(compoundQuery instanceof IMatchQuery));
- assertEquals("1.1", 3, compoundQuery.getQueries().length);
- assertEquals("1.2", A, compoundQuery.getQueries()[0]);
- assertEquals("1.3", B, compoundQuery.getQueries()[1]);
- assertEquals("1.4", C, compoundQuery.getQueries()[2]);
+ assertEquals("1.1", 3, compoundQuery.getQueries().size());
+ assertEquals("1.2", A, compoundQuery.getQueries().get(0));
+ assertEquals("1.3", B, compoundQuery.getQueries().get(1));
+ assertEquals("1.4", C, compoundQuery.getQueries().get(2));
}
public void testCompoundNoMatchQueries() {
@@ -197,10 +197,10 @@ public class AggregateQueryTest extends TestCase {
};
CompoundQuery compoundQuery = CompoundQuery.createCompoundQuery(new IQuery[] {A, B, C}, true);
assertTrue("1.0", !(compoundQuery instanceof IMatchQuery));
- assertEquals("1.1", 3, compoundQuery.getQueries().length);
- assertEquals("1.2", A, compoundQuery.getQueries()[0]);
- assertEquals("1.3", B, compoundQuery.getQueries()[1]);
- assertEquals("1.4", C, compoundQuery.getQueries()[2]);
+ assertEquals("1.1", 3, compoundQuery.getQueries().size());
+ assertEquals("1.2", A, compoundQuery.getQueries().get(0));
+ assertEquals("1.3", B, compoundQuery.getQueries().get(1));
+ assertEquals("1.4", C, compoundQuery.getQueries().get(2));
}
public void testIntersection() {
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/CompoundQueryableTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/CompoundQueryableTest.java
index 00e12f081..912232529 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/CompoundQueryableTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/CompoundQueryableTest.java
@@ -280,7 +280,7 @@ public class CompoundQueryableTest extends TestCase {
CompoundQueryable cQueryable1 = new CompoundQueryable(new IQueryable[] {queryable3, queryable2});
CompoundQueryable cQueryable = new CompoundQueryable(new IQueryable[] {cQueryable1, queryable1});
CompoundQueryTestProgressMonitor monitor = new CompoundQueryTestProgressMonitor();
- IQueryResult queryResult = cQueryable.query(new PipedQuery(new IQuery[] {contextQuery, greatestNumberQuery}), monitor);
+ IQueryResult queryResult = cQueryable.query(new PipedQuery(contextQuery, greatestNumberQuery), monitor);
assertEquals("1.0", 1, AbstractProvisioningTest.queryResultSize(queryResult));
AbstractProvisioningTest.assertContains("1.2", queryResult, 12);
assertTrue("1.0", monitor.isDone());
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/QueryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/QueryTest.java
index 143200530..db275a82b 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/QueryTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/QueryTest.java
@@ -187,7 +187,7 @@ public class QueryTest extends TestCase {
List items = Arrays.asList("red", "green", "blue");
PerformHookQuery query1 = new PerformHookQuery();
PerformHookQuery query2 = new PerformHookQuery();
- PipedQuery cQuery = new PipedQuery(new IQuery[] {query1, query2});
+ PipedQuery cQuery = new PipedQuery(query1, query2);
assertFalse("1.0", query1.isComplete());
assertFalse("1.1", query1.isPrepared());
assertFalse("1.2", query2.isComplete());
@@ -228,7 +228,7 @@ public class QueryTest extends TestCase {
List items = Arrays.asList("red", new Object());
PerformHookQuery query1 = new PerformHookQuery();
PerformHookQuery query2 = new PerformHookQuery();
- PipedQuery cQuery = new PipedQuery(new IQuery[] {query1, query2});
+ PipedQuery cQuery = new PipedQuery(query1, query2);
assertFalse("1.0", query1.isComplete());
assertFalse("1.1", query1.isPrepared());
assertFalse("1.2", query2.isComplete());
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/OperationGenerationTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/OperationGenerationTest.java
index b5e6c2bb5..58f678333 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/OperationGenerationTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/OperationGenerationTest.java
@@ -10,8 +10,7 @@
*******************************************************************************/
package org.eclipse.equinox.p2.tests.director;
-import java.util.ArrayList;
-import java.util.Collection;
+import java.util.*;
import org.eclipse.equinox.internal.p2.director.OperationGenerator;
import org.eclipse.equinox.internal.p2.metadata.ResolvedInstallableUnit;
import org.eclipse.equinox.internal.provisional.p2.metadata.*;
@@ -36,10 +35,10 @@ public class OperationGenerationTest extends AbstractProvisioningTest {
to.add(a1);
to.add(a3);
- InstallableUnitOperand[] operands = new OperationGenerator().generateOperation(from, to);
+ List<InstallableUnitOperand> operands = new OperationGenerator().generateOperation(from, to);
// 1 x install
// 1 x uninstall
- assertEquals(2, operands.length);
+ assertEquals(2, operands.size());
}
public void test1() {
@@ -58,9 +57,9 @@ public class OperationGenerationTest extends AbstractProvisioningTest {
to.add(a3);
to.add(a2);
- InstallableUnitOperand[] operands = new OperationGenerator().generateOperation(from, to);
+ List<InstallableUnitOperand> operands = new OperationGenerator().generateOperation(from, to);
// 1 x install
- assertEquals(1, operands.length);
+ assertEquals(1, operands.size());
}
public void test2() {
@@ -79,9 +78,9 @@ public class OperationGenerationTest extends AbstractProvisioningTest {
to.add(a1);
to.add(a3);
- InstallableUnitOperand[] operands = new OperationGenerator().generateOperation(from, to);
+ List<InstallableUnitOperand> operands = new OperationGenerator().generateOperation(from, to);
// 1 x uninstall
- assertEquals(1, operands.length);
+ assertEquals(1, operands.size());
}
public void testUpdate1() {
@@ -100,9 +99,9 @@ public class OperationGenerationTest extends AbstractProvisioningTest {
to = new ArrayList();
to.add(MetadataFactory.createInstallableUnit(b));
- InstallableUnitOperand[] operands = new OperationGenerator().generateOperation(from, to);
+ List<InstallableUnitOperand> operands = new OperationGenerator().generateOperation(from, to);
// 1 x upgrade
- assertEquals(1, operands.length);
+ assertEquals(1, operands.size());
}
public void testUpdate2() {
@@ -123,10 +122,10 @@ public class OperationGenerationTest extends AbstractProvisioningTest {
to = new ArrayList();
to.add(MetadataFactory.createInstallableUnit(b));
- InstallableUnitOperand[] operands = new OperationGenerator().generateOperation(from, to);
+ List<InstallableUnitOperand> operands = new OperationGenerator().generateOperation(from, to);
// 1 x install
// 2 x uninstall
- assertEquals(3, operands.length);
+ assertEquals(3, operands.size());
}
public void testUpdate3() {
@@ -153,9 +152,9 @@ public class OperationGenerationTest extends AbstractProvisioningTest {
to.add(MetadataFactory.createInstallableUnit(b));
to.add(MetadataFactory.createInstallableUnit(c));
- InstallableUnitOperand[] operands = new OperationGenerator().generateOperation(from, to);
+ List<InstallableUnitOperand> operands = new OperationGenerator().generateOperation(from, to);
// 2 x update
- assertEquals(2, operands.length);
+ assertEquals(2, operands.size());
}
public void testUpdate4() {
@@ -180,9 +179,9 @@ public class OperationGenerationTest extends AbstractProvisioningTest {
to.add(a2);
to.add(MetadataFactory.createInstallableUnit(b2));
- InstallableUnitOperand[] operands = new OperationGenerator().generateOperation(from, to);
+ List<InstallableUnitOperand> operands = new OperationGenerator().generateOperation(from, to);
// 1 x update
- assertEquals(1, operands.length);
+ assertEquals(1, operands.size());
}
public void testUpdate5() {
@@ -206,10 +205,10 @@ public class OperationGenerationTest extends AbstractProvisioningTest {
to.add(a1);
to.add(MetadataFactory.createInstallableUnit(b2));
- InstallableUnitOperand[] operands = new OperationGenerator().generateOperation(from, to);
+ List<InstallableUnitOperand> operands = new OperationGenerator().generateOperation(from, to);
// 1 x update
// 1 x uninstall
- assertEquals(2, operands.length);
+ assertEquals(2, operands.size());
}
public void test248468b() {
@@ -230,16 +229,16 @@ public class OperationGenerationTest extends AbstractProvisioningTest {
Collection to = new ArrayList();
to.add(MetadataFactory.createResolvedInstallableUnit(three, new IInstallableUnitFragment[0]));
- InstallableUnitOperand[] operands = new OperationGenerator().generateOperation(from, to);
+ List<InstallableUnitOperand> operands = new OperationGenerator().generateOperation(from, to);
//We are uninstalling myBundle 1.0 and 2.0. 3.0 stays unchanged.
- for (int i = 0; i < operands.length; i++) {
- assertNotSame("3.0", three, operands[i].first());
- assertNotSame("3.0.1", three, operands[i].second());
+ for (int i = 0; i < operands.size(); i++) {
+ assertNotSame("3.0", three, operands.get(i).first());
+ assertNotSame("3.0.1", three, operands.get(i).second());
}
- assertEquals("3.1", one, operands[0].first());
- assertNull("3.2", operands[0].second());
- assertEquals("3.3", two, operands[1].first());
- assertNull("3.4", operands[1].second());
+ assertEquals("3.1", one, operands.get(0).first());
+ assertNull("3.2", operands.get(0).second());
+ assertEquals("3.3", two, operands.get(1).first());
+ assertNull("3.4", operands.get(1).second());
}
public void test248468d() {
@@ -260,16 +259,16 @@ public class OperationGenerationTest extends AbstractProvisioningTest {
to.add(MetadataFactory.createResolvedInstallableUnit(two, new IInstallableUnitFragment[0]));
to.add(MetadataFactory.createResolvedInstallableUnit(three, new IInstallableUnitFragment[0]));
- InstallableUnitOperand[] operands = new OperationGenerator().generateOperation(from, to);
+ List<InstallableUnitOperand> operands = new OperationGenerator().generateOperation(from, to);
//Two is already in the system therefore it will not be in the operands
- for (int i = 0; i < operands.length; i++) {
- assertNotSame("2.0", two, operands[i].first());
- assertNotSame("2.1", two, operands[i].second());
+ for (int i = 0; i < operands.size(); i++) {
+ assertNotSame("2.0", two, operands.get(i).first());
+ assertNotSame("2.1", two, operands.get(i).second());
}
//three is an update of one
- assertEquals("2.2", 1, operands.length);
- assertEquals("2.4", one, operands[0].first());
- assertEquals("2.5", three, operands[0].second());
+ assertEquals("2.2", 1, operands.size());
+ assertEquals("2.4", one, operands.get(0).first());
+ assertEquals("2.5", three, operands.get(0).second());
}
public void test248468c() {
@@ -291,18 +290,18 @@ public class OperationGenerationTest extends AbstractProvisioningTest {
to.add(MetadataFactory.createResolvedInstallableUnit(two, new IInstallableUnitFragment[0]));
to.add(MetadataFactory.createResolvedInstallableUnit(three, new IInstallableUnitFragment[0]));
- InstallableUnitOperand[] operands = new OperationGenerator().generateOperation(from, to);
+ List<InstallableUnitOperand> operands = new OperationGenerator().generateOperation(from, to);
//Two is already in the system therefore it will not be in the operands
- for (int i = 0; i < operands.length; i++) {
- assertNotSame("2.0", two, operands[i].first());
- assertNotSame("2.1", two, operands[i].second());
+ for (int i = 0; i < operands.size(); i++) {
+ assertNotSame("2.0", two, operands.get(i).first());
+ assertNotSame("2.1", two, operands.get(i).second());
}
//We install three and uninstall one
- assertEquals("2.2", 2, operands.length);
- assertNull("2.3", operands[0].first());
- assertEquals("2.4", three, operands[0].second());
- assertEquals("2.5", one, operands[1].first());
- assertNull("2.6", operands[1].second());
+ assertEquals("2.2", 2, operands.size());
+ assertNull("2.3", operands.get(0).first());
+ assertEquals("2.4", three, operands.get(0).second());
+ assertEquals("2.5", one, operands.get(1).first());
+ assertNull("2.6", operands.get(1).second());
}
public void test248468() {
@@ -319,10 +318,10 @@ public class OperationGenerationTest extends AbstractProvisioningTest {
Collection to = new ArrayList();
to.add(MetadataFactory.createResolvedInstallableUnit(two, new IInstallableUnitFragment[0]));
- InstallableUnitOperand[] operands = new OperationGenerator().generateOperation(from, to);
- assertEquals("1.0", 1, operands.length);
- assertEquals("1.1", one, operands[0].first());
- assertNull("1.2", operands[0].second());
+ List<InstallableUnitOperand> operands = new OperationGenerator().generateOperation(from, to);
+ assertEquals("1.0", 1, operands.size());
+ assertEquals("1.1", one, operands.get(0).first());
+ assertNull("1.2", operands.get(0).second());
}
public void testConfigurationChange1() {
@@ -344,16 +343,17 @@ public class OperationGenerationTest extends AbstractProvisioningTest {
to.add(toResolved);
to.add(MetadataFactory.createResolvedInstallableUnit(anotherIU2, new IInstallableUnitFragment[0]));
- InstallableUnitOperand[] operands = new OperationGenerator().generateOperation(from, to);
+ List<InstallableUnitOperand> operands = new OperationGenerator().generateOperation(from, to);
- assertEquals("1.0", 3, operands.length);
+ assertEquals("1.0", 3, operands.size());
assertContainsConfigurationChange("2.0", operands);
assertContainsInstallableUnitOperand("3.0", operands, new InstallableUnitOperand(fromResolved, toResolved));
}
- private void assertContainsInstallableUnitOperand(String message, InstallableUnitOperand[] operands, InstallableUnitOperand operand) {
- for (int i = 0; i < operands.length; i++) {
- if (operands[i].first() != null && operands[i].first().equals(operand.first()) && operands[i].second() != null && operands[i].second().equals(operand.second()))
+ private void assertContainsInstallableUnitOperand(String message, List<InstallableUnitOperand> operands, InstallableUnitOperand operand) {
+ for (int i = 0; i < operands.size(); i++) {
+ InstallableUnitOperand cmp = operands.get(i);
+ if (cmp.first() != null && cmp.first().equals(operand.first()) && cmp.second() != null && cmp.second().equals(operand.second()))
return;
}
fail(message);
@@ -373,9 +373,9 @@ public class OperationGenerationTest extends AbstractProvisioningTest {
IInstallableUnit toResolved = MetadataFactory.createResolvedInstallableUnit(anIU, new IInstallableUnitFragment[] {cu2});
to.add(toResolved);
- InstallableUnitOperand[] operands = new OperationGenerator().generateOperation(from, to);
+ List<InstallableUnitOperand> operands = new OperationGenerator().generateOperation(from, to);
- assertEquals("1.0", 1, operands.length);
+ assertEquals("1.0", 1, operands.size());
assertContainsInstallableUnitOperand("3.0", operands, new InstallableUnitOperand(fromResolved, toResolved));
}
@@ -393,9 +393,9 @@ public class OperationGenerationTest extends AbstractProvisioningTest {
IInstallableUnit toResolved = MetadataFactory.createResolvedInstallableUnit(anIU, new IInstallableUnitFragment[0]);
to.add(toResolved);
- InstallableUnitOperand[] operands = new OperationGenerator().generateOperation(from, to);
+ List<InstallableUnitOperand> operands = new OperationGenerator().generateOperation(from, to);
- assertEquals("1.0", 1, operands.length);
+ assertEquals("1.0", 1, operands.size());
assertContainsInstallableUnitOperand("3.0", operands, new InstallableUnitOperand(fromResolved, toResolved));
}
@@ -413,9 +413,9 @@ public class OperationGenerationTest extends AbstractProvisioningTest {
IInstallableUnit toResolved = MetadataFactory.createResolvedInstallableUnit(anIU, new IInstallableUnitFragment[] {cu2});
to.add(toResolved);
- InstallableUnitOperand[] operands = new OperationGenerator().generateOperation(from, to);
+ List<InstallableUnitOperand> operands = new OperationGenerator().generateOperation(from, to);
- assertEquals("1.0", 0, operands.length);
+ assertEquals("1.0", 0, operands.size());
}
public void testConfigurationChange5() {
@@ -433,9 +433,9 @@ public class OperationGenerationTest extends AbstractProvisioningTest {
IInstallableUnit toResolved = MetadataFactory.createResolvedInstallableUnit(anIU, new IInstallableUnitFragment[] {cu2, cu1});
to.add(toResolved);
- InstallableUnitOperand[] operands = new OperationGenerator().generateOperation(from, to);
+ List<InstallableUnitOperand> operands = new OperationGenerator().generateOperation(from, to);
- assertEquals("1.0", 0, operands.length);
+ assertEquals("1.0", 0, operands.size());
}
public void testConfigurationChange6() {
@@ -454,9 +454,9 @@ public class OperationGenerationTest extends AbstractProvisioningTest {
IInstallableUnit toResolved = MetadataFactory.createResolvedInstallableUnit(anIU, new IInstallableUnitFragment[] {cu1, cu3});
to.add(toResolved);
- InstallableUnitOperand[] operands = new OperationGenerator().generateOperation(from, to);
+ List<InstallableUnitOperand> operands = new OperationGenerator().generateOperation(from, to);
- assertEquals("1.0", 1, operands.length);
+ assertEquals("1.0", 1, operands.size());
assertContainsInstallableUnitOperand("3.0", operands, new InstallableUnitOperand(fromResolved, toResolved));
}
@@ -468,9 +468,10 @@ public class OperationGenerationTest extends AbstractProvisioningTest {
fail(message + "Can't find " + expected);
}
- public void assertContainsConfigurationChange(String message, InstallableUnitOperand[] ops) {
- for (int i = 0; i < ops.length; i++) {
- if (ops[i].first() != null && ops[i].first().equals(ops[i].second())) {
+ public void assertContainsConfigurationChange(String message, List<InstallableUnitOperand> ops) {
+ for (int i = 0; i < ops.size(); i++) {
+ InstallableUnitOperand op = ops.get(i);
+ if (op.first() != null && op.first().equals(op.second())) {
return;
}
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/directorywatcher/RepositoryListenerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/directorywatcher/RepositoryListenerTest.java
index eef40220c..1927a5051 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/directorywatcher/RepositoryListenerTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/directorywatcher/RepositoryListenerTest.java
@@ -11,6 +11,7 @@
package org.eclipse.equinox.p2.tests.directorywatcher;
import java.io.File;
+import java.util.List;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactDescriptor;
@@ -35,11 +36,11 @@ public class RepositoryListenerTest extends AbstractDirectoryWatcherTest {
return new TestSuite(RepositoryListenerTest.class);
}
- public static boolean isZipped(ITouchpointData[] data) {
- if (data == null || data.length == 0)
+ public static boolean isZipped(List<ITouchpointData> data) {
+ if (data == null || data.size() == 0)
return false;
- for (int i = 0; i < data.length; i++) {
- if (data[i].getInstruction("zipped") != null) //$NON-NLS-1$
+ for (int i = 0; i < data.size(); i++) {
+ if (data.get(i).getInstruction("zipped") != null) //$NON-NLS-1$
return true;
}
return false;
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/directorywatcher/TestRepositoryWatcher.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/directorywatcher/TestRepositoryWatcher.java
index 0249e4884..f35f96055 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/directorywatcher/TestRepositoryWatcher.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/directorywatcher/TestRepositoryWatcher.java
@@ -11,8 +11,8 @@
package org.eclipse.equinox.p2.tests.directorywatcher;
import java.io.File;
-import java.util.Dictionary;
import java.util.Hashtable;
+import java.util.Map;
import org.eclipse.equinox.internal.provisional.p2.directorywatcher.DirectoryWatcher;
import org.eclipse.equinox.internal.provisional.p2.directorywatcher.RepositoryListener;
import org.eclipse.equinox.internal.provisional.p2.metadata.query.InstallableUnitQuery;
@@ -36,7 +36,7 @@ class TestRepositoryWatcher extends DirectoryWatcher {
*/
public static TestRepositoryWatcher createWatcher(File folder) {
RepositoryListener listener = new RepositoryListener(AbstractProvisioningTest.getUniqueString(), false);
- Dictionary props = new Hashtable();
+ Map<String, String> props = new Hashtable<String, String>();
props.put(DirectoryWatcher.DIR, folder.getAbsolutePath());
props.put(DirectoryWatcher.POLL, "500");
TestRepositoryWatcher result = new TestRepositoryWatcher(props, TestActivator.getContext());
@@ -47,7 +47,7 @@ class TestRepositoryWatcher extends DirectoryWatcher {
/*
* Constructor for the class.
*/
- private TestRepositoryWatcher(Dictionary props, BundleContext context) {
+ private TestRepositoryWatcher(Map<String, String> props, BundleContext context) {
super(props, context);
}
@@ -63,7 +63,7 @@ class TestRepositoryWatcher extends DirectoryWatcher {
* Return the list of all the IUs known to the metadata repository this watcher's listener.
*/
public IInstallableUnit[] getInstallableUnits() {
- return (IInstallableUnit[]) listener.getMetadataRepository().query(InstallableUnitQuery.ANY, null).toArray(IInstallableUnit.class);
+ return listener.getMetadataRepository().query(InstallableUnitQuery.ANY, null).toArray(IInstallableUnit.class);
}
/*
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/EngineTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/EngineTest.java
index 879643c45..06c29163b 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/EngineTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/EngineTest.java
@@ -69,7 +69,7 @@ public class EngineTest extends AbstractProvisioningTest {
return super.initializePhase(monitor, profile, parameters);
}
- protected ProvisioningAction[] getActions(Operand operand) {
+ protected List<ProvisioningAction> getActions(Operand operand) {
return null;
}
@@ -88,7 +88,7 @@ public class EngineTest extends AbstractProvisioningTest {
throw new NullPointerException();
}
- protected ProvisioningAction[] getActions(Operand operand) {
+ protected List<ProvisioningAction> getActions(Operand operand) {
return null;
}
}
@@ -102,7 +102,7 @@ public class EngineTest extends AbstractProvisioningTest {
this(false);
}
- protected ProvisioningAction[] getActions(Operand operand) {
+ protected List<ProvisioningAction> getActions(Operand operand) {
ProvisioningAction action = new ProvisioningAction() {
public IStatus undo(Map parameters) {
@@ -113,7 +113,7 @@ public class EngineTest extends AbstractProvisioningTest {
throw new NullPointerException();
}
};
- return new ProvisioningAction[] {action};
+ return Collections.singletonList(action);
}
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/InstructionParserTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/InstructionParserTest.java
index c64361ecc..45ee0d193 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/InstructionParserTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/InstructionParserTest.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.equinox.p2.tests.engine;
+import java.util.List;
import java.util.Map;
import junit.framework.Test;
import junit.framework.TestSuite;
@@ -62,21 +63,21 @@ public class InstructionParserTest extends AbstractProvisioningTest {
public void testGoodAction() {
InstructionParser parser = new InstructionParser(new ActionManager());
- ProvisioningAction[] actions = parser.parseActions(MetadataFactory.createTouchpointInstruction("goodAction()", null), TOUCHPOINT_TYPE);
- assertEquals(1, actions.length);
+ List<ProvisioningAction> actions = parser.parseActions(MetadataFactory.createTouchpointInstruction("goodAction()", null), TOUCHPOINT_TYPE);
+ assertEquals(1, actions.size());
}
public void testGoodActionFullyQualified() {
InstructionParser parser = new InstructionParser(new ActionManager());
- ProvisioningAction[] actions = parser.parseActions(MetadataFactory.createTouchpointInstruction("instructionparsertest.goodAction()", null), null);
- assertEquals(1, actions.length);
+ List<ProvisioningAction> actions = parser.parseActions(MetadataFactory.createTouchpointInstruction("instructionparsertest.goodAction()", null), null);
+ assertEquals(1, actions.size());
}
public void testBadActionFullyQualified() {
InstructionParser parser = new InstructionParser(new ActionManager());
try {
- ProvisioningAction[] actions = parser.parseActions(MetadataFactory.createTouchpointInstruction("instructionparsertest.badAction()", null), null);
- actions[0].execute(null);
+ List<ProvisioningAction> actions = parser.parseActions(MetadataFactory.createTouchpointInstruction("instructionparsertest.badAction()", null), null);
+ actions.get(0).execute(null);
} catch (IllegalArgumentException e) {
return;
}
@@ -85,21 +86,21 @@ public class InstructionParserTest extends AbstractProvisioningTest {
public void testGoodActionFromImport() {
InstructionParser parser = new InstructionParser(new ActionManager());
- ProvisioningAction[] actions = parser.parseActions(MetadataFactory.createTouchpointInstruction("goodAction()", "instructionparsertest.goodAction"), null);
- assertEquals(1, actions.length);
+ List<ProvisioningAction> actions = parser.parseActions(MetadataFactory.createTouchpointInstruction("goodAction()", "instructionparsertest.goodAction"), null);
+ assertEquals(1, actions.size());
}
public void testGoodActionFromImportWithVersionRange() {
InstructionParser parser = new InstructionParser(new ActionManager());
- ProvisioningAction[] actions = parser.parseActions(MetadataFactory.createTouchpointInstruction("goodAction()", "instructionparsertest.goodAction;version=[1.0,2.0)"), null);
- assertEquals(1, actions.length);
+ List<ProvisioningAction> actions = parser.parseActions(MetadataFactory.createTouchpointInstruction("goodAction()", "instructionparsertest.goodAction;version=[1.0,2.0)"), null);
+ assertEquals(1, actions.size());
}
public void testBadActionFromImport() {
InstructionParser parser = new InstructionParser(new ActionManager());
try {
- ProvisioningAction[] actions = parser.parseActions(MetadataFactory.createTouchpointInstruction("badAction()", "instructionparsertest.badAction"), null);
- actions[0].execute(null);
+ List<ProvisioningAction> actions = parser.parseActions(MetadataFactory.createTouchpointInstruction("badAction()", "instructionparsertest.badAction"), null);
+ actions.get(0).execute(null);
} catch (IllegalArgumentException e) {
return;
}
@@ -108,20 +109,20 @@ public class InstructionParserTest extends AbstractProvisioningTest {
public void testGoodActions() {
InstructionParser parser = new InstructionParser(new ActionManager());
- ProvisioningAction[] actions = parser.parseActions(MetadataFactory.createTouchpointInstruction("goodAction(); goodAction()", null), TOUCHPOINT_TYPE);
- assertEquals(2, actions.length);
+ List<ProvisioningAction> actions = parser.parseActions(MetadataFactory.createTouchpointInstruction("goodAction(); goodAction()", null), TOUCHPOINT_TYPE);
+ assertEquals(2, actions.size());
}
public void testGoodParameter() {
InstructionParser parser = new InstructionParser(new ActionManager());
- ProvisioningAction[] actions = parser.parseActions(MetadataFactory.createTouchpointInstruction("goodAction(a:1)", null), TOUCHPOINT_TYPE);
- assertEquals(1, actions.length);
+ List<ProvisioningAction> actions = parser.parseActions(MetadataFactory.createTouchpointInstruction("goodAction(a:1)", null), TOUCHPOINT_TYPE);
+ assertEquals(1, actions.size());
}
public void testGoodParameters() {
InstructionParser parser = new InstructionParser(new ActionManager());
- ProvisioningAction[] actions = parser.parseActions(MetadataFactory.createTouchpointInstruction("goodAction(a:1, b:2)", null), TOUCHPOINT_TYPE);
- assertEquals(1, actions.length);
+ List<ProvisioningAction> actions = parser.parseActions(MetadataFactory.createTouchpointInstruction("goodAction(a:1, b:2)", null), TOUCHPOINT_TYPE);
+ assertEquals(1, actions.size());
}
public void testBadParameter() {
@@ -157,8 +158,8 @@ public class InstructionParserTest extends AbstractProvisioningTest {
public void testGoodActionBadAction() {
InstructionParser parser = new InstructionParser(new ActionManager());
try {
- ProvisioningAction[] actions = parser.parseActions(MetadataFactory.createTouchpointInstruction("goodAction(); badAction()", null), TOUCHPOINT_TYPE);
- actions[1].execute(null);
+ List<ProvisioningAction> actions = parser.parseActions(MetadataFactory.createTouchpointInstruction("goodAction(); badAction()", null), TOUCHPOINT_TYPE);
+ actions.get(1).execute(null);
} catch (IllegalArgumentException e) {
return;
}
@@ -168,8 +169,8 @@ public class InstructionParserTest extends AbstractProvisioningTest {
public void testNoActionFound() {
InstructionParser parser = new InstructionParser(new ActionManager());
try {
- ProvisioningAction[] actions = parser.parseActions(MetadataFactory.createTouchpointInstruction("notfoundaction()", null), TOUCHPOINT_TYPE);
- actions[0].execute(null);
+ List<ProvisioningAction> actions = parser.parseActions(MetadataFactory.createTouchpointInstruction("notfoundaction()", null), TOUCHPOINT_TYPE);
+ actions.get(0).execute(null);
} catch (IllegalArgumentException e) {
return;
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/PhaseTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/PhaseTest.java
index f8c6c63d8..73edae2df 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/PhaseTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/PhaseTest.java
@@ -79,9 +79,9 @@ public class PhaseTest extends AbstractProvisioningTest {
return super.initializePhase(monitor, profile, parameters);
}
- protected ProvisioningAction[] getActions(InstallableUnitOperand operand) {
+ protected List<ProvisioningAction> getActions(InstallableUnitOperand operand) {
IInstallableUnit unit = operand.second();
- ProvisioningAction[] parsedActions = getActions(unit, phaseId);
+ List<ProvisioningAction> parsedActions = getActions(unit, phaseId);
if (parsedActions != null)
return parsedActions;
@@ -94,7 +94,7 @@ public class PhaseTest extends AbstractProvisioningTest {
if (action == null) {
throw new IllegalArgumentException("action not found: " + phaseId);
}
- return new ProvisioningAction[] {action};
+ return Collections.singletonList(action);
}
}
@@ -273,17 +273,17 @@ public class PhaseTest extends AbstractProvisioningTest {
public void testGetAction() {
final ArrayList actionsList1 = new ArrayList();
InstallableUnitPhase phase1 = new InstallableUnitPhase("test", 1) {
- protected ProvisioningAction[] getActions(InstallableUnitOperand operand) {
- ProvisioningAction[] actions = getActions(operand.second(), "test1");
- actionsList1.addAll(Arrays.asList(actions));
+ protected List<ProvisioningAction> getActions(InstallableUnitOperand operand) {
+ List<ProvisioningAction> actions = getActions(operand.second(), "test1");
+ actionsList1.addAll(actions);
return actions;
}
};
final ArrayList actionsList2 = new ArrayList();
InstallableUnitPhase phase2 = new InstallableUnitPhase("test", 1) {
- protected ProvisioningAction[] getActions(InstallableUnitOperand operand) {
- ProvisioningAction[] actions = getActions(operand.second(), "test2");
- actionsList2.addAll(Arrays.asList(actions));
+ protected List<ProvisioningAction> getActions(InstallableUnitOperand operand) {
+ List<ProvisioningAction> actions = getActions(operand.second(), "test2");
+ actionsList2.addAll(actions);
return actions;
}
};
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfileRegistryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfileRegistryTest.java
index 0a25e2844..404a3b3ec 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfileRegistryTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfileRegistryTest.java
@@ -13,7 +13,8 @@ package org.eclipse.equinox.p2.tests.engine;
import java.io.*;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import java.util.Properties;
+import java.util.HashMap;
+import java.util.Map;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.equinox.internal.p2.engine.*;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
@@ -112,7 +113,7 @@ public class ProfileRegistryTest extends AbstractProvisioningTest {
public void testPropertyPeristence() throws ProvisionException {
assertNull(registry.getProfile(PROFILE_NAME));
- Properties properties = new Properties();
+ Map<String, String> properties = new HashMap<String, String>();
properties.put("test", "test");
Profile profile = (Profile) registry.addProfile(PROFILE_NAME, properties);
assertTrue(profile.getProperties().containsKey("test"));
@@ -158,7 +159,7 @@ public class ProfileRegistryTest extends AbstractProvisioningTest {
}
public void testIUPropertyPeristence() throws ProvisionException {
- Properties properties = new Properties();
+ Map<String, String> properties = new HashMap<String, String>();
properties.put("test", "test");
assertNull(registry.getProfile(PROFILE_NAME));
Profile profile = (Profile) registry.addProfile(PROFILE_NAME);
@@ -191,7 +192,7 @@ public class ProfileRegistryTest extends AbstractProvisioningTest {
public void testTimestampedProfiles() throws ProvisionException {
assertNull(registry.getProfile(PROFILE_NAME));
- Properties properties = new Properties();
+ Map<String, String> properties = new HashMap<String, String>();
properties.put("test", "test");
Profile profile = (Profile) registry.addProfile(PROFILE_NAME, properties);
long oldtimestamp = profile.getTimestamp();
@@ -218,7 +219,7 @@ public class ProfileRegistryTest extends AbstractProvisioningTest {
public void testIsCurrent() throws Exception {
assertNull(registry.getProfile(PROFILE_NAME));
- Properties properties = new Properties();
+ Map<String, String> properties = new HashMap<String, String>();
properties.put("test", "test");
Profile profile = (Profile) registry.addProfile(PROFILE_NAME, properties);
@@ -661,7 +662,7 @@ public class ProfileRegistryTest extends AbstractProvisioningTest {
public void testRemoveProfileTimestamps() throws ProvisionException {
assertNull(registry.getProfile(PROFILE_NAME));
- Properties properties = new Properties();
+ Map<String, String> properties = new HashMap<String, String>();
properties.put("test", "test");
Profile profile = (Profile) registry.addProfile(PROFILE_NAME, properties);
assertTrue(profile.getProperties().containsKey("test"));
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfileTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfileTest.java
index 0921eed7a..42fe9e8a7 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfileTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfileTest.java
@@ -64,7 +64,7 @@ public class ProfileTest extends AbstractProvisioningTest {
public void testAddRemoveProperty() throws ProvisionException {
IProfileRegistry registry = getProfileRegistry();
assertNull(registry.getProfile(PROFILE_NAME));
- Properties properties = new Properties();
+ Map<String, String> properties = new HashMap<String, String>();
properties.put("test", "test");
Profile profile = (Profile) registry.addProfile(PROFILE_NAME, properties);
assertTrue(profile.getProperties().containsKey("test"));
@@ -113,7 +113,7 @@ public class ProfileTest extends AbstractProvisioningTest {
profile.addInstallableUnit(createIU("test"));
assertNull(profile.getInstallableUnitProperty(createIU("test"), "test"));
assertNull(profile.removeInstallableUnitProperty(createIU("test"), "test"));
- Properties iuProperties = new Properties();
+ Map<String, String> iuProperties = new HashMap<String, String>();
iuProperties.put("test", "test");
profile.addInstallableUnitProperties(createIU("test"), iuProperties);
assertEquals("test", profile.getInstallableUnitProperty(createIU("test"), "test"));
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/generator/PatchIUGeneration.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/generator/PatchIUGeneration.java
index 0c9b56433..83f722fc8 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/generator/PatchIUGeneration.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/generator/PatchIUGeneration.java
@@ -37,13 +37,13 @@ public class PatchIUGeneration extends AbstractProvisioningTest {
assertEquals("org.eclipse.jdt.feature.group", ((TestCase) patchIU.getApplicabilityScope()[0][0]).getName());
assertEquals(new VersionRange("[3.2.1.r321_v20060905-R4CM1Znkvre9wC-,3.2.1.r321_v20060905-R4CM1Znkvre9wC-]"), ((IRequiredCapability) patchIU.getApplicabilityScope()[0][0]).getRange());
- assertEquals("org.eclipse.jdt.core", patchIU.getRequirementsChange()[0].applyOn().getName());
- assertEquals(VersionRange.emptyRange, patchIU.getRequirementsChange()[0].applyOn().getRange());
- assertEquals("org.eclipse.jdt.core", patchIU.getRequirementsChange()[0].newValue().getName());
- assertEquals(new VersionRange("[3.2.2,3.2.2]"), patchIU.getRequirementsChange()[0].newValue().getRange());
+ assertEquals("org.eclipse.jdt.core", patchIU.getRequirementsChange().get(0).applyOn().getName());
+ assertEquals(VersionRange.emptyRange, patchIU.getRequirementsChange().get(0).applyOn().getRange());
+ assertEquals("org.eclipse.jdt.core", patchIU.getRequirementsChange().get(0).newValue().getName());
+ assertEquals(new VersionRange("[3.2.2,3.2.2]"), patchIU.getRequirementsChange().get(0).newValue().getRange());
assertTrue(PatchQuery.isPatch(patchIU));
- assertEquals(1, patchIU.getRequiredCapabilities().length);
- assertEquals(featureIU.getId(), ((IRequiredCapability) patchIU.getRequiredCapabilities()[0]).getName());
+ assertEquals(1, patchIU.getRequiredCapabilities().size());
+ assertEquals(featureIU.getId(), ((IRequiredCapability) patchIU.getRequiredCapabilities().get(0)).getName());
assertEquals("org.eclipse.jdt.feature.group", ((IRequiredCapability) patchIU.getLifeCycle()).getName());
assertFalse(patchIU.getLifeCycle().isGreedy());
assertFalse(patchIU.getLifeCycle().getMin() == 0);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/FragmentMethodTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/FragmentMethodTest.java
index 94738e73d..896e029b4 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/FragmentMethodTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/FragmentMethodTest.java
@@ -10,8 +10,7 @@
*******************************************************************************/
package org.eclipse.equinox.p2.tests.metadata;
-import java.util.HashSet;
-import java.util.Iterator;
+import java.util.*;
import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
import org.eclipse.equinox.internal.p2.metadata.IRequiredCapability;
@@ -27,8 +26,8 @@ public class FragmentMethodTest extends TestCase {
private static final String TEST_REQUIRED = "testRequired";
IInstallableUnit iu1;
IInstallableUnit iu3;
- IProvidedCapability[] iu1Caps;
- IProvidedCapability[] iu3Caps;
+ List<IProvidedCapability> iu1Caps;
+ List<IProvidedCapability> iu3Caps;
protected void setUp() throws Exception {
super.setUp();
@@ -58,21 +57,21 @@ public class FragmentMethodTest extends TestCase {
}
public void testCapabilities() {
- IProvidedCapability[] iuCapabilities = iu1Caps;
- IProvidedCapability[] initialFragmentCapabilities = iu3Caps;
+ List<IProvidedCapability> iuCapabilities = iu1Caps;
+ List<IProvidedCapability> initialFragmentCapabilities = iu3Caps;
- IProvidedCapability[] mergedCapabilities = iu1.getProvidedCapabilities();
- for (int i = 0; i < iuCapabilities.length; i++) {
- FragmentTest.assertContainsWithEquals(mergedCapabilities, iuCapabilities[i]);
+ List<IProvidedCapability> mergedCapabilities = iu1.getProvidedCapabilities();
+ for (int i = 0; i < iuCapabilities.size(); i++) {
+ FragmentTest.assertContainsWithEquals(mergedCapabilities, iuCapabilities.get(i));
}
//The fragment property is not set
assertNull(iu1.getProperty(InstallableUnitDescription.PROP_TYPE_FRAGMENT));
//The fragment does not contain iu namespace
- for (int i = 0; i < initialFragmentCapabilities.length; i++) {
- if (initialFragmentCapabilities[i].getNamespace().equals(IInstallableUnit.NAMESPACE_IU_ID)) {
- assertDoesNotContain(mergedCapabilities, initialFragmentCapabilities[i]);
+ for (int i = 0; i < initialFragmentCapabilities.size(); i++) {
+ if (initialFragmentCapabilities.get(i).getNamespace().equals(IInstallableUnit.NAMESPACE_IU_ID)) {
+ assertDoesNotContain(mergedCapabilities, initialFragmentCapabilities.get(i));
break;
}
}
@@ -91,7 +90,7 @@ public class FragmentMethodTest extends TestCase {
assertEquals(message, expected[i], actual[i]);
}
- protected void assertEquals(String message, Object[] expected, Object[] actual, boolean orderImportant) {
+ protected void assertEquals(String message, List<? extends Object> expected, List<? extends Object> actual, boolean orderImportant) {
// if the order in the array must match exactly, then call the other method
if (orderImportant) {
assertEquals(message, expected, actual);
@@ -104,12 +103,12 @@ public class FragmentMethodTest extends TestCase {
return;
if (expected == null || actual == null)
assertTrue(message + ".1", false);
- if (expected.length != actual.length)
+ if (expected.size() != actual.size())
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]))
+ boolean[] found = new boolean[expected.size()];
+ for (int i = 0; i < expected.size(); i++) {
+ for (int j = 0; j < expected.size(); j++) {
+ if (!found[j] && expected.get(i).equals(actual.get(j)))
found[j] = true;
}
}
@@ -118,9 +117,9 @@ public class FragmentMethodTest extends TestCase {
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))
+ public static void assertDoesNotContain(List<? extends Object> objects, Object searched) {
+ for (int i = 0; i < objects.size(); i++) {
+ if (objects.get(i).equals(searched))
throw new AssertionFailedError("The array should not contain the searched element");
}
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/FragmentTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/FragmentTest.java
index dc73e5877..57c66fbd6 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/FragmentTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/FragmentTest.java
@@ -10,8 +10,7 @@
*******************************************************************************/
package org.eclipse.equinox.p2.tests.metadata;
-import java.util.HashMap;
-import java.util.Iterator;
+import java.util.*;
import junit.framework.AssertionFailedError;
import org.eclipse.equinox.internal.provisional.p2.director.ProfileChangeRequest;
import org.eclipse.equinox.internal.provisional.p2.metadata.*;
@@ -37,8 +36,8 @@ public class FragmentTest extends AbstractProvisioningTest {
for (; iterator.hasNext();) {
IInstallableUnit iu = (IInstallableUnit) iterator.next();
if (iu.getId().equals(ID)) {
- assertEquals(iu.getFragments().length, 1);
- assertEquals(iu.getFragments()[0].getId(), "iuFragment.test1");
+ assertEquals(iu.getFragments().size(), 1);
+ assertEquals(iu.getFragments().get(0).getId(), "iuFragment.test1");
}
}
}
@@ -55,19 +54,19 @@ public class FragmentTest extends AbstractProvisioningTest {
for (; iterator.hasNext();) {
IInstallableUnit iu = (IInstallableUnit) iterator.next();
if (iu.getId().equals(ID1)) {
- assertEquals(iu.getFragments().length, 1);
- assertEquals(iu.getFragments()[0].getId(), "iuFragment.test1");
+ assertEquals(iu.getFragments().size(), 1);
+ assertEquals(iu.getFragments().get(0).getId(), "iuFragment.test1");
}
if (iu.getId().equals(ID3)) {
- assertEquals(iu.getFragments().length, 1);
- assertEquals(iu.getFragments()[0].getId(), "iuFragment.test1");
+ assertEquals(iu.getFragments().size(), 1);
+ assertEquals(iu.getFragments().get(0).getId(), "iuFragment.test1");
}
}
}
public void testTouchpointData() {
- assertEquals(createIUWithTouchpointData().getTouchpointData().length, 1);
- assertEquals(createBundleFragment("iuFragment.test1").getTouchpointData().length, 1);
+ assertEquals(createIUWithTouchpointData().getTouchpointData().size(), 1);
+ assertEquals(createBundleFragment("iuFragment.test1").getTouchpointData().size(), 1);
IInstallableUnit iu1 = createIUWithTouchpointData();
IInstallableUnit iu2 = createBundleFragment("iuFragment.test1");
ProfileChangeRequest req = new ProfileChangeRequest(createProfile(getName()));
@@ -76,7 +75,7 @@ public class FragmentTest extends AbstractProvisioningTest {
for (; iterator.hasNext();) {
IInstallableUnit iu = (IInstallableUnit) iterator.next();
if (iu.getId().equals(iu1.getId()))
- assertEquals(2, iu.getTouchpointData().length);
+ assertEquals(2, iu.getTouchpointData().size());
}
}
@@ -88,11 +87,12 @@ public class FragmentTest extends AbstractProvisioningTest {
public void testDefaultIUCapability() {
IInstallableUnit iu = createEclipseIU("ui.test1");
- IProvidedCapability[] cap = iu.getProvidedCapabilities();
- for (int i = 0; i < cap.length; i++) {
- if (cap[i].getNamespace().equals(IInstallableUnit.NAMESPACE_IU_ID)) {
- assertEquals(cap[i].getNamespace(), IInstallableUnit.NAMESPACE_IU_ID);
- assertEquals(cap[i].getName(), iu.getId());
+ List<IProvidedCapability> cap = iu.getProvidedCapabilities();
+ for (int i = 0; i < cap.size(); i++) {
+ IProvidedCapability c = cap.get(i);
+ if (c.getNamespace().equals(IInstallableUnit.NAMESPACE_IU_ID)) {
+ assertEquals(c.getNamespace(), IInstallableUnit.NAMESPACE_IU_ID);
+ assertEquals(c.getName(), iu.getId());
return;
}
}
@@ -107,9 +107,9 @@ public class FragmentTest extends AbstractProvisioningTest {
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))
+ public static void assertContainsWithEquals(List<? extends Object> objects, Object searched) {
+ for (int i = 0; i < objects.size(); i++) {
+ if (objects.get(i).equals(searched))
return;
}
throw new AssertionFailedError("The array does not contain the searched element");
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPatchPersistenceTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPatchPersistenceTest.java
index e41658d74..72c01e258 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPatchPersistenceTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPatchPersistenceTest.java
@@ -294,11 +294,11 @@ public class IUPatchPersistenceTest extends AbstractProvisioningTest {
validateIU(iu);
assertTrue(iu.getApplicabilityScope() != null);
assertTrue(iu.getRequiredCapabilities() != null);
- assertEquals(3, iu.getRequirementsChange().length);
- assertEquals(null, iu.getRequirementsChange()[1].applyOn());
- assertNotNull(iu.getRequirementsChange()[1].newValue());
- assertEquals(null, iu.getRequirementsChange()[2].newValue());
- assertNotNull(iu.getRequirementsChange()[2].applyOn());
+ assertEquals(3, iu.getRequirementsChange().size());
+ assertEquals(null, iu.getRequirementsChange().get(1).applyOn());
+ assertNotNull(iu.getRequirementsChange().get(1).newValue());
+ assertEquals(null, iu.getRequirementsChange().get(2).newValue());
+ assertNotNull(iu.getRequirementsChange().get(2).applyOn());
assertEquals(2, iu.getApplicabilityScope().length);
assertEquals(2, iu.getApplicabilityScope()[0].length);
assertEquals(1, iu.getApplicabilityScope()[1].length);
@@ -344,30 +344,30 @@ public class IUPatchPersistenceTest extends AbstractProvisioningTest {
}
private static String[][] extractProvides(IInstallableUnit iu) {
- IProvidedCapability[] provydes = iu.getProvidedCapabilities();
- String[][] tuples = new String[provydes.length][3];
- for (int i = 0; i < provydes.length; i++) {
- IProvidedCapability next = provydes[i];
+ List<IProvidedCapability> provydes = iu.getProvidedCapabilities();
+ String[][] tuples = new String[provydes.size()][3];
+ for (int i = 0; i < provydes.size(); i++) {
+ IProvidedCapability next = provydes.get(i);
tuples[i] = new String[] {next.getNamespace(), next.getName(), next.getVersion().toString()};
}
return tuples;
}
private static String[][] extractRequires(IInstallableUnit iu) {
- IRequirement[] requyres = iu.getRequiredCapabilities();
- String[][] tuples = new String[requyres.length][4];
- for (int i = 0; i < requyres.length; i++) {
- IRequiredCapability next = (IRequiredCapability) requyres[i];
+ List<IRequirement> requyres = iu.getRequiredCapabilities();
+ String[][] tuples = new String[requyres.size()][4];
+ for (int i = 0; i < requyres.size(); i++) {
+ IRequiredCapability next = (IRequiredCapability) requyres.get(i);
tuples[i] = new String[] {next.getNamespace(), next.getName(), next.getRange().toString(), Boolean.valueOf(next.getMin() == 0).toString()};
}
return tuples;
}
private static String[][] extractMetaRequires(IInstallableUnit iu) {
- IRequirement[] requyres = iu.getMetaRequiredCapabilities();
- String[][] tuples = new String[requyres.length][4];
- for (int i = 0; i < requyres.length; i++) {
- IRequiredCapability next = (IRequiredCapability) requyres[i];
+ List<IRequirement> requyres = iu.getMetaRequiredCapabilities();
+ String[][] tuples = new String[requyres.size()][4];
+ for (int i = 0; i < requyres.size(); i++) {
+ IRequiredCapability next = (IRequiredCapability) requyres.get(i);
tuples[i] = new String[] {next.getNamespace(), next.getName(), next.getRange().toString(), Boolean.valueOf(next.getMin() == 0).toString()};
}
return tuples;
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPersistenceTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPersistenceTest.java
index 70317144f..b813171c4 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPersistenceTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPersistenceTest.java
@@ -232,30 +232,30 @@ public class IUPersistenceTest extends AbstractProvisioningTest {
}
private static String[][] extractProvides(IInstallableUnit iu) {
- IProvidedCapability[] provydes = iu.getProvidedCapabilities();
- String[][] tuples = new String[provydes.length][3];
- for (int i = 0; i < provydes.length; i++) {
- IProvidedCapability next = provydes[i];
+ List<IProvidedCapability> provydes = iu.getProvidedCapabilities();
+ String[][] tuples = new String[provydes.size()][3];
+ for (int i = 0; i < provydes.size(); i++) {
+ IProvidedCapability next = provydes.get(i);
tuples[i] = new String[] {next.getNamespace(), next.getName(), next.getVersion().toString()};
}
return tuples;
}
private static String[][] extractRequires(IInstallableUnit iu) {
- IRequirement[] requyres = iu.getRequiredCapabilities();
- String[][] tuples = new String[requyres.length][4];
- for (int i = 0; i < requyres.length; i++) {
- IRequiredCapability next = (IRequiredCapability) requyres[i];
+ List<IRequirement> requyres = iu.getRequiredCapabilities();
+ String[][] tuples = new String[requyres.size()][4];
+ for (int i = 0; i < requyres.size(); i++) {
+ IRequiredCapability next = (IRequiredCapability) requyres.get(i);
tuples[i] = new String[] {next.getNamespace(), next.getName(), next.getRange().toString(), Boolean.valueOf(next.getMin() == 0).toString()};
}
return tuples;
}
private static String[][] extractMetaRequires(IInstallableUnit iu) {
- IRequirement[] requyres = iu.getMetaRequiredCapabilities();
- String[][] tuples = new String[requyres.length][4];
- for (int i = 0; i < requyres.length; i++) {
- IRequiredCapability next = (IRequiredCapability) requyres[i];
+ List<IRequirement> requyres = iu.getMetaRequiredCapabilities();
+ String[][] tuples = new String[requyres.size()][4];
+ for (int i = 0; i < requyres.size(); i++) {
+ IRequiredCapability next = (IRequiredCapability) requyres.get(i);
tuples[i] = new String[] {next.getNamespace(), next.getName(), next.getRange().toString(), Boolean.valueOf(next.getMin() == 0).toString()};
}
return tuples;
@@ -395,7 +395,7 @@ public class IUPersistenceTest extends AbstractProvisioningTest {
assertTrue("Error parsing test iu: " + parser.getStatus().getMessage(), parser.getStatus().isOK());
InstallableUnit iu1 = (InstallableUnit) parser.getRootObject();
validateIU(iu1);
- assertEquals(2, iu1.getLicenses().length);
+ assertEquals(2, iu1.getLicenses().size());
ByteArrayOutputStream output1 = new ByteArrayOutputStream(1492);
IUStringWriter writer = new IUStringWriter(output1);
writer.writeTest(iu1);
@@ -422,11 +422,11 @@ public class IUPersistenceTest extends AbstractProvisioningTest {
validateIU(iu);
assertTrue(iu.getApplicabilityScope() != null);
assertTrue(iu.getRequiredCapabilities() != null);
- assertEquals(3, iu.getRequirementsChange().length);
- assertEquals(null, iu.getRequirementsChange()[1].applyOn());
- assertNotNull(iu.getRequirementsChange()[1].newValue());
- assertEquals(null, iu.getRequirementsChange()[2].newValue());
- assertNotNull(iu.getRequirementsChange()[2].applyOn());
+ assertEquals(3, iu.getRequirementsChange().size());
+ assertEquals(null, iu.getRequirementsChange().get(1).applyOn());
+ assertNotNull(iu.getRequirementsChange().get(1).newValue());
+ assertEquals(null, iu.getRequirementsChange().get(2).newValue());
+ assertNotNull(iu.getRequirementsChange().get(2).applyOn());
assertEquals(2, iu.getApplicabilityScope().length);
assertEquals(2, iu.getApplicabilityScope()[0].length);
assertEquals(1, iu.getApplicabilityScope()[1].length);
@@ -437,11 +437,11 @@ public class IUPersistenceTest extends AbstractProvisioningTest {
validateIU(iu);
assertTrue(iu.getApplicabilityScope() != null);
assertTrue(iu.getRequiredCapabilities() != null);
- assertEquals(3, iu.getRequirementsChange().length);
- assertEquals(null, iu.getRequirementsChange()[1].applyOn());
- assertNotNull(iu.getRequirementsChange()[1].newValue());
- assertEquals(null, iu.getRequirementsChange()[2].newValue());
- assertNotNull(iu.getRequirementsChange()[2].applyOn());
+ assertEquals(3, iu.getRequirementsChange().size());
+ assertEquals(null, iu.getRequirementsChange().get(1).applyOn());
+ assertNotNull(iu.getRequirementsChange().get(1).newValue());
+ assertEquals(null, iu.getRequirementsChange().get(2).newValue());
+ assertNotNull(iu.getRequirementsChange().get(2).applyOn());
assertEquals(0, iu.getApplicabilityScope().length);
assertNull(iu.getLifeCycle());
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/MultipleIUAndFragmentTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/MultipleIUAndFragmentTest.java
index 0b6a2143e..2d87d428c 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/MultipleIUAndFragmentTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/MultipleIUAndFragmentTest.java
@@ -44,12 +44,12 @@ public class MultipleIUAndFragmentTest extends AbstractProvisioningTest {
for (; iterator.hasNext();) {
IInstallableUnit iu = (IInstallableUnit) iterator.next();
if (iu.getId().equals(iu1.getId())) {
- assertEquals(1, iu.getFragments().length);
- assertEquals(iu.getFragments()[0].getId(), iu3.getId());
+ assertEquals(1, iu.getFragments().size());
+ assertEquals(iu.getFragments().get(0).getId(), iu3.getId());
}
if (iu.getId().equals(iu2.getId())) {
- assertEquals(1, iu.getFragments().length);
- assertEquals(iu.getFragments()[0].getId(), iu3.getId());
+ assertEquals(1, iu.getFragments().size());
+ assertEquals(iu.getFragments().get(0).getId(), iu3.getId());
}
if (iu.getId().equals(iu3.getId())) {
//fragments don't have fragments
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/CompositeMetadataRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/CompositeMetadataRepositoryTest.java
index 4c1d3ea69..a7828d810 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/CompositeMetadataRepositoryTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/CompositeMetadataRepositoryTest.java
@@ -26,7 +26,6 @@ import org.eclipse.equinox.internal.provisional.p2.metadata.Version;
import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory.InstallableUnitDescription;
import org.eclipse.equinox.internal.provisional.p2.metadata.query.*;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.p2.metadata.query.IQuery;
import org.eclipse.equinox.p2.metadata.query.IQueryResult;
import org.eclipse.equinox.p2.repository.IRepository;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
@@ -479,7 +478,7 @@ public class CompositeMetadataRepositoryTest extends AbstractProvisioningTest {
CompositeMetadataRepository compositeRepo = createRepo(false);
compositeRepo.addChild(location1);
compositeRepo.addChild(location2);
- PipedQuery cQuery = new PipedQuery(new IQuery[] {new MatchQuery() {
+ PipedQuery cQuery = new PipedQuery(new MatchQuery() {
public boolean isMatch(Object candidate) {
if (candidate instanceof IInstallableUnit) {
IInstallableUnit iInstallableUnit = (IInstallableUnit) candidate;
@@ -488,7 +487,7 @@ public class CompositeMetadataRepositoryTest extends AbstractProvisioningTest {
}
return false;
}
- }, new LatestIUVersionQuery()});
+ }, new LatestIUVersionQuery());
IQueryResult queryResult = compositeRepo.query(cQuery, monitor);
assertEquals("1.0", 1, queryResultSize(queryResult));
assertEquals("1.1", Version.createOSGi(2, 2, 0), ((IInstallableUnit) queryResult.iterator().next()).getVersion());
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java
index a46c8ae6f..85ba4f61b 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java
@@ -18,6 +18,7 @@ import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.*;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils;
import org.eclipse.equinox.internal.p2.metadata.*;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
import org.eclipse.equinox.internal.provisional.p2.metadata.*;
@@ -52,7 +53,7 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest {
super.tearDown();
}
- class SPIRequiredCapability extends MatchQuery implements IRequiredCapability {
+ class SPIRequiredCapability extends MatchQuery<IInstallableUnit> implements IRequiredCapability {
LDAPQuery filter;
String name;
String namespace;
@@ -153,11 +154,8 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest {
return this;
}
- public boolean isMatch(Object object) {
- if (!(object instanceof IInstallableUnit))
- return false;
- IInstallableUnit candidate = (IInstallableUnit) object;
- if (!candidate.satisfies((IRequirement) this))
+ public boolean isMatch(IInstallableUnit candidate) {
+ if (!candidate.satisfies(this))
return false;
return true;
}
@@ -234,8 +232,8 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest {
this.providedCapabilities.add(providedCapability);
}
- public IArtifactKey[] getArtifacts() {
- return (IArtifactKey[]) this.artifacts.toArray(new IArtifactKey[artifacts.size()]);
+ public List<IArtifactKey> getArtifacts() {
+ return artifacts;
}
public ICopyright getCopyright() {
@@ -246,16 +244,16 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest {
return this.filter;
}
- public IInstallableUnitFragment[] getFragments() {
- return (IInstallableUnitFragment[]) this.fragments.toArray(new IInstallableUnitFragment[fragments.size()]);
+ public List<IInstallableUnitFragment> getFragments() {
+ return fragments;
}
public String getId() {
return this.id;
}
- public ILicense[] getLicenses() {
- return this.license;
+ public List<ILicense> getLicenses() {
+ return CollectionUtils.unmodifiableList(license);
}
public Map getProperties() {
@@ -266,16 +264,16 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest {
return (String) this.properties.get(key);
}
- public IProvidedCapability[] getProvidedCapabilities() {
- return (IProvidedCapability[]) this.providedCapabilities.toArray(new IProvidedCapability[profilesToRemove.size()]);
+ public List<IProvidedCapability> getProvidedCapabilities() {
+ return providedCapabilities;
}
- public IRequiredCapability[] getRequiredCapabilities() {
- return (IRequiredCapability[]) this.requiredCapabilities.toArray(new IRequiredCapability[requiredCapabilities.size()]);
+ public List<IRequirement> getRequiredCapabilities() {
+ return requiredCapabilities;
}
- public ITouchpointData[] getTouchpointData() {
- return (ITouchpointData[]) this.touchpointData.toArray(new ITouchpointData[touchpointData.size()]);
+ public List<ITouchpointData> getTouchpointData() {
+ return touchpointData;
}
public ITouchpointType getTouchpointType() {
@@ -305,9 +303,9 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest {
}
public boolean satisfies(IRequirement candidate) {
- IProvidedCapability[] provides = getProvidedCapabilities();
- for (int i = 0; i < provides.length; i++)
- if (provides[i].satisfies(candidate))
+ List<IProvidedCapability> provides = getProvidedCapabilities();
+ for (int i = 0; i < provides.size(); i++)
+ if (provides.get(i).satisfies(candidate))
return true;
return false;
}
@@ -316,17 +314,13 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest {
return this;
}
- public int compareTo(Object toCompareTo) {
- if (!(toCompareTo instanceof IInstallableUnit)) {
- return -1;
- }
- IInstallableUnit other = (IInstallableUnit) toCompareTo;
+ public int compareTo(IInstallableUnit other) {
if (getId().compareTo(other.getId()) == 0)
return (getVersion().compareTo(other.getVersion()));
return getId().compareTo(other.getId());
}
- public IRequiredCapability[] getMetaRequiredCapabilities() {
+ public List<IRequirement> getMetaRequiredCapabilities() {
return null;
}
@@ -686,8 +680,8 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest {
IInstallableUnit spiUnit = (IInstallableUnit) queryResult.iterator().next();
assertTrue("Repo contains SPI IU)", spiUnit instanceof SPIInstallableUnit);
- assertEquals(spiUnit.getProvidedCapabilities().length, 1);
- assertTrue(spiUnit.getProvidedCapabilities()[0] instanceof ProvidedCapability);
+ assertEquals(spiUnit.getProvidedCapabilities().size(), 1);
+ assertTrue(spiUnit.getProvidedCapabilities().get(0) instanceof ProvidedCapability);
repo = manager.refreshRepository(repoLocation.toURI(), null);
queryResult = repo.query(new AllAcceptingQuery(), new NullProgressMonitor());
@@ -696,8 +690,8 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest {
IInstallableUnit defaultUnit = (IInstallableUnit) queryResult.iterator().next();
assertTrue("Repo contains SPI IU)", defaultUnit instanceof InstallableUnit);
- assertEquals(spiUnit.getProvidedCapabilities().length, 1);
- assertTrue(spiUnit.getProvidedCapabilities()[0] instanceof ProvidedCapability);
+ assertEquals(spiUnit.getProvidedCapabilities().size(), 1);
+ assertTrue(spiUnit.getProvidedCapabilities().get(0) instanceof ProvidedCapability);
}
/**
@@ -728,8 +722,8 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest {
assertEquals(1, queryResultSize(queryResult));
IInstallableUnit unit = (IInstallableUnit) queryResult.iterator().next();
- assertEquals(unit.getRequiredCapabilities().length, 1);
- assertTrue(unit.getRequiredCapabilities()[0] instanceof SPIRequiredCapability);
+ assertEquals(unit.getRequiredCapabilities().size(), 1);
+ assertTrue(unit.getRequiredCapabilities().get(0) instanceof SPIRequiredCapability);
repo = manager.refreshRepository(repoLocation.toURI(), null);
queryResult = repo.query(new AllAcceptingQuery(), new NullProgressMonitor());
@@ -737,9 +731,9 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest {
assertEquals(1, queryResultSize(queryResult));
unit = (IInstallableUnit) queryResult.iterator().next();
- assertEquals(unit.getRequiredCapabilities().length, 1);
- assertTrue(unit.getRequiredCapabilities()[0] instanceof RequiredCapability);
- assertTrue(((IRequiredCapability) unit.getRequiredCapabilities()[0]).getName().equals("bar"));
+ assertEquals(unit.getRequiredCapabilities().size(), 1);
+ assertTrue(unit.getRequiredCapabilities().get(0) instanceof RequiredCapability);
+ assertTrue(((IRequiredCapability) unit.getRequiredCapabilities().get(0)).getName().equals("bar"));
}
/**
@@ -807,32 +801,32 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest {
assertFalse(unit == null);
assertFalse(patchUnit == null);
- assertEquals(unit.getRequiredCapabilities().length, 1);
- assertEquals(unit.getProvidedCapabilities().length, 1);
- assertEquals(unit.getTouchpointData().length, 1);
- assertEquals(((IRequiredCapability) unit.getRequiredCapabilities()[0]).getNamespace(), spiRequiredCapability.getNamespace());
- assertEquals(((IRequiredCapability) unit.getRequiredCapabilities()[0]).getName(), spiRequiredCapability.getName());
- assertEquals(((IRequiredCapability) unit.getRequiredCapabilities()[0]).getMin(), spiRequiredCapability.getMin());
- assertEquals(((IRequiredCapability) unit.getRequiredCapabilities()[0]).getMax(), spiRequiredCapability.getMax());
- assertEquals(unit.getProvidedCapabilities()[0], spiProvidedCapability);
- assertEquals(unit.getTouchpointData()[0], spiTouchpointData);
+ assertEquals(unit.getRequiredCapabilities().size(), 1);
+ assertEquals(unit.getProvidedCapabilities().size(), 1);
+ assertEquals(unit.getTouchpointData().size(), 1);
+ assertEquals(((IRequiredCapability) unit.getRequiredCapabilities().get(0)).getNamespace(), spiRequiredCapability.getNamespace());
+ assertEquals(((IRequiredCapability) unit.getRequiredCapabilities().get(0)).getName(), spiRequiredCapability.getName());
+ assertEquals(((IRequiredCapability) unit.getRequiredCapabilities().get(0)).getMin(), spiRequiredCapability.getMin());
+ assertEquals(((IRequiredCapability) unit.getRequiredCapabilities().get(0)).getMax(), spiRequiredCapability.getMax());
+ assertEquals(unit.getProvidedCapabilities().get(0), spiProvidedCapability);
+ assertEquals(unit.getTouchpointData().get(0), spiTouchpointData);
assertEquals(unit.getTouchpointType(), spiTouchpointType);
- assertEquals(unit.getLicenses()[0], spiLicense);
- assertEquals(spiProvidedCapability, unit.getProvidedCapabilities()[0]);
- assertEquals(spiTouchpointData, unit.getTouchpointData()[0]);
+ assertEquals(unit.getLicenses().get(0), spiLicense);
+ assertEquals(spiProvidedCapability, unit.getProvidedCapabilities().get(0));
+ assertEquals(spiTouchpointData, unit.getTouchpointData().get(0));
assertEquals(spiTouchpointType, unit.getTouchpointType());
- assertEquals(spiLicense, unit.getLicenses()[0]);
+ assertEquals(spiLicense, unit.getLicenses().get(0));
- assertEquals(patchUnit.getRequirementsChange().length, 1);
- assertEquals(patchUnit.getRequirementsChange()[0], spiRequirementChange);
- assertEquals(spiRequirementChange, patchUnit.getRequirementsChange()[0]);
+ assertEquals(patchUnit.getRequirementsChange().size(), 1);
+ assertEquals(patchUnit.getRequirementsChange().get(0), spiRequirementChange);
+ assertEquals(spiRequirementChange, patchUnit.getRequirementsChange().get(0));
// Check to make sure the actual objects are not equal. This is because the repo has
// been refreshed, and re-parsed, thus using the default implementations.
- assertFalse(spiTouchpointData == unit.getTouchpointData()[0]);
- assertFalse(spiRequiredCapability == unit.getRequiredCapabilities()[0]);
- assertFalse(spiProvidedCapability == unit.getProvidedCapabilities()[0]);
+ assertFalse(spiTouchpointData == unit.getTouchpointData().get(0));
+ assertFalse(spiRequiredCapability == unit.getRequiredCapabilities().get(0));
+ assertFalse(spiProvidedCapability == unit.getProvidedCapabilities().get(0));
assertFalse(spiTouchpointType == unit.getTouchpointType());
- assertFalse(spiLicense == unit.getLicenses()[0]);
+ assertFalse(spiLicense == unit.getLicenses().get(0));
}
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/ArtifactMirrorApplicationTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/ArtifactMirrorApplicationTest.java
index a6c8d88d5..19ca6d3d1 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/ArtifactMirrorApplicationTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/ArtifactMirrorApplicationTest.java
@@ -1349,8 +1349,8 @@ public class ArtifactMirrorApplicationTest extends AbstractProvisioningTest {
try {
//Mirroring full duplicate, so any key will do.
- IQueryResult descriptors = sourceRepository.query(ArtifactDescriptorQuery.ALL_DESCRIPTORS, null);
- IArtifactDescriptor descriptor = (IArtifactDescriptor) descriptors.iterator().next();
+ IQueryResult<IArtifactDescriptor> descriptors = sourceRepository.descriptorQueryable().query(ArtifactDescriptorQuery.ALL_DESCRIPTORS, null);
+ IArtifactDescriptor descriptor = descriptors.iterator().next();
//Mirroring full duplicate, so any descriptor will do.
String message = NLS.bind(org.eclipse.equinox.internal.p2.artifact.repository.Messages.mirror_alreadyExists, descriptor, destRepoLocation.toURI());
assertLogDoesNotContainLine(log.getFile(), message);
@@ -1421,8 +1421,8 @@ public class ArtifactMirrorApplicationTest extends AbstractProvisioningTest {
try {
//Mirroring full duplicate, so any key will do.
- IQueryResult descriptors = sourceRepository.query(ArtifactDescriptorQuery.ALL_DESCRIPTORS, null);
- IArtifactDescriptor descriptor = (IArtifactDescriptor) descriptors.iterator().next();
+ IQueryResult<IArtifactDescriptor> descriptors = sourceRepository.descriptorQueryable().query(ArtifactDescriptorQuery.ALL_DESCRIPTORS, null);
+ IArtifactDescriptor descriptor = descriptors.iterator().next();
//Mirroring full duplicate, so any descriptor will do.
String message = NLS.bind(org.eclipse.equinox.internal.p2.artifact.repository.Messages.mirror_alreadyExists, descriptor, destRepoLocation.toURI());
assertLogContainsLine(log.getFile(), message);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/NewMirrorApplicationArtifactTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/NewMirrorApplicationArtifactTest.java
index ebabef00a..e4bb28c01 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/NewMirrorApplicationArtifactTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/NewMirrorApplicationArtifactTest.java
@@ -1390,8 +1390,8 @@ public class NewMirrorApplicationArtifactTest extends AbstractProvisioningTest {
try {
//Mirroring full duplicate, so any key will do.
- IQueryResult descriptors = sourceRepository.query(ArtifactDescriptorQuery.ALL_DESCRIPTORS, null);
- IArtifactDescriptor descriptor = (IArtifactDescriptor) descriptors.iterator().next();
+ IQueryResult<IArtifactDescriptor> descriptors = sourceRepository.descriptorQueryable().query(ArtifactDescriptorQuery.ALL_DESCRIPTORS, null);
+ IArtifactDescriptor descriptor = descriptors.iterator().next();
//Mirroring full duplicate, so any descriptor will do.
String message = NLS.bind(org.eclipse.equinox.internal.p2.artifact.repository.Messages.mirror_alreadyExists, descriptor, destRepoLocation.toURI());
assertLogDoesNotContainLine(log.getFile(), message);
@@ -1468,8 +1468,8 @@ public class NewMirrorApplicationArtifactTest extends AbstractProvisioningTest {
try {
//Mirroring full duplicate, so any key will do.
- IQueryResult descriptors = sourceRepository.query(ArtifactDescriptorQuery.ALL_DESCRIPTORS, null);
- IArtifactDescriptor descriptor = (IArtifactDescriptor) descriptors.iterator().next();
+ IQueryResult<IArtifactDescriptor> descriptors = sourceRepository.descriptorQueryable().query(ArtifactDescriptorQuery.ALL_DESCRIPTORS, null);
+ IArtifactDescriptor descriptor = descriptors.iterator().next();
//Mirroring full duplicate, so any descriptor will do.
String message = NLS.bind(org.eclipse.equinox.internal.p2.artifact.repository.Messages.mirror_alreadyExists, descriptor, destRepoLocation.toURI());
assertLogContainsLine(log.getFile(), message);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AdditionalConstraints.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AdditionalConstraints.java
index 1aad0daa7..5a9dc08ba 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AdditionalConstraints.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AdditionalConstraints.java
@@ -18,6 +18,7 @@ import org.eclipse.equinox.internal.provisional.p2.metadata.Version;
import org.eclipse.equinox.internal.provisional.p2.metadata.VersionRange;
import org.eclipse.equinox.p2.engine.*;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.metadata.IRequirement;
import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
public class AdditionalConstraints extends AbstractProvisioningTest {
@@ -53,7 +54,7 @@ public class AdditionalConstraints extends AbstractProvisioningTest {
ProfileChangeRequest req = new ProfileChangeRequest(profile);
req.addInstallableUnits(new IInstallableUnit[] {a1});
ProvisioningContext ctx = new ProvisioningContext();
- ctx.setAdditionalRequirements(Arrays.asList(createRequiredCapabilities(IInstallableUnit.NAMESPACE_IU_ID, "B", new VersionRange("[2.0.0, 2.0.0]"), null)[0]));
+ ctx.setAdditionalRequirements(Arrays.<IRequirement> asList(createRequiredCapabilities(IInstallableUnit.NAMESPACE_IU_ID, "B", new VersionRange("[2.0.0, 2.0.0]"), null)[0]));
IProvisioningPlan plan = planner.getProvisioningPlan(req, ctx, null);
assertEquals(IStatus.OK, plan.getStatus().getSeverity());
assertInstallOperand(plan, a1);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/NonMinimalState.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/NonMinimalState.java
index 890cee9d7..a5820c997 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/NonMinimalState.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/NonMinimalState.java
@@ -87,11 +87,11 @@ public class NonMinimalState extends AbstractProvisioningTest {
visited.add(iu);
return false;
}
- IRequirement[] caps = iu.getRequiredCapabilities();
- for (int i = 0; i < caps.length; i++) {
- boolean result = expandRequirement(iu, caps[i]);
+ List<IRequirement> caps = iu.getRequiredCapabilities();
+ for (int i = 0; i < caps.size(); i++) {
+ boolean result = expandRequirement(iu, caps.get(i));
if (result) {
- System.out.println(iu + " because " + caps[i].toString());
+ System.out.println(iu + " because " + caps.get(i).toString());
return true;
}
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/TestArtifactRepository.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/TestArtifactRepository.java
index 57515096f..d8217122d 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/TestArtifactRepository.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/TestArtifactRepository.java
@@ -20,6 +20,7 @@ import org.eclipse.equinox.internal.p2.core.helpers.OrderedProperties;
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.ProcessingStepHandler;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
import org.eclipse.equinox.internal.provisional.p2.metadata.query.Collector;
+import org.eclipse.equinox.internal.provisional.p2.metadata.query.IQueryable;
import org.eclipse.equinox.internal.provisional.p2.repository.IStateful;
import org.eclipse.equinox.p2.metadata.IArtifactKey;
import org.eclipse.equinox.p2.metadata.query.IQuery;
@@ -29,14 +30,13 @@ import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor;
import org.eclipse.equinox.p2.tests.TestActivator;
import org.eclipse.osgi.util.NLS;
-@SuppressWarnings({"restriction", "unchecked"})
public class TestArtifactRepository implements IArtifactRepository {
private static String provider = null;
- private HashMap/*<IArtifactDescriptor, byte[]>*/repo;
+ private HashMap<IArtifactDescriptor, byte[]> repo;
private String name;
private String description;
private String version = "1.0.0"; //$NON-NLS-1$
- protected Map properties = new OrderedProperties();
+ protected Map<String, String> properties = new OrderedProperties();
public class ArtifactOutputStream extends OutputStream implements IStateful {
private boolean closed;
@@ -141,8 +141,8 @@ public class TestArtifactRepository implements IArtifactRepository {
}
public synchronized boolean contains(IArtifactKey key) {
- for (Iterator/*<IArtifactDescriptor>*/iterator = repo.keySet().iterator(); iterator.hasNext();) {
- IArtifactDescriptor descriptor = (IArtifactDescriptor) iterator.next();
+ for (Iterator<IArtifactDescriptor> iterator = repo.keySet().iterator(); iterator.hasNext();) {
+ IArtifactDescriptor descriptor = iterator.next();
if (descriptor.getArtifactKey().equals(key))
return true;
}
@@ -151,7 +151,7 @@ public class TestArtifactRepository implements IArtifactRepository {
public IStatus getArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) {
try {
- byte[] repoContents = (byte[]) repo.get(descriptor);
+ byte[] repoContents = repo.get(descriptor);
if (repoContents == null)
return null;
destination.write(repoContents);
@@ -163,13 +163,13 @@ public class TestArtifactRepository implements IArtifactRepository {
}
public IArtifactDescriptor[] getArtifactDescriptors(IArtifactKey key) {
- Set/*<IArtifactDescriptor>*/result = new HashSet/*<IArtifactDescriptor>*/();
- for (Iterator/*<IArtifactDescriptor>*/iterator = repo.keySet().iterator(); iterator.hasNext();) {
- IArtifactDescriptor descriptor = (IArtifactDescriptor) iterator.next();
+ Set<IArtifactDescriptor> result = new HashSet<IArtifactDescriptor>();
+ for (Iterator<IArtifactDescriptor> iterator = repo.keySet().iterator(); iterator.hasNext();) {
+ IArtifactDescriptor descriptor = iterator.next();
if (descriptor.getArtifactKey().equals(key))
result.add(descriptor);
}
- return (IArtifactDescriptor[]) result.toArray(new IArtifactDescriptor[0]);
+ return result.toArray(new IArtifactDescriptor[0]);
}
public IStatus getArtifacts(IArtifactRequest[] requests, IProgressMonitor monitor) {
@@ -249,7 +249,7 @@ public class TestArtifactRepository implements IArtifactRepository {
}
public String setProperty(String key, String value) {
- return (String) (value == null ? properties.remove(key) : properties.put(key, value));
+ return (value == null ? properties.remove(key) : properties.put(key, value));
}
public void setProvider(String value) {
@@ -273,7 +273,7 @@ public class TestArtifactRepository implements IArtifactRepository {
}
public InputStream getRawInputStream(IArtifactDescriptor descriptor) {
- return new ByteArrayInputStream((byte[]) repo.get(descriptor), 0, ((byte[]) repo.get(descriptor)).length);
+ return new ByteArrayInputStream(repo.get(descriptor), 0, repo.get(descriptor).length);
}
public ZipInputStream getZipInputStream(IArtifactDescriptor descriptor) {
@@ -281,7 +281,7 @@ public class TestArtifactRepository implements IArtifactRepository {
}
public byte[] getBytes(IArtifactDescriptor artifactDescriptor) {
- return (byte[]) repo.get(artifactDescriptor);
+ return repo.get(artifactDescriptor);
}
public IStatus getRawArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) {
@@ -292,23 +292,25 @@ public class TestArtifactRepository implements IArtifactRepository {
return new ArtifactDescriptor(key);
}
- public IQueryResult query(IQuery query, IProgressMonitor monitor) {
- Collector collector = new Collector();
+ public IQueryResult<IArtifactKey> query(IQuery<IArtifactKey> query, IProgressMonitor monitor) {
if (monitor != null && monitor.isCanceled())
- return collector;
-
- boolean excludeKeys = Boolean.TRUE.equals(query.getProperty(IArtifactRepository.QUERY_EXCLUDE_KEYS));
- boolean excludeDescriptors = Boolean.TRUE.equals(query.getProperty(IArtifactRepository.QUERY_EXCLUDE_DESCRIPTORS));
- if (!excludeKeys) {
- Set/*<IArtifactKey>*/result = new HashSet/*<IArtifactKey>*/();
- for (Iterator/*<IArtifactDescriptor>*/iterator = repo.keySet().iterator(); iterator.hasNext();) {
- IArtifactDescriptor descriptor = (IArtifactDescriptor) iterator.next();
- result.add(descriptor.getArtifactKey());
- }
- collector.addAll(query.perform(result.iterator()));
+ return Collector.emptyCollector();
+
+ Collector<IArtifactKey> collector = new Collector<IArtifactKey>();
+ for (Iterator<IArtifactDescriptor> iterator = repo.keySet().iterator(); iterator.hasNext();) {
+ IArtifactDescriptor descriptor = iterator.next();
+ collector.accept(descriptor.getArtifactKey());
}
- if (!excludeDescriptors)
- collector.addAll(query.perform(repo.keySet().iterator()));
return collector;
}
+
+ public IQueryable<IArtifactDescriptor> descriptorQueryable() {
+ final Collection<IArtifactDescriptor> descs = repo.keySet();
+ return new IQueryable<IArtifactDescriptor>() {
+
+ public IQueryResult<IArtifactDescriptor> query(IQuery<IArtifactDescriptor> query, IProgressMonitor monitor) {
+ return query.perform(descs.iterator());
+ }
+ };
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AbstractPublisherActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AbstractPublisherActionTest.java
index 0a290e086..59e8c6f65 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AbstractPublisherActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AbstractPublisherActionTest.java
@@ -75,9 +75,9 @@ public class AbstractPublisherActionTest extends AbstractProvisioningTest {
public void testAddCapabilities() {
InstallableUnitDescription iu = new InstallableUnitDescription();
iu.setId("test");
- assertEquals(0, iu.getRequiredCapabilities().length);
- assertEquals(0, iu.getProvidedCapabilities().length);
- assertEquals(0, iu.getMetaRequiredCapabilities().length);
+ assertEquals(0, iu.getRequiredCapabilities().size());
+ assertEquals(0, iu.getProvidedCapabilities().size());
+ assertEquals(0, iu.getMetaRequiredCapabilities().size());
IPublisherInfo info = new PublisherInfo();
IRequiredCapability testRequiredCapability = MetadataFactory.createRequiredCapability("ns1", "name1", null, null, false, false, false);
@@ -88,9 +88,9 @@ public class AbstractPublisherActionTest extends AbstractProvisioningTest {
TestAction action = new TestAction();
action.testProcessCapabilityAdvice(iu, info);
- assertEquals("name1", ((IRequiredCapability) iu.getRequiredCapabilities()[0]).getName());
- assertEquals("name2", iu.getProvidedCapabilities()[0].getName());
- assertEquals("name3", ((IRequiredCapability) iu.getMetaRequiredCapabilities()[0]).getName());
+ assertEquals("name1", ((IRequiredCapability) iu.getRequiredCapabilities().get(0)).getName());
+ assertEquals("name2", iu.getProvidedCapabilities().get(0).getName());
+ assertEquals("name3", ((IRequiredCapability) iu.getMetaRequiredCapabilities().get(0)).getName());
}
public void testAddCapabilitiesIdentityCounts() {
@@ -121,9 +121,9 @@ public class AbstractPublisherActionTest extends AbstractProvisioningTest {
metaRequiredCapabilities[4] = MetadataFactory.createRequiredCapability("mtest3", "test3", null, null, false, false, false);
iu.setMetaRequiredCapabilities(metaRequiredCapabilities);
- assertEquals(5, iu.getRequiredCapabilities().length);
- assertEquals(5, iu.getProvidedCapabilities().length);
- assertEquals(5, iu.getMetaRequiredCapabilities().length);
+ assertEquals(5, iu.getRequiredCapabilities().size());
+ assertEquals(5, iu.getProvidedCapabilities().size());
+ assertEquals(5, iu.getMetaRequiredCapabilities().size());
IPublisherInfo info = new PublisherInfo();
IRequiredCapability testRequiredCapability = MetadataFactory.createRequiredCapability("ns1", "name1", null, null, false, false, false);
@@ -134,9 +134,9 @@ public class AbstractPublisherActionTest extends AbstractProvisioningTest {
TestAction action = new TestAction();
action.testProcessCapabilityAdvice(iu, info);
- assertEquals(6, iu.getRequiredCapabilities().length);
- assertEquals(6, iu.getProvidedCapabilities().length);
- assertEquals(6, iu.getMetaRequiredCapabilities().length);
+ assertEquals(6, iu.getRequiredCapabilities().size());
+ assertEquals(6, iu.getProvidedCapabilities().size());
+ assertEquals(6, iu.getMetaRequiredCapabilities().size());
}
public void testReplaceCapabilities() {
@@ -146,9 +146,9 @@ public class AbstractPublisherActionTest extends AbstractProvisioningTest {
iu.setCapabilities(new IProvidedCapability[] {MetadataFactory.createProvidedCapability("ns2", "name2", null)});
iu.setMetaRequiredCapabilities(createRequiredCapabilities("ns3", "name3", null, ""));
- assertNotSame(9, Version.toOSGiVersion(iu.getProvidedCapabilities()[0].getVersion()).getMajor());
- assertTrue(iu.getRequiredCapabilities()[0].isGreedy());
- assertTrue(iu.getMetaRequiredCapabilities()[0].isGreedy());
+ assertNotSame(9, Version.toOSGiVersion(iu.getProvidedCapabilities().get(0).getVersion()).getMajor());
+ assertTrue(iu.getRequiredCapabilities().get(0).isGreedy());
+ assertTrue(iu.getMetaRequiredCapabilities().get(0).isGreedy());
IPublisherInfo info = new PublisherInfo();
IRequiredCapability testRequiredCapability = MetadataFactory.createRequiredCapability("ns1", "name1", null, null, false, false, false);
@@ -159,9 +159,9 @@ public class AbstractPublisherActionTest extends AbstractProvisioningTest {
TestAction action = new TestAction();
action.testProcessCapabilityAdvice(iu, info);
- assertEquals(9, Version.toOSGiVersion(iu.getProvidedCapabilities()[0].getVersion()).getMajor());
- assertFalse(iu.getRequiredCapabilities()[0].isGreedy());
- assertFalse(iu.getMetaRequiredCapabilities()[0].isGreedy());
+ assertEquals(9, Version.toOSGiVersion(iu.getProvidedCapabilities().get(0).getVersion()).getMajor());
+ assertFalse(iu.getRequiredCapabilities().get(0).isGreedy());
+ assertFalse(iu.getMetaRequiredCapabilities().get(0).isGreedy());
}
public void testReplaceCapabilitiesIdentityCounts() {
@@ -192,9 +192,9 @@ public class AbstractPublisherActionTest extends AbstractProvisioningTest {
metaRequiredCapabilities[4] = MetadataFactory.createRequiredCapability("mtest3", "test3", null, null, false, false, false);
iu.setMetaRequiredCapabilities(metaRequiredCapabilities);
- assertEquals(5, iu.getRequiredCapabilities().length);
- assertEquals(5, iu.getProvidedCapabilities().length);
- assertEquals(5, iu.getMetaRequiredCapabilities().length);
+ assertEquals(5, iu.getRequiredCapabilities().size());
+ assertEquals(5, iu.getProvidedCapabilities().size());
+ assertEquals(5, iu.getMetaRequiredCapabilities().size());
IPublisherInfo info = new PublisherInfo();
IRequiredCapability testRequiredCapability = MetadataFactory.createRequiredCapability("rtest1", "test1", null, null, false, false, false);
@@ -205,9 +205,9 @@ public class AbstractPublisherActionTest extends AbstractProvisioningTest {
TestAction action = new TestAction();
action.testProcessCapabilityAdvice(iu, info);
- assertEquals(4, iu.getRequiredCapabilities().length);
- assertEquals(4, iu.getProvidedCapabilities().length);
- assertEquals(4, iu.getMetaRequiredCapabilities().length);
+ assertEquals(4, iu.getRequiredCapabilities().size());
+ assertEquals(4, iu.getProvidedCapabilities().size());
+ assertEquals(4, iu.getMetaRequiredCapabilities().size());
}
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AccumulateConfigDataActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AccumulateConfigDataActionTest.java
index 9eb4f1c01..8f84737a9 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AccumulateConfigDataActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AccumulateConfigDataActionTest.java
@@ -14,7 +14,7 @@ import java.io.File;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
-import java.util.Properties;
+import java.util.Map;
import org.easymock.Capture;
import org.easymock.EasyMock;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -24,7 +24,7 @@ import org.eclipse.equinox.internal.provisional.frameworkadmin.ConfigData;
import org.eclipse.equinox.p2.publisher.eclipse.*;
import org.eclipse.equinox.p2.tests.TestActivator;
-@SuppressWarnings( {"restriction", "unchecked"})
+@SuppressWarnings({"restriction", "unchecked"})
public class AccumulateConfigDataActionTest extends ActionTest {
private static String EXECUTABLE_NAME = "run.exe"; //$NON-NLS-1$
@@ -75,11 +75,11 @@ public class AccumulateConfigDataActionTest extends ActionTest {
private void verifyConfigAdvice() throws Exception {
ConfigAdvice captured = configAdviceCapture.getValue();
- Properties prop = captured.getProperties();
- assertTrue(prop.getProperty("eclipse.buildId").equalsIgnoreCase("TEST-ID")); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue(prop.getProperty("eclipse.p2.profile").equalsIgnoreCase("PlatformProfile")); //$NON-NLS-1$//$NON-NLS-2$
- assertTrue(prop.getProperty("org.eclipse.update.reconcile").equalsIgnoreCase("false")); //$NON-NLS-1$//$NON-NLS-2$
- assertTrue(prop.getProperty("eclipse.product").equalsIgnoreCase("org.eclipse.platform.ide")); //$NON-NLS-1$//$NON-NLS-2$
+ Map<String, String> prop = captured.getProperties();
+ assertTrue(prop.get("eclipse.buildId").equalsIgnoreCase("TEST-ID")); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue(prop.get("eclipse.p2.profile").equalsIgnoreCase("PlatformProfile")); //$NON-NLS-1$//$NON-NLS-2$
+ assertTrue(prop.get("org.eclipse.update.reconcile").equalsIgnoreCase("false")); //$NON-NLS-1$//$NON-NLS-2$
+ assertTrue(prop.get("eclipse.product").equalsIgnoreCase("org.eclipse.platform.ide")); //$NON-NLS-1$//$NON-NLS-2$
assertContainsSymbolicName(captured.getBundles(), "org.eclipse.swt"); //$NON-NLS-1$
assertContainsSymbolicName(captured.getBundles(), "org.eclipse.swt.win32.win32.x86"); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ActionTest.java
index 625005736..c6bb23e4f 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ActionTest.java
@@ -57,16 +57,18 @@ public abstract class ActionTest extends AbstractProvisioningTest {
return (String[]) result.toArray(new String[result.size()]);
}
- protected void verifyProvidedCapability(IProvidedCapability[] prov, String namespace, String name, Version version) {
- for (int i = 0; i < prov.length; i++)
- if (prov[i].getName().equalsIgnoreCase(name) && prov[i].getNamespace().equalsIgnoreCase(namespace) && prov[i].getVersion().equals(version))
+ protected void verifyProvidedCapability(List<IProvidedCapability> prov, String namespace, String name, Version version) {
+ for (int i = 0; i < prov.size(); i++) {
+ IProvidedCapability pc = prov.get(i);
+ if (pc.getName().equalsIgnoreCase(name) && pc.getNamespace().equalsIgnoreCase(namespace) && pc.getVersion().equals(version))
return; // pass
+ }
Assert.fail("Missing ProvidedCapability: " + name + version.toString()); //$NON-NLS-1$
}
- protected void verifyRequiredCapability(IRequirement[] requirement, String namespace, String name, VersionRange range) {
- for (int i = 0; i < requirement.length; i++) {
- IRequiredCapability required = (IRequiredCapability) requirement[i].getMatches();
+ protected void verifyRequiredCapability(List<IRequirement> requirement, String namespace, String name, VersionRange range) {
+ for (int i = 0; i < requirement.size(); i++) {
+ IRequiredCapability required = (IRequiredCapability) requirement.get(i).getMatches();
if (required.getName().equalsIgnoreCase(name) && required.getNamespace().equalsIgnoreCase(namespace) && required.getRange().equals(range))
return;
}
@@ -108,18 +110,18 @@ public abstract class ActionTest extends AbstractProvisioningTest {
return map;
}
- protected void contains(IProvidedCapability[] capabilities, String namespace, String name, Version version) {
- for (int i = 0; i < capabilities.length; i++) {
- IProvidedCapability capability = capabilities[i];
+ protected void contains(List<IProvidedCapability> capabilities, String namespace, String name, Version version) {
+ for (int i = 0; i < capabilities.size(); i++) {
+ IProvidedCapability capability = capabilities.get(i);
if (capability.getNamespace().equals(namespace) && capability.getName().equals(name) && capability.getVersion().equals(version))
return;
}
fail();
}
- protected void contains(IRequirement[] capabilities, String namespace, String name, VersionRange range, String filter, boolean optional, boolean multiple) {
- for (int i = 0; i < capabilities.length; i++) {
- IRequiredCapability capability = (IRequiredCapability) capabilities[i].getMatches();
+ protected void contains(List<IRequirement> capabilities, String namespace, String name, VersionRange range, String filter, boolean optional, boolean multiple) {
+ for (int i = 0; i < capabilities.size(); i++) {
+ IRequiredCapability capability = (IRequiredCapability) capabilities.get(i).getMatches();
if (filter == null) {
if (capability.getFilter() != null)
continue;
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AdviceFileParserTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AdviceFileParserTest.java
index 4a48aec1d..51c70334e 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AdviceFileParserTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AdviceFileParserTest.java
@@ -57,8 +57,8 @@ public class AdviceFileParserTest extends TestCase {
AdviceFileParser parser = new AdviceFileParser("id", Version.emptyVersion, map);
parser.parse();
- assertEquals("testValue1", parser.getProperties().getProperty("testName1"));
- assertEquals("testValue2", parser.getProperties().getProperty("testName2"));
+ assertEquals("testValue1", parser.getProperties().get("testName1"));
+ assertEquals("testValue2", parser.getProperties().get("testName2"));
}
public void testProvidesAdvice() {
@@ -272,15 +272,15 @@ public class AdviceFileParserTest extends TestCase {
assertEquals(Version.create("1.2.3"), iu0.getVersion());
assertFalse(iu0.isSingleton());
assertFalse(FragmentQuery.isFragment(iu0));
- assertEquals(0, iu0.getArtifacts().length);
+ assertEquals(0, iu0.getArtifacts().size());
assertEquals(null, iu0.getCopyright());
assertEquals(null, iu0.getFilter());
- assertEquals(0, iu0.getLicenses().length);
+ assertEquals(0, iu0.getLicenses().size());
assertEquals(0, iu0.getProperties().size());
- assertEquals(0, iu0.getRequiredCapabilities().length);
- assertEquals(0, iu0.getProvidedCapabilities().length);
- assertEquals(0, iu0.getMetaRequiredCapabilities().length);
- assertEquals(0, iu0.getTouchpointData().length);
+ assertEquals(0, iu0.getRequiredCapabilities().size());
+ assertEquals(0, iu0.getProvidedCapabilities().size());
+ assertEquals(0, iu0.getMetaRequiredCapabilities().size());
+ assertEquals(0, iu0.getTouchpointData().size());
assertEquals(ITouchpointType.NONE, iu0.getTouchpointType());
assertEquals(null, iu0.getUpdateDescriptor());
@@ -288,62 +288,62 @@ public class AdviceFileParserTest extends TestCase {
assertEquals("testid1", iu1.getId());
assertEquals(Version.create("1.2.4"), iu1.getVersion());
assertTrue(iu1.isSingleton());
- assertEquals(2, iu1.getArtifacts().length);
- assertEquals("testArtifact1", iu1.getArtifacts()[0].getId());
- assertEquals(Version.create("1.2.6"), iu1.getArtifacts()[0].getVersion());
- assertEquals("testClassifier1", iu1.getArtifacts()[0].getClassifier());
- assertEquals("testArtifact2", iu1.getArtifacts()[1].getId());
- assertEquals(Version.create("1.2.7"), iu1.getArtifacts()[1].getVersion());
- assertEquals("testClassifier2", iu1.getArtifacts()[1].getClassifier());
+ assertEquals(2, iu1.getArtifacts().size());
+ assertEquals("testArtifact1", iu1.getArtifacts().get(0).getId());
+ assertEquals(Version.create("1.2.6"), iu1.getArtifacts().get(0).getVersion());
+ assertEquals("testClassifier1", iu1.getArtifacts().get(0).getClassifier());
+ assertEquals("testArtifact2", iu1.getArtifacts().get(1).getId());
+ assertEquals(Version.create("1.2.7"), iu1.getArtifacts().get(1).getVersion());
+ assertEquals("testClassifier2", iu1.getArtifacts().get(1).getClassifier());
assertEquals("testCopyright", iu1.getCopyright().getBody());
assertEquals("http://localhost/test", iu1.getCopyright().getLocation().toString());
assertEquals("test=testFilter", ((LDAPQuery) iu1.getFilter()).getFilter());
- assertEquals("testLicense", iu1.getLicenses()[0].getBody());
- assertEquals("http://localhost/license", iu1.getLicenses()[0].getLocation().toString());
+ assertEquals("testLicense", iu1.getLicenses().get(0).getBody());
+ assertEquals("http://localhost/license", iu1.getLicenses().get(0).getLocation().toString());
assertEquals("testValue1", iu1.getProperty("testName1"));
assertEquals("testValue2", iu1.getProperty("testName2"));
- IRequirement[] reqs = iu1.getRequiredCapabilities();
- assertEquals(2, reqs.length);
- assertEquals("testNamespace1", ((IRequiredCapability) reqs[0].getMatches()).getNamespace());
- assertEquals("testName1", ((IRequiredCapability) reqs[0].getMatches()).getName());
- assertEquals(new VersionRange("[1.2.3, 2)"), ((IRequiredCapability) reqs[0].getMatches()).getRange());
- assertEquals(true, ((IRequiredCapability) reqs[0].getMatches()).isGreedy());
- assertEquals(0, reqs[0].getMin());
- assertEquals("testNamespace2", ((IRequiredCapability) reqs[1].getMatches()).getNamespace());
- assertEquals("testName2", ((IRequiredCapability) reqs[1].getMatches()).getName());
- assertEquals(new VersionRange(Version.emptyVersion.toString()), ((IRequiredCapability) reqs[1].getMatches()).getRange());
- assertEquals(false, reqs[1].isGreedy());
- assertEquals(1, reqs[1].getMin());
-
- IProvidedCapability[] provided = iu1.getProvidedCapabilities();
- assertEquals(2, provided.length);
- assertEquals("testNamespace1", provided[0].getNamespace());
- assertEquals("testName1", provided[0].getName());
- assertEquals(Version.create("1.2.3"), provided[0].getVersion());
- assertEquals("testNamespace2", provided[1].getNamespace());
- assertEquals("testName2", provided[1].getName());
- assertEquals(Version.emptyVersion, provided[1].getVersion());
-
- IRequirement[] metarequirements = iu1.getMetaRequiredCapabilities();
- assertEquals(2, metarequirements.length);
- assertEquals("testNamespace1", ((IRequiredCapability) metarequirements[0].getMatches()).getNamespace());
- assertEquals("testName1", ((IRequiredCapability) metarequirements[0].getMatches()).getName());
- assertEquals(new VersionRange("[1.2.3, 2)"), ((IRequiredCapability) metarequirements[0].getMatches()).getRange());
- assertEquals(true, metarequirements[0].isGreedy());
- assertEquals(0, metarequirements[0].getMin());
- assertEquals("testNamespace2", ((IRequiredCapability) metarequirements[1].getMatches()).getNamespace());
- assertEquals("testName2", ((IRequiredCapability) metarequirements[1].getMatches()).getName());
- assertEquals(new VersionRange(Version.emptyVersion.toString()), ((IRequiredCapability) metarequirements[1].getMatches()).getRange());
- assertEquals(false, metarequirements[1].isGreedy());
- assertEquals(1, metarequirements[1].getMin());
-
- assertEquals(1, iu1.getTouchpointData().length);
- ITouchpointInstruction configure = iu1.getTouchpointData()[0].getInstruction("configure");
+ List<IRequirement> reqs = iu1.getRequiredCapabilities();
+ assertEquals(2, reqs.size());
+ assertEquals("testNamespace1", ((IRequiredCapability) reqs.get(0).getMatches()).getNamespace());
+ assertEquals("testName1", ((IRequiredCapability) reqs.get(0).getMatches()).getName());
+ assertEquals(new VersionRange("[1.2.3, 2)"), ((IRequiredCapability) reqs.get(0).getMatches()).getRange());
+ assertEquals(true, ((IRequiredCapability) reqs.get(0).getMatches()).isGreedy());
+ assertEquals(0, reqs.get(0).getMin());
+ assertEquals("testNamespace2", ((IRequiredCapability) reqs.get(1).getMatches()).getNamespace());
+ assertEquals("testName2", ((IRequiredCapability) reqs.get(1).getMatches()).getName());
+ assertEquals(new VersionRange(Version.emptyVersion.toString()), ((IRequiredCapability) reqs.get(1).getMatches()).getRange());
+ assertEquals(false, reqs.get(1).isGreedy());
+ assertEquals(1, reqs.get(1).getMin());
+
+ List<IProvidedCapability> provided = iu1.getProvidedCapabilities();
+ assertEquals(2, provided.size());
+ assertEquals("testNamespace1", provided.get(0).getNamespace());
+ assertEquals("testName1", provided.get(0).getName());
+ assertEquals(Version.create("1.2.3"), provided.get(0).getVersion());
+ assertEquals("testNamespace2", provided.get(1).getNamespace());
+ assertEquals("testName2", provided.get(1).getName());
+ assertEquals(Version.emptyVersion, provided.get(1).getVersion());
+
+ List<IRequirement> metarequirements = iu1.getMetaRequiredCapabilities();
+ assertEquals(2, metarequirements.size());
+ assertEquals("testNamespace1", ((IRequiredCapability) metarequirements.get(0).getMatches()).getNamespace());
+ assertEquals("testName1", ((IRequiredCapability) metarequirements.get(0).getMatches()).getName());
+ assertEquals(new VersionRange("[1.2.3, 2)"), ((IRequiredCapability) metarequirements.get(0).getMatches()).getRange());
+ assertEquals(true, metarequirements.get(0).isGreedy());
+ assertEquals(0, metarequirements.get(0).getMin());
+ assertEquals("testNamespace2", ((IRequiredCapability) metarequirements.get(1).getMatches()).getNamespace());
+ assertEquals("testName2", ((IRequiredCapability) metarequirements.get(1).getMatches()).getName());
+ assertEquals(new VersionRange(Version.emptyVersion.toString()), ((IRequiredCapability) metarequirements.get(1).getMatches()).getRange());
+ assertEquals(false, metarequirements.get(1).isGreedy());
+ assertEquals(1, metarequirements.get(1).getMin());
+
+ assertEquals(1, iu1.getTouchpointData().size());
+ ITouchpointInstruction configure = iu1.getTouchpointData().get(0).getInstruction("configure");
assertEquals(null, configure.getImportAttribute());
assertEquals("addProgramArg(programArg:-startup); addProgramArg(programArg:@artifact);", configure.getBody());
- ITouchpointInstruction unconfigure = iu1.getTouchpointData()[0].getInstruction("unconfigure");
+ ITouchpointInstruction unconfigure = iu1.getTouchpointData().get(0).getInstruction("unconfigure");
assertEquals("some.removeProgramArg", unconfigure.getImportAttribute());
assertEquals("removeProgramArg(programArg:-startup); removeProgramArg(programArg:@artifact);)", unconfigure.getBody());
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/BundlesActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/BundlesActionTest.java
index f1cf46a68..4c508c0b6 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/BundlesActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/BundlesActionTest.java
@@ -187,22 +187,22 @@ public class BundlesActionTest extends ActionTest {
assertEquals("1.1", bundle1IU.getVersion(), BUNDLE1_VERSION);
// check required capabilities
- IRequirement[] requiredCapability = bundle1IU.getRequiredCapabilities();
+ List<IRequirement> requiredCapability = bundle1IU.getRequiredCapabilities();
verifyRequiredCapability(requiredCapability, TEST1_IUD_NAMESPACE, TEST1_IUD_NAME, TEST1_IUD_VERSION_RANGE);
- assertEquals("2.0", 1, requiredCapability.length);
+ assertEquals("2.0", 1, requiredCapability.size());
// check provided capabilities
- IProvidedCapability[] providedCapabilities = bundle1IU.getProvidedCapabilities();
+ List<IProvidedCapability> providedCapabilities = bundle1IU.getProvidedCapabilities();
verifyProvidedCapability(providedCapabilities, PROVBUNDLE_NAMESPACE, TEST1_PROVBUNDLE_NAME, BUNDLE1_VERSION);
verifyProvidedCapability(providedCapabilities, OSGI, TEST1_PROVBUNDLE_NAME, BUNDLE1_VERSION);
verifyProvidedCapability(providedCapabilities, TEST1_PROVZ_NAMESPACE, TEST1_PROVZ_NAME, TEST2_PROVZ_VERSION);
verifyProvidedCapability(providedCapabilities, PublisherHelper.NAMESPACE_ECLIPSE_TYPE, "source", Version.create("1.0.0"));//$NON-NLS-1$//$NON-NLS-2$
- assertEquals("2.1", 4, providedCapabilities.length);
+ assertEquals("2.1", 4, providedCapabilities.size());
- ITouchpointData[] data = bundle1IU.getTouchpointData();
+ List<ITouchpointData> data = bundle1IU.getTouchpointData();
boolean found = false;
- for (int i = 0; i < data.length; i++) {
- ITouchpointInstruction configure = data[i].getInstruction("configure");
+ for (int i = 0; i < data.size(); i++) {
+ ITouchpointInstruction configure = data.get(i).getInstruction("configure");
if (configure == null)
continue;
String body = configure.getBody();
@@ -222,31 +222,31 @@ public class BundlesActionTest extends ActionTest {
assertEquals(bundle2IU.getVersion(), BUNDLE2_VERSION);
// check required capabilities
- IRequirement[] requiredCapabilities = bundle2IU.getRequiredCapabilities();
+ List<IRequirement> requiredCapabilities = bundle2IU.getRequiredCapabilities();
verifyRequiredCapability(requiredCapabilities, TEST2_IUA_NAMESPACE, TEST2_REQA_NAME, TEST2_IUA_VERSION_RANGE);
verifyRequiredCapability(requiredCapabilities, TEST2_IUB_NAMESPACE, TEST2_REQB_NAME, TEST2_IUB_VERSION_RANGE);
verifyRequiredCapability(requiredCapabilities, TEST2_IUC_NAMESPACE, TEST2_REQC_NAME, TEST2_IUC_VERSION_RANGE);
- assertTrue(requiredCapabilities.length == 3 /*number of tested elements*/);
+ assertTrue(requiredCapabilities.size() == 3 /*number of tested elements*/);
// check provided capabilities
- IProvidedCapability[] providedCapabilities = bundle2IU.getProvidedCapabilities();
+ List<IProvidedCapability> providedCapabilities = bundle2IU.getProvidedCapabilities();
verifyProvidedCapability(providedCapabilities, PROVBUNDLE_NAMESPACE, TEST2_PROVBUNDLE_NAME, PROVBUNDLE2_VERSION);
verifyProvidedCapability(providedCapabilities, OSGI, TEST2_PROVBUNDLE_NAME, BUNDLE2_VERSION);
verifyProvidedCapability(providedCapabilities, TEST2_PROVZ_NAMESPACE, TEST2_PROVZ_NAME, TEST2_PROVZ_VERSION);
verifyProvidedCapability(providedCapabilities, TEST2_PROVY_NAMESPACE, TEST2_PROVY_NAME, TEST2_PROVY_VERSION);
verifyProvidedCapability(providedCapabilities, TEST2_PROVX_NAMESPACE, TEST2_PROVX_NAME, TEST2_PROVX_VERSION);
verifyProvidedCapability(providedCapabilities, PublisherHelper.NAMESPACE_ECLIPSE_TYPE, "bundle", Version.create("1.0.0"));//$NON-NLS-1$//$NON-NLS-2$
- assertTrue(providedCapabilities.length == 6 /*number of tested elements*/);
+ assertTrue(providedCapabilities.size() == 6 /*number of tested elements*/);
// check %bundle name is correct
Map prop = bundle2IU.getProperties();
assertTrue(prop.get("org.eclipse.equinox.p2.name").toString().equalsIgnoreCase("%bundleName"));//$NON-NLS-1$//$NON-NLS-2$
assertTrue(prop.get("org.eclipse.equinox.p2.provider").toString().equalsIgnoreCase("%providerName"));//$NON-NLS-1$//$NON-NLS-2$
- ITouchpointData[] data = bundle2IU.getTouchpointData();
+ List<ITouchpointData> data = bundle2IU.getTouchpointData();
boolean found = false;
- for (int i = 0; i < data.length; i++) {
- ITouchpointInstruction configure = data[i].getInstruction("configure");
+ for (int i = 0; i < data.size(); i++) {
+ ITouchpointInstruction configure = data.get(i).getInstruction("configure");
if (configure == null)
continue;
String body = configure.getBody();
@@ -269,11 +269,11 @@ public class BundlesActionTest extends ActionTest {
protected void insertPublisherInfoBehavior() {
//super sets publisherInfo.getMetadataRepository and publisherInfo.getContextMetadataRepository
super.insertPublisherInfoBehavior();
- Properties sarProperties = new Properties();
+ Map<String, String> sarProperties = new HashMap<String, String>();
sarProperties.put("key1", "value1");//$NON-NLS-1$//$NON-NLS-2$
sarProperties.put("key2", "value2");//$NON-NLS-1$//$NON-NLS-2$
- Properties sdkProperties = new Properties();
+ Map<String, String> sdkProperties = new HashMap<String, String>();
sdkProperties.put("key1", "value1");//$NON-NLS-1$//$NON-NLS-2$
sdkProperties.put("key2", "value2");//$NON-NLS-1$//$NON-NLS-2$
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ConfigCUsActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ConfigCUsActionTest.java
index c8a2065f2..ac93d107d 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ConfigCUsActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ConfigCUsActionTest.java
@@ -14,6 +14,7 @@ import static org.easymock.EasyMock.expect;
import java.io.File;
import java.util.ArrayList;
+import java.util.List;
import org.easymock.EasyMock;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.equinox.internal.p2.metadata.InstallableUnit;
@@ -59,16 +60,16 @@ public class ConfigCUsActionTest extends ActionTest {
assertTrue(iu.getId().equalsIgnoreCase(flavor + id + ".configuration")); //$NON-NLS-1$
//verify ProvidedCapabilities
- IProvidedCapability[] providedCapabilities = iu.getProvidedCapabilities();
+ List<IProvidedCapability> providedCapabilities = iu.getProvidedCapabilities();
verifyProvidedCapability(providedCapabilities, "org.eclipse.equinox.p2.iu", iu.getId(), version); //$NON-NLS-1$
// verifyProvidedCapability(providedCapabilities, flavor + id, id + ".config", version); //$NON-NLS-1$
- assertTrue(providedCapabilities.length == 1);
+ assertTrue(providedCapabilities.size() == 1);
//verify RequiredCapabilities
- IRequirement[] requiredCapability = iu.getRequiredCapabilities();
+ List<IRequirement> requiredCapability = iu.getRequiredCapabilities();
verifyRequiredCapability(requiredCapability, IInstallableUnit.NAMESPACE_IU_ID, flavor + id + ".config." + configSpec, new VersionRange(version, true, version, true)); //$NON-NLS-1$
verifyRequiredCapability(requiredCapability, IInstallableUnit.NAMESPACE_IU_ID, flavor + id + ".ini." + configSpec, new VersionRange(version, true, version, true)); //$NON-NLS-1$
- assertTrue(requiredCapability.length == 2);
+ assertTrue(requiredCapability.size() == 2);
//verify non root IUs
verifyFragment("ini"); //$NON-NLS-1$
@@ -84,11 +85,11 @@ public class ConfigCUsActionTest extends ActionTest {
assertTrue(((LDAPQuery) iu.getFilter()).getFilter().equals("(& (osgi.ws=win32)(osgi.os=win32)(osgi.arch=x86))")); //$NON-NLS-1$
assertTrue(iu.getVersion().equals(version));
assertFalse(iu.isSingleton());
- IProvidedCapability[] providedCapabilities = iu.getProvidedCapabilities();
+ List<IProvidedCapability> providedCapabilities = iu.getProvidedCapabilities();
verifyProvidedCapability(providedCapabilities, IInstallableUnit.NAMESPACE_IU_ID, flavor + id + "." + cuType + "." + configSpec, version); //$NON-NLS-1$//$NON-NLS-2$
verifyProvidedCapability(providedCapabilities, flavor + id, id + "." + cuType, version); //$NON-NLS-1$
- assertTrue(providedCapabilities.length == 2);
- assertTrue(iu.getRequiredCapabilities().length == 0);
+ assertTrue(providedCapabilities.size() == 2);
+ assertTrue(iu.getRequiredCapabilities().size() == 0);
return; //pass
}
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/DefaultCUsActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/DefaultCUsActionTest.java
index 883aac78c..4b18b2476 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/DefaultCUsActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/DefaultCUsActionTest.java
@@ -10,14 +10,15 @@
******************************************************************************/
package org.eclipse.equinox.p2.tests.publisher.actions;
-import java.util.ArrayList;
+import java.util.Collection;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.equinox.internal.p2.metadata.InstallableUnitFragment;
import org.eclipse.equinox.internal.provisional.p2.metadata.Version;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.publisher.eclipse.DefaultCUsAction;
-@SuppressWarnings( {"restriction", "unchecked"})
+@SuppressWarnings({"unchecked"})
public class DefaultCUsActionTest extends ActionTest {
private Version version = Version.create("1.0.0"); //$NON-NLS-1$
@@ -33,7 +34,7 @@ public class DefaultCUsActionTest extends ActionTest {
}
private void verifyDefaultCUs() {
- ArrayList<InstallableUnitFragment> ius = (ArrayList<InstallableUnitFragment>) publisherResult.getIUs(null, null);
+ Collection<IInstallableUnit> ius = publisherResult.getIUs(null, null);
assertTrue(ius.size() == 3);
InstallableUnitFragment iuf1 = new InstallableUnitFragment();
iuf1.setId(flavorArg + ".source.default"); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxExecutableActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxExecutableActionTest.java
index 96070df09..5a18d7ed2 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxExecutableActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxExecutableActionTest.java
@@ -13,8 +13,7 @@ package org.eclipse.equinox.p2.tests.publisher.actions;
import static org.easymock.EasyMock.*;
import java.io.File;
-import java.util.ArrayList;
-import java.util.Collections;
+import java.util.*;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.equinox.internal.p2.metadata.LDAPQuery;
import org.eclipse.equinox.internal.p2.publisher.eclipse.ExecutablesDescriptor;
@@ -93,12 +92,12 @@ public class EquinoxExecutableActionTest extends ActionTest {
IInstallableUnit possibleEclipse = (IInstallableUnit) iuList.get(i);
if (possibleEclipse.getId().equals(flavorArg + idBase + ".executable." + configSpec)) {//$NON-NLS-1$
IInstallableUnitFragment fragment = (IInstallableUnitFragment) iuList.get(i);
- IProvidedCapability[] providedCapability = fragment.getProvidedCapabilities();
+ List<IProvidedCapability> providedCapability = fragment.getProvidedCapabilities();
verifyProvidedCapability(providedCapability, IInstallableUnit.NAMESPACE_IU_ID, flavorArg + idBase + ".executable." + configSpec, version); //$NON-NLS-1$
- assertTrue(providedCapability.length == 1);
- IRequirement[] requiredCapability = fragment.getRequiredCapabilities();
+ assertTrue(providedCapability.size() == 1);
+ List<IRequirement> requiredCapability = fragment.getRequiredCapabilities();
verifyRequiredCapability(requiredCapability, IInstallableUnit.NAMESPACE_IU_ID, idBase + ".executable." + configSpec, new VersionRange(version, true, version, true)); //$NON-NLS-1$
- assertTrue(requiredCapability.length == 1);
+ assertTrue(requiredCapability.size() == 1);
assertTrue(((LDAPQuery) fragment.getFilter()).getFilter().equals("(& (osgi.ws=" + ws + ")(osgi.os=" + os + ")(osgi.arch=" + arch + "))")); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
assertTrue(fragment.getProperty("org.eclipse.equinox.p2.type.fragment").equals("true")); //$NON-NLS-1$ //$NON-NLS-2$
return;//pass
@@ -113,11 +112,11 @@ public class EquinoxExecutableActionTest extends ActionTest {
IInstallableUnit possibleEclipse = (IInstallableUnit) iuList.get(i);
if (possibleEclipse.getId().equals((idBase + ".executable." + configSpec + ".eclipse"))) { //$NON-NLS-1$//$NON-NLS-2$
assertTrue(possibleEclipse.getVersion().equals(version));
- IProvidedCapability[] providedCapability = possibleEclipse.getProvidedCapabilities();
+ List<IProvidedCapability> providedCapability = possibleEclipse.getProvidedCapabilities();
verifyProvidedCapability(providedCapability, IInstallableUnit.NAMESPACE_IU_ID, idBase + ".executable." + configSpec + ".eclipse", version); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue(providedCapability.length == 1);
- IRequirement[] req = possibleEclipse.getRequiredCapabilities();
- assertTrue(req.length == 0);
+ assertTrue(providedCapability.size() == 1);
+ List<IRequirement> req = possibleEclipse.getRequiredCapabilities();
+ assertTrue(req.size() == 0);
return;//pass
}
}
@@ -135,18 +134,18 @@ public class EquinoxExecutableActionTest extends ActionTest {
if (possibleExec.getId().equals(idBase + ".executable." + configSpec)) { //$NON-NLS-1$
//keep checking
assertTrue(((LDAPQuery) possibleExec.getFilter()).getFilter().equals("(& (osgi.ws=" + ws + ")(osgi.os=" + os + ")(osgi.arch=" + arch + "))")); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
- IArtifactKey eKey = possibleExec.getArtifacts()[0];
+ IArtifactKey eKey = possibleExec.getArtifacts().get(0);
assertTrue(eKey.getClassifier().equals("binary")); //$NON-NLS-1$
assertTrue(eKey.getId().equals(idBase + ".executable." + configSpec)); //$NON-NLS-1$
assertTrue(eKey.getVersion().equals(version));
- IProvidedCapability[] providedCapabilities = possibleExec.getProvidedCapabilities();
+ List<IProvidedCapability> providedCapabilities = possibleExec.getProvidedCapabilities();
verifyProvidedCapability(providedCapabilities, IInstallableUnit.NAMESPACE_IU_ID, idBase + ".executable." + configSpec, version); //$NON-NLS-1$
verifyProvidedCapability(providedCapabilities, flavorArg + idBase, idBase + ".executable", version); //$NON-NLS-1$
- assertTrue(providedCapabilities.length == 2);
+ assertTrue(providedCapabilities.size() == 2);
- IRequirement[] requiredCapability = possibleExec.getRequiredCapabilities();
+ List<IRequirement> requiredCapability = possibleExec.getRequiredCapabilities();
verifyRequiredCapability(requiredCapability, IInstallableUnit.NAMESPACE_IU_ID, "org.eclipse.equinox.launcher." + (idBase.equals("mac") || idBase.equals("macCocoa") ? configSpec.substring(0, configSpec.lastIndexOf(".")) : configSpec), VersionRange.emptyRange); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertTrue(requiredCapability.length == 1);
+ assertTrue(requiredCapability.size() == 1);
return;//pass
}
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxLauncherCUActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxLauncherCUActionTest.java
index 406450bcf..60e70d7bb 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxLauncherCUActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxLauncherCUActionTest.java
@@ -12,8 +12,7 @@ package org.eclipse.equinox.p2.tests.publisher.actions;
import static org.easymock.EasyMock.*;
-import java.util.ArrayList;
-import java.util.Map;
+import java.util.*;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.equinox.internal.p2.metadata.InstallableUnitFragment;
import org.eclipse.equinox.internal.provisional.p2.metadata.*;
@@ -66,12 +65,12 @@ public class EquinoxLauncherCUActionTest extends ActionTest {
//verify required capability
verifyRequiredCapability(iu.getRequiredCapabilities(), PublisherHelper.OSGI_BUNDLE_CLASSIFIER, EquinoxLauncherCUAction.ORG_ECLIPSE_EQUINOX_LAUNCHER, VersionRange.emptyRange);
verifyRequiredCapability(iu.getRequiredCapabilities(), PublisherHelper.NAMESPACE_ECLIPSE_TYPE, "bundle", new VersionRange(Version.create("1.0.0"), true, Version.create("2.0.0"), false)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertTrue(iu.getRequiredCapabilities().length == 2);
+ assertTrue(iu.getRequiredCapabilities().size() == 2);
- IProvidedCapability[] cap = iu.getProvidedCapabilities();
+ List<IProvidedCapability> cap = iu.getProvidedCapabilities();
verifyProvidedCapability(cap, IInstallableUnit.NAMESPACE_IU_ID, flavorArg + "org.eclipse.equinox.launcher", Version.emptyVersion); //$NON-NLS-1$
verifyProvidedCapability(cap, "org.eclipse.equinox.p2.flavor", flavorArg, Version.create("1.0.0")); //$NON-NLS-1$//$NON-NLS-2$
- assertTrue(cap.length == 2);
+ assertTrue(cap.size() == 2);
Map prop = iu.getProperties();
assertTrue(prop.get("org.eclipse.equinox.p2.type.fragment").equals("true")); //$NON-NLS-1$ //$NON-NLS-2$
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/FeaturesActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/FeaturesActionTest.java
index 9e16653fa..2bb770955 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/FeaturesActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/FeaturesActionTest.java
@@ -83,11 +83,11 @@ public class FeaturesActionTest extends ActionTest {
assertTrue(foo.getVersion().equals(fooVersion));
assertEquals("Foo Feature", foo.getProperty(IInstallableUnit.PROP_NAME));
assertEquals("Foo Description", foo.getProperty(IInstallableUnit.PROP_DESCRIPTION));
- assertEquals("Foo License", foo.getLicenses()[0].getBody());
+ assertEquals("Foo License", foo.getLicenses().get(0).getBody());
assertEquals("Foo Copyright", foo.getCopyright().getBody());
assertTrue(foo.getProperty("key1").equals("value1")); //$NON-NLS-1$ //$NON-NLS-2$
assertTrue(foo.getProperty("key2").equals("value2")); //$NON-NLS-1$//$NON-NLS-2$
- assertTrue(foo.getArtifacts()[0].equals(FOO_KEY));
+ assertTrue(foo.getArtifacts().get(0).equals(FOO_KEY));
assertTrue(((LDAPQuery) foo.getFilter()).getFilter().equalsIgnoreCase("(org.eclipse.update.install.features=true)")); //$NON-NLS-1$
//check touchpointType
@@ -95,26 +95,26 @@ public class FeaturesActionTest extends ActionTest {
assertTrue(foo.getTouchpointType().getVersion().equals(fooVersion));
//zipped=true
- ITouchpointData[] tpData = foo.getTouchpointData();
- String fooValue = ((ITouchpointInstruction) tpData[0].getInstructions().get("zipped")).getBody(); //$NON-NLS-1$
+ List<ITouchpointData> tpData = foo.getTouchpointData();
+ String fooValue = ((ITouchpointInstruction) tpData.get(0).getInstructions().get("zipped")).getBody(); //$NON-NLS-1$
assertTrue(fooValue.equalsIgnoreCase("true")); //$NON-NLS-1$
- IRequirement[] fooRequiredCapabilities = foo.getRequiredCapabilities();
- assertTrue(fooRequiredCapabilities.length == 0);
+ List<IRequirement> fooRequiredCapabilities = foo.getRequiredCapabilities();
+ assertTrue(fooRequiredCapabilities.size() == 0);
- IProvidedCapability[] fooProvidedCapabilities = foo.getProvidedCapabilities();
+ List<IProvidedCapability> fooProvidedCapabilities = foo.getProvidedCapabilities();
contains(fooProvidedCapabilities, IInstallableUnit.NAMESPACE_IU_ID, "foo.feature.jar", fooVersion); //$NON-NLS-1$
contains(fooProvidedCapabilities, PublisherHelper.NAMESPACE_ECLIPSE_TYPE, "feature", fooVersion); //$NON-NLS-1$
contains(fooProvidedCapabilities, "org.eclipse.update.feature", FOO, fooVersion); //$NON-NLS-1$
- assertTrue(fooProvidedCapabilities.length == 3);
+ assertTrue(fooProvidedCapabilities.size() == 3);
//feature group IU for foo
fooIUs = new ArrayList(publisherResult.getIUs("foo.feature.group", IPublisherResult.ROOT)); //$NON-NLS-1$
assertTrue(fooIUs.size() == 1);
IInstallableUnit fooGroup = (IInstallableUnit) fooIUs.get(0);
tpData = fooGroup.getTouchpointData();
- assertEquals(1, tpData.length);
- ITouchpointInstruction instruction = tpData[0].getInstruction("install");
+ assertEquals(1, tpData.size());
+ ITouchpointInstruction instruction = tpData.get(0).getInstruction("install");
assertNotNull(instruction);
assertEquals("ln(targetDir:@artifact,linkTarget:foo/lib.1.so,linkName:lib.so);chmod(targetDir:@artifact,targetFile:lib/lib.so,permissions:755);", instruction.getBody());
System.out.println(fooGroup.getFilter());
@@ -130,21 +130,21 @@ public class FeaturesActionTest extends ActionTest {
assertTrue(bar.getProperty("key2").equals("value2")); //$NON-NLS-1$//$NON-NLS-2$
assertTrue(bar.getProperties().containsKey("org.eclipse.update.installHandler")); //$NON-NLS-1$
assertTrue(bar.getProperties().containsValue("handler=bar handler")); //$NON-NLS-1$
- assertTrue(bar.getArtifacts()[0].equals(BAR_KEY));
+ assertTrue(bar.getArtifacts().get(0).equals(BAR_KEY));
assertTrue(((LDAPQuery) bar.getFilter()).getFilter().equalsIgnoreCase("(org.eclipse.update.install.features=true)")); //$NON-NLS-1$
assertTrue(bar.isSingleton());
barIUs = new ArrayList(publisherResult.getIUs("bar.feature.group", IPublisherResult.ROOT)); //$NON-NLS-1$
assertTrue(fooIUs.size() == 1);
IInstallableUnit barGroup = (IInstallableUnit) barIUs.get(0);
- IRequirement[] barRequiredCapabilities = barGroup.getRequiredCapabilities();
+ List<IRequirement> barRequiredCapabilities = barGroup.getRequiredCapabilities();
//contains(barRequiredCapabilities, IInstallableUnit.NAMESPACE_IU_ID, "bar_root", new VersionRange(barVersion, true, barVersion, true), null, false /*multiple*/, false /*optional*/); //$NON-NLS-1$//$NON-NLS-2$
contains(barRequiredCapabilities, IInstallableUnit.NAMESPACE_IU_ID, "bar.feature.jar", new VersionRange(barVersion, true, barVersion, true), "(org.eclipse.update.install.features=true)", false /*multiple*/, false /*optional*/); //$NON-NLS-1$//$NON-NLS-2$
contains(barRequiredCapabilities, IInstallableUnit.NAMESPACE_IU_ID, "org.bar.feature.feature.group", VersionRange.emptyRange, "(&(|(osgi.nl=de)(osgi.nl=en)(osgi.nl=fr)))", false /*multiple*/, false /*optional*/); //$NON-NLS-1$//$NON-NLS-2$
assertTrue(((LDAPQuery) barGroup.getFilter()).getFilter().equalsIgnoreCase("(&(|(osgi.os=macosx)(osgi.os=win32))(|(osgi.ws=carbon)(osgi.ws=win32))(|(osgi.arch=ppc)(osgi.arch=x86))(osgi.nl=en))"));
//check zipped=true in touchpointData
- String barValue = ((ITouchpointInstruction) bar.getTouchpointData()[0].getInstructions().get("zipped")).getBody(); //$NON-NLS-1$
+ String barValue = ((ITouchpointInstruction) bar.getTouchpointData().get(0).getInstructions().get("zipped")).getBody(); //$NON-NLS-1$
assertTrue(barValue.equalsIgnoreCase("true")); //$NON-NLS-1$
//check touchpointType
@@ -153,13 +153,13 @@ public class FeaturesActionTest extends ActionTest {
//String namespace, String name, VersionRange range, String filter, boolean optional, boolean multiple, boolean greedy)
barRequiredCapabilities = bar.getRequiredCapabilities();
- assertTrue(barRequiredCapabilities.length == 0);
+ assertTrue(barRequiredCapabilities.size() == 0);
- IProvidedCapability[] barProvidedCapabilities = bar.getProvidedCapabilities();
+ List<IProvidedCapability> barProvidedCapabilities = bar.getProvidedCapabilities();
contains(barProvidedCapabilities, IInstallableUnit.NAMESPACE_IU_ID, "bar.feature.jar", barVersion); //$NON-NLS-1$
contains(barProvidedCapabilities, PublisherHelper.NAMESPACE_ECLIPSE_TYPE, "feature", fooVersion); //$NON-NLS-1$
contains(barProvidedCapabilities, "org.eclipse.update.feature", BAR, barVersion); //$NON-NLS-1$
- assertTrue(barProvidedCapabilities.length == 3);
+ assertTrue(barProvidedCapabilities.size() == 3);
}
private void verifyArtifacts() throws IOException {
@@ -202,9 +202,9 @@ public class FeaturesActionTest extends ActionTest {
}
private ArrayList fillAdvice(ArrayList adviceCollection) {
- Properties prop = new Properties();
- prop.setProperty("key1", "value1"); //$NON-NLS-1$//$NON-NLS-2$
- prop.setProperty("key2", "value2"); //$NON-NLS-1$//$NON-NLS-2$
+ Map<String, String> prop = new HashMap<String, String>();
+ prop.put("key1", "value1"); //$NON-NLS-1$//$NON-NLS-2$
+ prop.put("key2", "value2"); //$NON-NLS-1$//$NON-NLS-2$
IPropertyAdvice propertyAdvice = EasyMock.createMock(IPropertyAdvice.class);
expect(propertyAdvice.getInstallableUnitProperties((InstallableUnitDescription) EasyMock.anyObject())).andReturn(prop).anyTimes();
expect(propertyAdvice.getArtifactProperties((IInstallableUnit) EasyMock.anyObject(), (IArtifactDescriptor) EasyMock.anyObject())).andReturn(null).anyTimes();
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/JREActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/JREActionTest.java
index 9e984c846..1ae8b576d 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/JREActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/JREActionTest.java
@@ -81,25 +81,25 @@ public class JREActionTest extends ActionTest {
assertTrue(foo.getTouchpointType().getVersion().equals(Version.create("1.0.0"))); //$NON-NLS-1$
// check provided capabilities
- IProvidedCapability[] fooProvidedCapabilities = foo.getProvidedCapabilities();
- assertTrue(fooProvidedCapabilities.length == numProvidedCapabilities);
+ List<IProvidedCapability> fooProvidedCapabilities = foo.getProvidedCapabilities();
+ assertTrue(fooProvidedCapabilities.size() == numProvidedCapabilities);
ArrayList barIUs = new ArrayList(publisherResult.getIUs("config." + id, IPublisherResult.ROOT)); //$NON-NLS-1$
assertTrue(barIUs.size() == 1);
IInstallableUnit bar = (IInstallableUnit) barIUs.get(0);
if (testInstructions) {
- Map instructions = bar.getTouchpointData()[0].getInstructions();
+ Map instructions = bar.getTouchpointData().get(0).getInstructions();
assertTrue(((ITouchpointInstruction) instructions.get("install")).getBody().equals("unzip(source:@artifact, target:${installFolder});")); //$NON-NLS-1$//$NON-NLS-2$
assertTrue(((ITouchpointInstruction) instructions.get("uninstall")).getBody().equals("cleanupzip(source:@artifact, target:${installFolder});")); //$NON-NLS-1$ //$NON-NLS-2$
}
- IRequirement[] requiredCapability = bar.getRequiredCapabilities();
+ List<IRequirement> requiredCapability = bar.getRequiredCapabilities();
verifyRequiredCapability(requiredCapability, IInstallableUnit.NAMESPACE_IU_ID, id, new VersionRange(JREVersion, true, Version.MAX_VERSION, true)); //$NON-NLS-1$
- assertTrue(requiredCapability.length == 1);
+ assertTrue(requiredCapability.size() == 1);
- IProvidedCapability[] providedCapability = bar.getProvidedCapabilities();
+ List<IProvidedCapability> providedCapability = bar.getProvidedCapabilities();
verifyProvidedCapability(providedCapability, IInstallableUnit.NAMESPACE_IU_ID, "config." + id, JREVersion); //$NON-NLS-1$
- assertTrue(providedCapability.length == 1);
+ assertTrue(providedCapability.size() == 1);
assertTrue(bar.getProperty("org.eclipse.equinox.p2.type.fragment").equals("true")); //$NON-NLS-1$//$NON-NLS-2$
assertTrue(bar.getVersion().equals(JREVersion));
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/LocalUpdateSiteActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/LocalUpdateSiteActionTest.java
index dbbd16a6e..eae9128ef 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/LocalUpdateSiteActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/LocalUpdateSiteActionTest.java
@@ -58,9 +58,9 @@ public class LocalUpdateSiteActionTest extends ActionTest {
Collection ius = publisherResult.getIUs("test.feature.feature.jar", null);
assertEquals("1.0", 1, ius.size());
IInstallableUnit iu = (IInstallableUnit) ius.iterator().next();
- ITouchpointData[] touchpointData = iu.getTouchpointData();
- assertEquals("1.1", 1, touchpointData.length);
- Map instructions = touchpointData[0].getInstructions();
+ List<ITouchpointData> touchpointData = iu.getTouchpointData();
+ assertEquals("1.1", 1, touchpointData.size());
+ Map instructions = touchpointData.get(0).getInstructions();
Set keys = instructions.keySet();
assertEquals("1.2", 1, keys.size());
String unzip = (String) keys.iterator().next();
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTest.java
index 715993915..5cd30a25f 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTest.java
@@ -92,8 +92,8 @@ public class ProductActionTest extends ActionTest {
Collection ius = publisherResult.getIUs("licenseIU.product", IPublisherResult.NON_ROOT);
assertEquals("1.0", 1, ius.size());
IInstallableUnit iu = (IInstallableUnit) ius.iterator().next();
- assertEquals("1.1", "http://www.example.com", iu.getLicenses()[0].getLocation().toString());
- assertEquals("1.2", "This is the liCenSE.", iu.getLicenses()[0].getBody().trim());
+ assertEquals("1.1", "http://www.example.com", iu.getLicenses().get(0).getLocation().toString());
+ assertEquals("1.2", "This is the liCenSE.", iu.getLicenses().get(0).getBody().trim());
}
public void testLicenseNoURL() throws Exception {
@@ -105,8 +105,8 @@ public class ProductActionTest extends ActionTest {
Collection ius = publisherResult.getIUs("licenseIU.product", IPublisherResult.NON_ROOT);
assertEquals("1.0", 1, ius.size());
IInstallableUnit iu = (IInstallableUnit) ius.iterator().next();
- assertEquals("1.1", "", iu.getLicenses()[0].getLocation().toString());
- assertEquals("1.2", "This is the liCenSE.", iu.getLicenses()[0].getBody().trim());
+ assertEquals("1.1", "", iu.getLicenses().get(0).getLocation().toString());
+ assertEquals("1.2", "This is the liCenSE.", iu.getLicenses().get(0).getBody().trim());
}
public void testLicenseNoText() throws Exception {
@@ -118,8 +118,8 @@ public class ProductActionTest extends ActionTest {
Collection ius = publisherResult.getIUs("licenseIU.product", IPublisherResult.NON_ROOT);
assertEquals("1.0", 1, ius.size());
IInstallableUnit iu = (IInstallableUnit) ius.iterator().next();
- assertEquals("1.1", "http://www.example.com", iu.getLicenses()[0].getLocation().toString());
- assertEquals("1.2", "", iu.getLicenses()[0].getBody().trim());
+ assertEquals("1.1", "http://www.example.com", iu.getLicenses().get(0).getLocation().toString());
+ assertEquals("1.2", "", iu.getLicenses().get(0).getBody().trim());
}
public void testMissingLicense() throws Exception {
@@ -131,7 +131,7 @@ public class ProductActionTest extends ActionTest {
Collection ius = publisherResult.getIUs("licenseIU.product", IPublisherResult.NON_ROOT);
assertEquals("1.0", 1, ius.size());
IInstallableUnit iu = (IInstallableUnit) ius.iterator().next();
- assertEquals(0, iu.getLicenses().length);
+ assertEquals(0, iu.getLicenses().size());
}
/**
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionWithAdviceFileTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionWithAdviceFileTest.java
index 6fd35da74..245e3ca3d 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionWithAdviceFileTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionWithAdviceFileTest.java
@@ -13,6 +13,7 @@ package org.eclipse.equinox.p2.tests.publisher.actions;
import java.io.File;
import java.net.URI;
import java.util.Collection;
+import java.util.List;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.equinox.internal.p2.metadata.IRequiredCapability;
import org.eclipse.equinox.internal.p2.metadata.LDAPQuery;
@@ -83,12 +84,12 @@ public class ProductActionWithAdviceFileTest extends ActionTest {
IQueryResult results = publisherResult.query(new IUQuery("org.eclipse.platform.ide", Version.create("3.5.0.I20081118")), null);
assertEquals("1.0", 1, queryResultSize(results));
IInstallableUnit unit = (IInstallableUnit) results.iterator().next();
- IRequirement[] requiredCapabilities = unit.getRequiredCapabilities();
+ List<IRequirement> requiredCapabilities = unit.getRequiredCapabilities();
IRequiredCapability capability = null;
- for (int i = 0; i < requiredCapabilities.length; i++)
- if ((((IRequiredCapability) requiredCapabilities[i]).getName().equals("org.eclipse.equinox.p2.user.ui.feature.group"))) {
- capability = (IRequiredCapability) requiredCapabilities[i];
+ for (int i = 0; i < requiredCapabilities.size(); i++)
+ if ((((IRequiredCapability) requiredCapabilities.get(i)).getName().equals("org.eclipse.equinox.p2.user.ui.feature.group"))) {
+ capability = (IRequiredCapability) requiredCapabilities.get(i);
break;
}
assertTrue("1.1", capability != null);
@@ -106,9 +107,9 @@ public class ProductActionWithAdviceFileTest extends ActionTest {
Collection productIUs = publisherResult.getIUs("productWithAdvice.product", IPublisherResult.NON_ROOT);
assertEquals("1.0", 1, productIUs.size());
IInstallableUnit product = (IInstallableUnit) productIUs.iterator().next();
- ITouchpointData[] data = product.getTouchpointData();
- assertEquals("1.1", 1, data.length);
- String configure = data[0].getInstruction("configure").getBody();
+ List<ITouchpointData> data = product.getTouchpointData();
+ assertEquals("1.1", 1, data.size());
+ String configure = data.get(0).getInstruction("configure").getBody();
assertEquals("1.2", "addRepository(type:0,location:http${#58}//download.eclipse.org/releases/fred);addRepository(type:1,location:http${#58}//download.eclipse.org/releases/fred);", configure);
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductFileAdviceTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductFileAdviceTest.java
index 1558ca18a..f1434b554 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductFileAdviceTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductFileAdviceTest.java
@@ -11,6 +11,7 @@
package org.eclipse.equinox.p2.tests.publisher.actions;
import java.io.File;
+import java.util.Map;
import java.util.Properties;
import org.eclipse.equinox.internal.p2.publisher.eclipse.ProductFile;
import org.eclipse.equinox.internal.provisional.frameworkadmin.BundleInfo;
@@ -149,7 +150,7 @@ public class ProductFileAdviceTest extends AbstractProvisioningTest {
* Test method for {@link org.eclipse.equinox.p2.publisher.eclipse.ProductFileAdvice#getProperties()}.
*/
public void testGetProperties() {
- Properties properties = productFileAdviceWin32.getProperties();
+ Map<String, String> properties = productFileAdviceWin32.getProperties();
assertEquals("1.0", 7, properties.size());
assertEquals("1.2", "bar", properties.get("foo"));
assertEquals("1.3", "", properties.get("foo1"));
@@ -253,7 +254,7 @@ public class ProductFileAdviceTest extends AbstractProvisioningTest {
BundleInfo[] bundles = advice.getBundles();
assertEquals("bundlers length", 2, bundles.length);
- Properties adviceProperties = advice.getProperties();
+ Map<String, String> adviceProperties = advice.getProperties();
assertEquals("instance.area.default", "@user.home/workspace", adviceProperties.get("osgi.instance.area.default"));
assertEquals("eclipse.application", "test.application", adviceProperties.get("eclipse.application"));
assertEquals("eclipse.product", "test.product", adviceProperties.get("eclipse.product"));
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductFileTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductFileTest.java
index f9b79e83f..83019bcb9 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductFileTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductFileTest.java
@@ -10,7 +10,7 @@
package org.eclipse.equinox.p2.tests.publisher.actions;
import java.util.List;
-import java.util.Properties;
+import java.util.Map;
import junit.framework.TestCase;
import org.eclipse.equinox.internal.p2.publisher.eclipse.ProductFile;
import org.eclipse.equinox.internal.provisional.frameworkadmin.BundleInfo;
@@ -55,7 +55,7 @@ public class ProductFileTest extends TestCase {
* Test method for {@link org.eclipse.equinox.internal.p2.publisher.eclipse.ProductFile#getProperties()}.
*/
public void testGetConfigurationProperties() {
- Properties properties = productFile.getConfigurationProperties();
+ Map<String, String> properties = productFile.getConfigurationProperties();
assertEquals("1.0", 4, properties.size());
assertEquals("1.1", "bar", properties.get("foo"));
assertEquals("1.2", "", properties.get("foo1"));
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/RootFilesActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/RootFilesActionTest.java
index 2183c5588..3d2b5fc4c 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/RootFilesActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/RootFilesActionTest.java
@@ -45,7 +45,7 @@ public class RootFilesActionTest extends ActionTest {
private File root = new File(TestActivator.getTestDataFolder(), "RootFilesActionTest/eclipse"); //$NON-NLS-1$
private File[] includedFiles;
private File[] excludedFiles;
- private Collection<RootFilesAdvice> adviceCollection;
+ private Collection<IRootFilesAdvice> adviceCollection;
private String FILE1 = "level1/level2/file1.jar"; //$NON-NLS-1$
private String FILE2 = "level1/level2/level3/file1.jar"; //$NON-NLS-1$
private int testArg;
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/RootIUActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/RootIUActionTest.java
index 94c85bd93..94b851005 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/RootIUActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/RootIUActionTest.java
@@ -12,8 +12,7 @@ package org.eclipse.equinox.p2.tests.publisher.actions;
import static org.easymock.EasyMock.expect;
-import java.util.ArrayList;
-import java.util.Collection;
+import java.util.*;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.equinox.internal.p2.metadata.IRequiredCapability;
@@ -271,9 +270,9 @@ public class RootIUActionTest extends ActionTest {
IInstallableUnit iu = (IInstallableUnit) ius.get(0);
assertTrue(iu != null);
assertTrue(iu.getVersion().equals(versionArg));
- IRequirement[] required = iu.getRequiredCapabilities();
+ List<IRequirement> required = iu.getRequiredCapabilities();
if ((testSpec & EMPTY) > 0)
- assertEquals(required.length, 0);
+ assertEquals(required.size(), 0);
String confirmedIUs = ""; //$NON-NLS-1$
int numConfirmed = 0;
@@ -287,7 +286,7 @@ public class RootIUActionTest extends ActionTest {
confirmedIUs += iu_B;
numConfirmed++;
}
- if (numConfirmed != required.length) {
+ if (numConfirmed != required.size()) {
debug("Not all required ius present / accounted for."); //$NON-NLS-1$
fail();
}
@@ -297,9 +296,9 @@ public class RootIUActionTest extends ActionTest {
debug("Confirmed \t\t Empty"); //$NON-NLS-1$
}
- private boolean contains(IRequirement[] required, String iu) {
- for (int i = 0; i < required.length; i++)
- if (((IRequiredCapability) required[i]).getName().equalsIgnoreCase(iu))
+ private boolean contains(List<IRequirement> required, String iu) {
+ for (int i = 0; i < required.size(); i++)
+ if (((IRequiredCapability) required.get(i)).getName().equalsIgnoreCase(iu))
return true;
return false;
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/EvaluatorTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/EvaluatorTest.java
index 413281dce..c1862d641 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/EvaluatorTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/EvaluatorTest.java
@@ -71,27 +71,27 @@ public class EvaluatorTest extends AbstractProvisioningTest {
public void testLatest() throws Exception {
IMetadataRepository repo = getMDR("/testData/metadataRepo/multipleversions1");
- IQueryResult result = repo.query(new QLContextQuery("latest(x | x.id == $0)", "test.bundle"), new NullProgressMonitor());
+ IQueryResult result = repo.query(new QLContextQuery(IInstallableUnit.class, "latest(x | x.id == $0)", "test.bundle"), new NullProgressMonitor());
assertTrue(queryResultSize(result) == 1);
}
public void testRange() throws Exception {
IMetadataRepository repo = getMDR("/testData/metadataRepo/multipleversions1");
- IQueryResult result = repo.query(new QLMatchQuery("version ~= $0", new VersionRange("2.0.0")), new NullProgressMonitor());
+ IQueryResult result = repo.query(new QLMatchQuery(IInstallableUnit.class, "version ~= $0", new VersionRange("2.0.0")), new NullProgressMonitor());
assertEquals(queryResultSize(result), 2);
}
public void testProperty() throws Exception {
IMetadataRepository repo = getMDR("/testData/metadataRepo/multipleversions1");
- IQueryResult result = repo.query(new QLMatchQuery("properties.exists(p | boolean(p.value))"), new NullProgressMonitor());
+ IQueryResult result = repo.query(new QLMatchQuery(IInstallableUnit.class, "properties.exists(p | boolean(p.value))"), new NullProgressMonitor());
assertEquals(queryResultSize(result), 3);
- result = repo.query(new QLMatchQuery("boolean(properties['org.eclipse.equinox.p2.type.group'])"), new NullProgressMonitor());
+ result = repo.query(new QLMatchQuery(IInstallableUnit.class, "boolean(properties['org.eclipse.equinox.p2.type.group'])"), new NullProgressMonitor());
assertEquals(queryResultSize(result), 3);
Filter filter = TestActivator.context.createFilter("(org.eclipse.equinox.p2.type.group=true)");
- result = repo.query(new QLMatchQuery("properties ~= $0", filter), new NullProgressMonitor());
+ result = repo.query(new QLMatchQuery(IInstallableUnit.class, "properties ~= $0", filter), new NullProgressMonitor());
assertEquals(queryResultSize(result), 3);
}
@@ -100,7 +100,7 @@ public class EvaluatorTest extends AbstractProvisioningTest {
"parent.requiredCapabilities.unique(requirementsCache).select(rc | rc.filter == null || $2 ~= filter(rc.filter)), _, " + //
"{rcs, child | rcs.exists(rc | child ~= rc)})}).limit(10)";
- IContextExpression expr = parser.parseQuery(exprString);
+ IContextExpression expr = parser.parseQuery(IInstallableUnit.class, exprString);
System.out.println(expr.toString());
assertEquals(exprString, expr.toString());
}
@@ -117,7 +117,7 @@ public class EvaluatorTest extends AbstractProvisioningTest {
IExpression everything = factory.variable("everything");
IExpression lambda = factory.lambda(item, factory.and(new IExpression[] {cmp1, cmp2}));
IExpression latest = factory.latest(factory.select(everything, lambda));
- IContextExpression e3 = factory.contextExpression(latest);
+ IContextExpression e3 = factory.contextExpression(IInstallableUnit.class, latest);
// Put the parameters in a map
Map args = new HashMap();
@@ -127,7 +127,7 @@ public class EvaluatorTest extends AbstractProvisioningTest {
// Create the query
IMetadataRepository repo = getMDR("/testData/metadataRepo/multipleversions1");
- IQueryResult result = repo.query(new QLContextQuery(IInstallableUnit.class, e3, new Object[] {args}), new NullProgressMonitor());
+ IQueryResult result = repo.query(new QLContextQuery(e3, args), new NullProgressMonitor());
assertEquals(queryResultSize(result), 1);
}
@@ -146,29 +146,29 @@ public class EvaluatorTest extends AbstractProvisioningTest {
applicability[1][1] = MetadataFactory.createRequiredCapability("org.eclipse.equinox.p2.flavor", "tooling", null, null, false, false);
IMetadataRepository repo = getMDR("/testData/metadataRepo/wsdlTestRepo");
- IQueryResult result = repo.query(new QLMatchQuery("$0.exists(rcs | rcs.all(rc | item ~= rc))", applicability), new NullProgressMonitor());
+ IQueryResult result = repo.query(new QLMatchQuery(IInstallableUnit.class, "$0.exists(rcs | rcs.all(rc | item ~= rc))", (Object) applicability), new NullProgressMonitor());
assertEquals(queryResultSize(result), 3);
}
public void testPattern() throws Exception {
IProvidedCapability pc = MetadataFactory.createProvidedCapability("org.eclipse.equinox.p2.eclipse.type", "source", null);
IMetadataRepository repo = getMDR("/testData/metadataRepo/wsdlTestRepo");
- IQueryResult result = repo.query(new QLMatchQuery("id ~= /tooling.*.default/", pc), new NullProgressMonitor());
+ IQueryResult result = repo.query(new QLMatchQuery(IInstallableUnit.class, "id ~= /tooling.*.default/", pc), new NullProgressMonitor());
assertEquals(queryResultSize(result), 3);
}
public void testLimit() throws Exception {
IMetadataRepository repo = getMDR("/testData/metadataRepo/wsdlTestRepo");
- IQueryResult result = repo.query(new QLContextQuery("select(x | x.id ~= /tooling.*/).limit(1)"), new NullProgressMonitor());
+ IQueryResult result = repo.query(new QLContextQuery(IInstallableUnit.class, "select(x | x.id ~= /tooling.*/).limit(1)"), new NullProgressMonitor());
assertEquals(queryResultSize(result), 1);
- result = repo.query(new QLContextQuery("select(x | x.id ~= /tooling.*/).limit($0)", new Integer(2)), new NullProgressMonitor());
+ result = repo.query(new QLContextQuery(IInstallableUnit.class, "select(x | x.id ~= /tooling.*/).limit($0)", new Integer(2)), new NullProgressMonitor());
assertEquals(queryResultSize(result), 2);
}
public void testNot() throws Exception {
IMetadataRepository repo = getMDR("/testData/metadataRepo/wsdlTestRepo");
- IQueryResult result = repo.query(new QLMatchQuery("!(id ~= /tooling.*/)"), new NullProgressMonitor());
+ IQueryResult result = repo.query(new QLMatchQuery(IInstallableUnit.class, "!(id ~= /tooling.*/)"), new NullProgressMonitor());
assertEquals(queryResultSize(result), 4);
}
@@ -179,13 +179,13 @@ public class EvaluatorTest extends AbstractProvisioningTest {
assertNotNull(artifactManager);
IArtifactRepository repo = artifactManager.loadRepository(artifactRepo, new NullProgressMonitor());
- IQueryResult result = repo.query(new QLMatchQuery(IArtifactKey.class, "classifier ~= /*/", null), new NullProgressMonitor());
+ IQueryResult result = repo.query(new QLMatchQuery(IArtifactKey.class, "classifier ~= /*/"), new NullProgressMonitor());
assertTrue(queryResultSize(result) > 1);
Iterator itor = result.iterator();
while (itor.hasNext())
assertTrue(itor.next() instanceof IArtifactKey);
- result = repo.query(new QLMatchQuery(IArtifactDescriptor.class, "artifactKey.classifier ~= /*/", null), new NullProgressMonitor());
+ result = repo.query(new QLMatchQuery(IArtifactDescriptor.class, "artifactKey.classifier ~= /*/"), new NullProgressMonitor());
assertTrue(queryResultSize(result) > 1);
itor = result.iterator();
while (itor.hasNext())
@@ -194,7 +194,7 @@ public class EvaluatorTest extends AbstractProvisioningTest {
public void testClassConstructor() throws Exception {
IMetadataRepository repo = getMDR("/testData/metadataRepo/wsdlTestRepo");
- IQueryResult result = repo.query(new QLContextQuery(//
+ IQueryResult result = repo.query(new QLContextQuery(IInstallableUnit.class, //
"select(x | x ~= class('org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnitFragment'))"), new NullProgressMonitor());
assertEquals(queryResultSize(result), 4);
repo = getMDR("/testData/galileoM7");
@@ -202,7 +202,7 @@ public class EvaluatorTest extends AbstractProvisioningTest {
public void testTraverseWithoutIndex() throws Exception {
IMetadataRepository repo = getMDR("/testData/galileoM7");
- IQueryResult result = repo.query(new QLContextQuery( //
+ IQueryResult result = repo.query(new QLContextQuery(IInstallableUnit.class, //
"select(x | x.id == $0 && x.version == $1).traverse(parent | select(" + //
"child | parent.requiredCapabilities.exists(rc | child ~= rc)))", //
"org.eclipse.sdk.feature.group", Version.create("3.5.0.v20090423-7Q7bA7DPR-wM38__Q4iRsmx9z0KOjbpx3AbyvXd-Uq7J2")), new NullProgressMonitor());
@@ -212,7 +212,7 @@ public class EvaluatorTest extends AbstractProvisioningTest {
public void testTraverseWithIndex() throws Exception {
IMetadataRepository repo = getMDR("/testData/galileoM7");
IQueryResult result = repo.query(//
- new QLContextQuery("" + //
+ new QLContextQuery(IInstallableUnit.class, "" + //
"select(x | x.id == $0 && x.version == $1).traverse(capabilityIndex(everything), _, { index, parent |" + //
"index.satisfiesAny(parent.requiredCapabilities)})", //
"org.eclipse.sdk.feature.group",//
@@ -223,7 +223,7 @@ public class EvaluatorTest extends AbstractProvisioningTest {
public void testTraverseWithIndexAndFilter() throws Exception {
// Add some filtering of requirements
- IContextExpression expr = parser.parseQuery("" + //
+ IContextExpression expr = parser.parseQuery(IInstallableUnit.class, "" + //
"select(x | x.id == $0 && x.version == $1).traverse(capabilityIndex(everything), _, { index, parent |" + //
"index.satisfiesAny(parent.requiredCapabilities.select(rc | rc.filter == null || $2 ~= filter(rc.filter)))})");
@@ -231,7 +231,7 @@ public class EvaluatorTest extends AbstractProvisioningTest {
env.put("osgi.os", "linux");
env.put("osgi.ws", "gtk");
env.put("osgi.arch", "x86");
- QLContextQuery query = new QLContextQuery(IInstallableUnit.class, expr, new Object[] {"org.eclipse.sdk.feature.group", Version.create("3.5.0.v20090423-7Q7bA7DPR-wM38__Q4iRsmx9z0KOjbpx3AbyvXd-Uq7J2"), env});
+ QLContextQuery query = new QLContextQuery(expr, "org.eclipse.sdk.feature.group", Version.create("3.5.0.v20090423-7Q7bA7DPR-wM38__Q4iRsmx9z0KOjbpx3AbyvXd-Uq7J2"), env);
IMetadataRepository repo = getMDR("/testData/galileoM7");
IQueryResult result = repo.query(query, new NullProgressMonitor());
@@ -242,10 +242,10 @@ public class EvaluatorTest extends AbstractProvisioningTest {
// Add some filtering of requirements
IMetadataRepository repo = getMDR("/testData/galileoM7");
- QLContextQuery indexQuery = new QLContextQuery("capabilityIndex(everything)");
+ QLContextQuery indexQuery = new QLContextQuery(IInstallableUnit.class, "capabilityIndex(everything)");
Object index = indexQuery.query(QL.newQueryContext(repo));
- IContextExpression expr = parser.parseQuery("" + //
+ IContextExpression expr = parser.parseQuery(IInstallableUnit.class, "" + //
"select(x | x.id == $0 && x.version == $1).traverse(parent |" + //
"$5.satisfiesAny(parent.requiredCapabilities.select(rc | rc.filter == null || $4 ~= filter(rc.filter)))) && " + //
"select(x | x.id == $2 && x.version == $3).traverse(parent |" + //
@@ -256,13 +256,13 @@ public class EvaluatorTest extends AbstractProvisioningTest {
env.put("osgi.ws", "gtk");
env.put("osgi.arch", "x86");
- QLContextQuery query = new QLContextQuery(IInstallableUnit.class, expr, new Object[] { //
+ QLContextQuery query = new QLContextQuery(expr, //
"org.eclipse.pde.feature.group", //
- Version.create("3.5.0.v20090123-7Z7YF8NFE-z0VXhWU26Hu8gY"), //
- "org.eclipse.gmf.feature.group", //
- Version.create("1.1.1.v20090114-0940-7d8B0FXwkKwFanGNHeHHq8ymBgZ"), //
- env,//
- index});
+ Version.create("3.5.0.v20090123-7Z7YF8NFE-z0VXhWU26Hu8gY"), //
+ "org.eclipse.gmf.feature.group", //
+ Version.create("1.1.1.v20090114-0940-7d8B0FXwkKwFanGNHeHHq8ymBgZ"), //
+ env,//
+ index);
IQueryResult result = repo.query(query, new NullProgressMonitor());
assertEquals(queryResultSize(result), 184);
@@ -289,7 +289,7 @@ public class EvaluatorTest extends AbstractProvisioningTest {
public void testMatchQueryInjectionInContext() throws Exception {
IMetadataRepository repo = getMDR("/testData/galileoM7");
- IContextExpression expr = parser.parseQuery("select(x | iquery($0, x) || iquery($1, x)).latest()");
+ IContextExpression expr = parser.parseQuery(IInstallableUnit.class, "select(x | iquery($0, x) || iquery($1, x)).latest()");
MatchQuery q1 = new MatchQuery() {
@Override
public boolean isMatch(Object candidate) {
@@ -302,7 +302,7 @@ public class EvaluatorTest extends AbstractProvisioningTest {
return "true".equals(((IInstallableUnit) candidate).getProperty("org.eclipse.equinox.p2.type.group"));
}
};
- IQueryResult result = repo.query(new QLContextQuery(IInstallableUnit.class, expr, new Object[] {q1, q2}), new NullProgressMonitor());
+ IQueryResult result = repo.query(new QLContextQuery(expr, q1, q2), new NullProgressMonitor());
assertEquals(queryResultSize(result), 497);
}
@@ -330,7 +330,7 @@ public class EvaluatorTest extends AbstractProvisioningTest {
IQueryResult result = queryableArray.query(new InstallableUnitQuery("foo"), null);
assertEquals("2.1", 1, queryResultSize(result));
- QLMatchQuery lq = new QLMatchQuery("translations['org.eclipse.equinox.p2.name'] ~= /German*/");
+ QLMatchQuery lq = new QLMatchQuery(IInstallableUnit.class, "translations['org.eclipse.equinox.p2.name'] ~= /German*/");
lq.setLocale(Locale.GERMAN);
Iterator itr = queryableArray.query(lq, new NullProgressMonitor()).iterator();
assertTrue(itr.hasNext());
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/PerformanceTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/PerformanceTest.java
index 166050407..fd63f7bf2 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/PerformanceTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/PerformanceTest.java
@@ -34,7 +34,7 @@ public class PerformanceTest extends AbstractProvisioningTest {
IMetadataRepository repo = getMDR("/testData/galileoM7");
IRequiredCapability capability = MetadataFactory.createRequiredCapability("org.eclipse.equinox.p2.eclipse.type", "feature", new VersionRange("[1.0.0,2.0.0)"), null, false, false);
- QLMatchQuery predicateQuery = new QLMatchQuery("item ~= $0", capability);
+ QLMatchQuery predicateQuery = new QLMatchQuery(IInstallableUnit.class, "item ~= $0", capability);
IQueryResult result;
long tradQueryMS = 0;
long exprQueryMS = 0;
@@ -65,8 +65,8 @@ public class PerformanceTest extends AbstractProvisioningTest {
IQueryable qaRepo = new QueryableArray(gatherAvailableInstallableUnits(repo));
IRequiredCapability capability = MetadataFactory.createRequiredCapability("org.eclipse.equinox.p2.eclipse.type", "feature", new VersionRange("[1.0.0,2.0.0)"), null, false, false);
- QLContextQuery exprQuery = new QLContextQuery("capabilityIndex(everything)");
- exprQuery = new QLContextQuery("$0.satisfiesAny([$1])", exprQuery.query(QL.newQueryContext(qaRepo)), capability);
+ QLContextQuery exprQuery = new QLContextQuery(IInstallableUnit.class, "capabilityIndex(everything)");
+ exprQuery = new QLContextQuery(IInstallableUnit.class, "$0.satisfiesAny([$1])", exprQuery.query(QL.newQueryContext(qaRepo)), capability);
IQueryResult result;
long tradQueryMS = 0;
long exprQueryMS = 0;
@@ -96,7 +96,7 @@ public class PerformanceTest extends AbstractProvisioningTest {
IMetadataRepository repo = getMDR("/testData/galileoM7");
IUPropertyQuery propertyQuery = new IUPropertyQuery("df_LT.providerName", "Eclipse.org");
- QLMatchQuery predicateQuery = new QLMatchQuery("properties[$0] == $1", "df_LT.providerName", "Eclipse.org");
+ QLMatchQuery predicateQuery = new QLMatchQuery(IInstallableUnit.class, "properties[$0] == $1", "df_LT.providerName", "Eclipse.org");
IQueryResult result;
long tradQueryMS = 0;
long exprQueryMS = 0;
@@ -133,7 +133,7 @@ public class PerformanceTest extends AbstractProvisioningTest {
assertTrue(itor.hasNext());
IInstallableUnit[] roots = new IInstallableUnit[] {(IInstallableUnit) itor.next()};
- IQuery query = new QLContextQuery("" + //
+ IQuery query = new QLContextQuery(IInstallableUnit.class, "" + //
"$0.traverse(set(), capabilityIndex(everything), _, {rqCache, index, parent | " + //
"index.satisfiesAny(parent.requiredCapabilities.unique(rqCache).select(rc | rc.filter == null || $1 ~= filter(rc.filter)))})", roots, env);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/TestQueryReimplementation.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/TestQueryReimplementation.java
index dc0e84197..4d747642c 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/TestQueryReimplementation.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/TestQueryReimplementation.java
@@ -57,7 +57,7 @@ public class TestQueryReimplementation extends AbstractProvisioningTest {
* A convenience query that will match any {@link IInstallableUnit}
* it encounters.
*/
- public static final QLMatchQuery ANY = new QLMatchQuery("");
+ public static final QLMatchQuery ANY = new QLMatchQuery(IInstallableUnit.class, "");
private static final IMatchExpression idVersionQuery;
private static final IMatchExpression idRangeQuery;
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/CollectActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/CollectActionTest.java
index b35ed0c00..82ff7cd64 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/CollectActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/CollectActionTest.java
@@ -62,7 +62,7 @@ public class CollectActionTest extends AbstractProvisioningTest {
Map parameters = new HashMap();
parameters.put(ActionConstants.PARM_AGENT, getAgent());
parameters.put(ActionConstants.PARM_PROFILE, profile);
- parameters.put(Collect.PARM_ARTIFACT_REQUESTS, new ArrayList());
+ parameters.put(Collect.PARM_ARTIFACT_REQUESTS, new ArrayList<IArtifactRequest[]>());
EclipseTouchpoint touchpoint = new EclipseTouchpoint();
touchpoint.initializePhase(null, profile, "test", parameters);
InstallableUnitOperand operand = new InstallableUnitOperand(null, iu);
@@ -71,7 +71,7 @@ public class CollectActionTest extends AbstractProvisioningTest {
parameters.put(ActionConstants.PARM_OPERAND, operand);
parameters = Collections.unmodifiableMap(parameters);
- List requests = (List) parameters.get(Collect.PARM_ARTIFACT_REQUESTS);
+ List<IArtifactRequest[]> requests = (List<IArtifactRequest[]>) parameters.get(Collect.PARM_ARTIFACT_REQUESTS);
assertFalse(hasRequest(requests, key));
CollectAction action = new CollectAction();
action.execute(parameters);
@@ -81,9 +81,9 @@ public class CollectActionTest extends AbstractProvisioningTest {
assertTrue(hasRequest(requests, key));
}
- private boolean hasRequest(List requests, IArtifactKey key) {
- for (Iterator iterator = requests.iterator(); iterator.hasNext();) {
- IArtifactRequest[] request = (IArtifactRequest[]) iterator.next();
+ private boolean hasRequest(List<IArtifactRequest[]> requests, IArtifactKey key) {
+ for (Iterator<IArtifactRequest[]> iterator = requests.iterator(); iterator.hasNext();) {
+ IArtifactRequest[] request = iterator.next();
for (int i = 0; i < request.length; i++) {
if (key.equals(request[i].getArtifactKey()))
return true;
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/EclipseTouchpointTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/EclipseTouchpointTest.java
index b73f7b72f..bc770359f 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/EclipseTouchpointTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/EclipseTouchpointTest.java
@@ -136,7 +136,7 @@ public class EclipseTouchpointTest extends AbstractProvisioningTest {
IArtifactDescriptor descriptor = PublisherHelper.createArtifactDescriptor(key, osgiTarget);
bundlePool.addDescriptor(descriptor);
- Properties extraProperties = new Properties();
+ Map<String, String> extraProperties = new HashMap<String, String>();
extraProperties.put(IInstallableUnit.PROP_PARTIAL_IU, Boolean.TRUE.toString());
Dictionary mockManifest = new Properties();
@@ -174,7 +174,7 @@ public class EclipseTouchpointTest extends AbstractProvisioningTest {
IArtifactDescriptor descriptor = PublisherHelper.createArtifactDescriptor(key, osgiTarget);
bundlePool.addDescriptor(descriptor);
- Properties extraProperties = new Properties();
+ Map<String, String> extraProperties = new HashMap<String, String>();
extraProperties.put(IInstallableUnit.PROP_PARTIAL_IU, Boolean.TRUE.toString());
Dictionary mockManifest = new Properties();
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/UtilTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/UtilTest.java
index 033850875..ad18c812b 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/UtilTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/UtilTest.java
@@ -59,6 +59,6 @@ public class UtilTest extends AbstractProvisioningTest {
public void testMissingManifest() {
ITouchpointData emptyData = MetadataFactory.createTouchpointData(Collections.EMPTY_MAP);
- assertNull(Util.getManifest(new ITouchpointData[] {emptyData}));
+ assertNull(Util.getManifest(Collections.singletonList(emptyData)));
}
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/CollectActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/CollectActionTest.java
index ef9b68d26..4b91f1ba3 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/CollectActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/CollectActionTest.java
@@ -57,7 +57,7 @@ public class CollectActionTest extends AbstractProvisioningTest {
Map parameters = new HashMap();
parameters.put(ActionConstants.PARM_AGENT, getAgent());
parameters.put(ActionConstants.PARM_PROFILE, profile);
- parameters.put(Collect.PARM_ARTIFACT_REQUESTS, new ArrayList());
+ parameters.put(Collect.PARM_ARTIFACT_REQUESTS, new ArrayList<IArtifactRequest[]>());
NativeTouchpoint touchpoint = new NativeTouchpoint();
touchpoint.initializePhase(null, profile, "test", parameters);
InstallableUnitOperand operand = new InstallableUnitOperand(null, iu);
@@ -66,7 +66,7 @@ public class CollectActionTest extends AbstractProvisioningTest {
parameters.put(ActionConstants.PARM_OPERAND, operand);
parameters = Collections.unmodifiableMap(parameters);
- List requests = (List) parameters.get(Collect.PARM_ARTIFACT_REQUESTS);
+ List<IArtifactRequest[]> requests = (List<IArtifactRequest[]>) parameters.get(Collect.PARM_ARTIFACT_REQUESTS);
assertFalse(hasRequest(requests, key));
CollectAction action = new CollectAction();
action.execute(parameters);
@@ -76,9 +76,9 @@ public class CollectActionTest extends AbstractProvisioningTest {
assertTrue(hasRequest(requests, key));
}
- private boolean hasRequest(List requests, IArtifactKey key) {
- for (Iterator iterator = requests.iterator(); iterator.hasNext();) {
- IArtifactRequest[] request = (IArtifactRequest[]) iterator.next();
+ private boolean hasRequest(List<IArtifactRequest[]> requests, IArtifactKey key) {
+ for (Iterator<IArtifactRequest[]> iterator = requests.iterator(); iterator.hasNext();) {
+ IArtifactRequest[] request = iterator.next();
for (int i = 0; i < request.length; i++) {
if (key.equals(request[i].getArtifactKey()))
return true;
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/SiteXMLActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/SiteXMLActionTest.java
index 484f3a7e8..4c68bbe7e 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/SiteXMLActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/SiteXMLActionTest.java
@@ -12,8 +12,7 @@ package org.eclipse.equinox.p2.tests.updatesite;
import java.io.File;
import java.net.URI;
-import java.util.Collection;
-import java.util.Iterator;
+import java.util.*;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.URIUtil;
import org.eclipse.equinox.internal.p2.updatesite.SiteXMLAction;
@@ -59,10 +58,10 @@ public class SiteXMLActionTest extends AbstractProvisioningTest {
assertTrue("1.0", unit.getId().startsWith(sitelocation));
assertEquals("2.0", "Test Category Label", unit.getProperty(IInstallableUnit.PROP_NAME));
- IProvidedCapability[] provided = unit.getProvidedCapabilities();
- assertEquals(1, provided.length);
- assertTrue(provided[0].getName().startsWith(sitelocation));
- assertEquals(provided[0].getVersion(), unit.getVersion());
+ List<IProvidedCapability> provided = unit.getProvidedCapabilities();
+ assertEquals(1, provided.size());
+ assertTrue(provided.get(0).getName().startsWith(sitelocation));
+ assertEquals(provided.get(0).getVersion(), unit.getVersion());
}
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/UpdateSiteTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/UpdateSiteTest.java
index 1262cf3f6..c8e612b5f 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/UpdateSiteTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/UpdateSiteTest.java
@@ -14,6 +14,7 @@ import java.io.*;
import java.lang.reflect.Field;
import java.net.URI;
import java.net.URISyntaxException;
+import java.util.List;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@@ -606,10 +607,10 @@ public class UpdateSiteTest extends AbstractProvisioningTest {
IQueryResult result = metadataRepo.query(query, null);
assertEquals("1.0", 1, queryResultSize(result));
IInstallableUnit featureIU = (IInstallableUnit) result.iterator().next();
- IRequirement[] required = featureIU.getRequiredCapabilities();
- for (int i = 0; i < required.length; i++) {
- if (((IRequiredCapability) required[i]).getName().equals("org.eclipse.ui.ide")) {
- assertEquals("2.0", VersionRange.emptyRange, ((IRequiredCapability) required[i]).getRange());
+ List<IRequirement> required = featureIU.getRequiredCapabilities();
+ for (int i = 0; i < required.size(); i++) {
+ if (((IRequiredCapability) required.get(i)).getName().equals("org.eclipse.ui.ide")) {
+ assertEquals("2.0", VersionRange.emptyRange, ((IRequiredCapability) required.get(i)).getRange());
}
}
}
@@ -651,9 +652,9 @@ public class UpdateSiteTest extends AbstractProvisioningTest {
IQueryResult result = repository.query(new InstallableUnitQuery("test.feature.feature.jar"), getMonitor());
assertTrue("1.0", !result.isEmpty());
IInstallableUnit unit = (IInstallableUnit) result.iterator().next();
- ITouchpointData[] data = unit.getTouchpointData();
- assertEquals("1.1", 1, data.length);
- Map instructions = data[0].getInstructions();
+ List<ITouchpointData> data = unit.getTouchpointData();
+ assertEquals("1.1", 1, data.size());
+ Map instructions = data.get(0).getInstructions();
assertEquals("1.2", 1, instructions.size());
assertEquals("1.3", "true", ((ITouchpointInstruction) instructions.get("zipped")).getBody());
}
diff --git a/bundles/org.eclipse.equinox.p2.testserver/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.testserver/META-INF/MANIFEST.MF
index 415da60d8..3e35f7599 100644
--- a/bundles/org.eclipse.equinox.p2.testserver/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.testserver/META-INF/MANIFEST.MF
@@ -5,7 +5,8 @@ Bundle-SymbolicName: org.eclipse.equinox.p2.testserver;singleton:=true
Bundle-Version: 1.0.0
Bundle-Activator: org.eclipse.equinox.p2.testserver.Activator
Bundle-Vendor: Eclipse
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-RequiredExecutionEnvironment: J2SE-1.5,
+ J2SE-1.4
Import-Package: org.eclipse.equinox.http,
org.osgi.framework;version="1.3.0"
Bundle-ActivationPolicy: lazy
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/.classpath b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/.classpath
index 2fbb7a23e..64c5e31b7 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/.classpath
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <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.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
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
index 2daa5df61..c493e8d3d 100644
--- 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
@@ -1,4 +1,4 @@
-#Fri Feb 22 11:24:21 EST 2008
+#Tue Dec 22 18:23:28 CET 2009
eclipse.preferences.version=1
instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
@@ -8,24 +8,24 @@ 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.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.compliance=1.5
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.assertIdentifier=error
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.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
@@ -72,7 +72,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=en
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.compiler.source=1.5
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
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
index 50f723f0e..75ff28244 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/META-INF/MANIFEST.MF
@@ -41,7 +41,8 @@ Export-Package: org.eclipse.equinox.internal.p2.touchpoint.eclipse;x-friends:="o
org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions;x-internal:=true,
org.eclipse.equinox.internal.p2.update;x-friends:="org.eclipse.equinox.p2.reconciler.dropins,org.eclipse.equinox.p2.extensionlocation,org.eclipse.equinox.p2.directorywatcher",
org.eclipse.equinox.p2.touchpoint.eclipse.query
-Bundle-RequiredExecutionEnvironment: J2SE-1.4,
+Bundle-RequiredExecutionEnvironment: J2SE-1.5,
+ J2SE-1.4,
CDC-1.1/Foundation-1.1
Bundle-ActivationPolicy: lazy
Bundle-Activator: org.eclipse.equinox.internal.p2.touchpoint.eclipse.Activator
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/build.properties b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/build.properties
index 4bbd9bd55..0328daa18 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/build.properties
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/build.properties
@@ -16,3 +16,5 @@ bin.includes = META-INF/,\
about.html,\
plugin.properties
src.includes = about.html
+javacTarget=jsr14
+javacSource=1.5
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/AggregatedBundleRepository.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/AggregatedBundleRepository.java
index 9388d821e..0d48e41b8 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/AggregatedBundleRepository.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/AggregatedBundleRepository.java
@@ -10,32 +10,32 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.touchpoint.eclipse;
-import org.eclipse.equinox.p2.metadata.query.IQueryResult;
-
import java.io.File;
import java.io.OutputStream;
import java.util.*;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.*;
+import org.eclipse.equinox.internal.provisional.p2.metadata.query.CompoundQueryable;
+import org.eclipse.equinox.internal.provisional.p2.metadata.query.IQueryable;
import org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.AbstractArtifactRepository;
import org.eclipse.equinox.p2.metadata.IArtifactKey;
import org.eclipse.equinox.p2.metadata.query.IQuery;
+import org.eclipse.equinox.p2.metadata.query.IQueryResult;
import org.eclipse.equinox.p2.repository.artifact.*;
public class AggregatedBundleRepository extends AbstractArtifactRepository implements IFileArtifactRepository {
private static final String REPOSITORY_TYPE = AggregatedBundleRepository.class.getName();
- private final Collection bundleRepositories;
+ private final Collection<IFileArtifactRepository> bundleRepositories;
- public AggregatedBundleRepository(Collection bundleRepositories) {
+ public AggregatedBundleRepository(Collection<IFileArtifactRepository> bundleRepositories) {
super(REPOSITORY_TYPE, REPOSITORY_TYPE, "1.0", null, null, null, null); //$NON-NLS-1$
this.bundleRepositories = bundleRepositories;
}
public File getArtifactFile(IArtifactKey key) {
- for (Iterator it = bundleRepositories.iterator(); it.hasNext();) {
- IFileArtifactRepository repository = (IFileArtifactRepository) it.next();
+ for (Iterator<IFileArtifactRepository> it = bundleRepositories.iterator(); it.hasNext();) {
+ IFileArtifactRepository repository = it.next();
File artifactFile = repository.getArtifactFile(key);
if (artifactFile != null)
return artifactFile;
@@ -44,8 +44,8 @@ public class AggregatedBundleRepository extends AbstractArtifactRepository imple
}
public File getArtifactFile(IArtifactDescriptor descriptor) {
- for (Iterator it = bundleRepositories.iterator(); it.hasNext();) {
- IFileArtifactRepository repository = (IFileArtifactRepository) it.next();
+ for (Iterator<IFileArtifactRepository> it = bundleRepositories.iterator(); it.hasNext();) {
+ IFileArtifactRepository repository = it.next();
File artifactFile = repository.getArtifactFile(descriptor);
if (artifactFile != null)
return artifactFile;
@@ -54,8 +54,8 @@ public class AggregatedBundleRepository extends AbstractArtifactRepository imple
}
public boolean contains(IArtifactDescriptor descriptor) {
- for (Iterator it = bundleRepositories.iterator(); it.hasNext();) {
- IFileArtifactRepository repository = (IFileArtifactRepository) it.next();
+ for (Iterator<IFileArtifactRepository> it = bundleRepositories.iterator(); it.hasNext();) {
+ IFileArtifactRepository repository = it.next();
if (repository.contains(descriptor))
return true;
}
@@ -63,8 +63,8 @@ public class AggregatedBundleRepository extends AbstractArtifactRepository imple
}
public boolean contains(IArtifactKey key) {
- for (Iterator it = bundleRepositories.iterator(); it.hasNext();) {
- IFileArtifactRepository repository = (IFileArtifactRepository) it.next();
+ for (Iterator<IFileArtifactRepository> it = bundleRepositories.iterator(); it.hasNext();) {
+ IFileArtifactRepository repository = it.next();
if (repository.contains(key))
return true;
}
@@ -72,14 +72,14 @@ public class AggregatedBundleRepository extends AbstractArtifactRepository imple
}
public IArtifactDescriptor[] getArtifactDescriptors(IArtifactKey key) {
- Set artifactDescriptors = new HashSet();
- for (Iterator it = bundleRepositories.iterator(); it.hasNext();) {
- IFileArtifactRepository repository = (IFileArtifactRepository) it.next();
+ Set<IArtifactDescriptor> artifactDescriptors = new HashSet<IArtifactDescriptor>();
+ for (Iterator<IFileArtifactRepository> it = bundleRepositories.iterator(); it.hasNext();) {
+ IFileArtifactRepository repository = it.next();
IArtifactDescriptor[] descriptors = repository.getArtifactDescriptors(key);
if (descriptors != null)
artifactDescriptors.addAll(Arrays.asList(descriptors));
}
- return (IArtifactDescriptor[]) artifactDescriptors.toArray(new IArtifactDescriptor[artifactDescriptors.size()]);
+ return artifactDescriptors.toArray(new IArtifactDescriptor[artifactDescriptors.size()]);
}
public IStatus getArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) {
@@ -102,13 +102,25 @@ public class AggregatedBundleRepository extends AbstractArtifactRepository imple
* Exposed for testing and debugging purposes.
* @noreference This method is not intended to be referenced by clients.
*/
- public Collection testGetBundleRepositories() {
+ public Collection<IFileArtifactRepository> testGetBundleRepositories() {
return bundleRepositories;
}
- public IQueryResult query(IQuery query, IProgressMonitor monitor) {
+ public IQueryResult<IArtifactKey> query(IQuery<IArtifactKey> query, IProgressMonitor monitor) {
// Query all the all the repositories
- CompoundQueryable queryable = new CompoundQueryable((IQueryable[]) bundleRepositories.toArray(new IQueryable[bundleRepositories.size()]));
+ @SuppressWarnings("unchecked")
+ CompoundQueryable<IArtifactKey> queryable = new CompoundQueryable<IArtifactKey>(bundleRepositories.toArray(new IQueryable[bundleRepositories.size()]));
return queryable.query(query, monitor);
}
+
+ public IQueryable<IArtifactDescriptor> descriptorQueryable() {
+ int repoCount = bundleRepositories.size();
+ List<IQueryable<IArtifactDescriptor>> descQueryables = new ArrayList<IQueryable<IArtifactDescriptor>>(repoCount);
+ for (Iterator<IFileArtifactRepository> itor = bundleRepositories.iterator(); itor.hasNext();)
+ descQueryables.add(itor.next().descriptorQueryable());
+
+ @SuppressWarnings("unchecked")
+ IQueryable<IArtifactDescriptor> queryable = new CompoundQueryable<IArtifactDescriptor>(descQueryables.toArray(new IQueryable[repoCount]));
+ return queryable;
+ }
}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/EclipseMarkSetProvider.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/EclipseMarkSetProvider.java
index 63e9a1e4b..0727c2993 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/EclipseMarkSetProvider.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/EclipseMarkSetProvider.java
@@ -12,6 +12,7 @@ package org.eclipse.equinox.internal.p2.touchpoint.eclipse;
import java.io.File;
import java.util.*;
+import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils;
import org.eclipse.equinox.internal.p2.garbagecollector.MarkSet;
import org.eclipse.equinox.internal.p2.garbagecollector.MarkSetProvider;
import org.eclipse.equinox.internal.p2.update.*;
@@ -37,10 +38,10 @@ public class EclipseMarkSetProvider extends MarkSetProvider {
private static final String ARTIFACT_CLASSIFIER_OSGI_BUNDLE = "osgi.bundle"; //$NON-NLS-1$
private static final String ARTIFACT_CLASSIFIER_FEATURE = "org.eclipse.update.feature"; //$NON-NLS-1$
- private Collection artifactKeyList = null;
+ private Collection<IArtifactKey> artifactKeyList = null;
public MarkSet[] getMarkSets(IProvisioningAgent agent, IProfile inProfile) {
- artifactKeyList = new HashSet();
+ artifactKeyList = new HashSet<IArtifactKey>();
IArtifactRepository repositoryToGC = Util.getBundlePoolRepository(agent, inProfile);
if (repositoryToGC == null)
return new MarkSet[0];
@@ -50,14 +51,14 @@ public class EclipseMarkSetProvider extends MarkSetProvider {
addRunningBundles(repositoryToGC);
addRunningFeatures(inProfile, repositoryToGC);
}
- return new MarkSet[] {new MarkSet((IArtifactKey[]) artifactKeyList.toArray(new IArtifactKey[0]), repositoryToGC)};
+ return new MarkSet[] {new MarkSet(artifactKeyList.toArray(new IArtifactKey[artifactKeyList.size()]), repositoryToGC)};
}
private void addRunningFeatures(IProfile profile, IArtifactRepository repositoryToGC) {
try {
- List allFeatures = getAllFeatures(Configuration.load(new File(Util.getConfigurationFolder(profile), "org.eclipse.update/platform.xml"), null)); //$NON-NLS-1$
- for (Iterator iterator = allFeatures.iterator(); iterator.hasNext();) {
- Feature f = (Feature) iterator.next();
+ List<Feature> allFeatures = getAllFeatures(Configuration.load(new File(Util.getConfigurationFolder(profile), "org.eclipse.update/platform.xml"), null)); //$NON-NLS-1$
+ for (Iterator<Feature> iterator = allFeatures.iterator(); iterator.hasNext();) {
+ Feature f = iterator.next();
IArtifactKey match = searchArtifact(f.getId(), Version.create(f.getVersion()), ARTIFACT_CLASSIFIER_FEATURE, repositoryToGC);
if (match != null)
artifactKeyList.add(match);
@@ -67,13 +68,13 @@ public class EclipseMarkSetProvider extends MarkSetProvider {
}
}
- private List getAllFeatures(Configuration cfg) {
+ private List<Feature> getAllFeatures(Configuration cfg) {
if (cfg == null)
- return Collections.EMPTY_LIST;
- List sites = cfg.getSites();
- ArrayList result = new ArrayList();
- for (Iterator iterator = sites.iterator(); iterator.hasNext();) {
- Site object = (Site) iterator.next();
+ return CollectionUtils.emptyList();
+ List<Site> sites = cfg.getSites();
+ ArrayList<Feature> result = new ArrayList<Feature>();
+ for (Iterator<Site> iterator = sites.iterator(); iterator.hasNext();) {
+ Site object = iterator.next();
Feature[] features = object.getFeatures();
for (int i = 0; i < features.length; i++) {
result.add(features[i]);
@@ -94,14 +95,12 @@ public class EclipseMarkSetProvider extends MarkSetProvider {
}
private void addArtifactKeys(IProfile aProfile) {
- Iterator installableUnits = aProfile.query(InstallableUnitQuery.ANY, null).iterator();
+ Iterator<IInstallableUnit> installableUnits = aProfile.query(InstallableUnitQuery.ANY, null).iterator();
while (installableUnits.hasNext()) {
- IArtifactKey[] keys = ((IInstallableUnit) installableUnits.next()).getArtifacts();
+ List<IArtifactKey> keys = installableUnits.next().getArtifacts();
if (keys == null)
continue;
- for (int i = 0; i < keys.length; i++) {
- artifactKeyList.add(keys[i]);
- }
+ artifactKeyList.addAll(keys);
}
}
@@ -118,15 +117,15 @@ public class EclipseMarkSetProvider extends MarkSetProvider {
VersionRange range = searchedVersion != null ? new VersionRange(searchedVersion, true, searchedVersion, true) : null;
ArtifactKeyQuery query = new ArtifactKeyQuery(classifier, searchedId, range);
//TODO short-circuit the query when we find one?
- IQueryResult keys = repo.query(query, null);
+ IQueryResult<IArtifactKey> keys = repo.query(query, null);
if (!keys.isEmpty())
- return (IArtifactKey) keys.iterator().next();
+ return keys.iterator().next();
return null;
}
//Find for each bundle info a corresponding artifact in repo
- private ArrayList findCorrespondinArtifacts(BundleInfo[] bis, IArtifactRepository repo) {
- ArrayList toRetain = new ArrayList();
+ private List<IArtifactKey> findCorrespondinArtifacts(BundleInfo[] bis, IArtifactRepository repo) {
+ ArrayList<IArtifactKey> toRetain = new ArrayList<IArtifactKey>();
for (int i = 0; i < bis.length; i++) {
IArtifactKey match = searchArtifact(bis[i].getSymbolicName(), Version.create(bis[i].getVersion()), ARTIFACT_CLASSIFIER_OSGI_BUNDLE, repo);
if (match != null)
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/EclipseTouchpoint.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/EclipseTouchpoint.java
index 0da1efdf2..4d4723bb5 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/EclipseTouchpoint.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/EclipseTouchpoint.java
@@ -39,16 +39,16 @@ public class EclipseTouchpoint extends Touchpoint {
private static final Object PARM_AGENT = "agent"; //$NON-NLS-1$
private static final String NATIVE_TOUCHPOINT_ID = "org.eclipse.equinox.p2.touchpoint.natives"; //$NON-NLS-1$
- private static List NATIVE_ACTIONS = Arrays.asList(new String[] {"mkdir", "rmdir"}); //$NON-NLS-1$//$NON-NLS-2$
+ private static List<String> NATIVE_ACTIONS = Arrays.asList(new String[] {"mkdir", "rmdir"}); //$NON-NLS-1$//$NON-NLS-2$
private static final String VALIDATE_PROFILE = "org.eclipse.equinox.internal.p2.touchpoint.eclipse.validateProfile"; //$NON-NLS-1$
- private static Map manipulators = new WeakHashMap();
- private static Map wrappers = new WeakHashMap();
- private static Map sourceManipulators = new WeakHashMap();
- private static Map preparedIUs = new WeakHashMap();
+ private static Map<IProfile, LazyManipulator> manipulators = new WeakHashMap<IProfile, LazyManipulator>();
+ private static Map<IProfile, PlatformConfigurationWrapper> wrappers = new WeakHashMap<IProfile, PlatformConfigurationWrapper>();
+ private static Map<IProfile, SourceManipulator> sourceManipulators = new WeakHashMap<IProfile, SourceManipulator>();
+ private static Map<IProfile, Map<IInstallableUnit, IInstallableUnit>> preparedIUs = new WeakHashMap<IProfile, Map<IInstallableUnit, IInstallableUnit>>();
private static synchronized LazyManipulator getManipulator(IProvisioningAgent agent, IProfile profile) {
- LazyManipulator manipulator = (LazyManipulator) manipulators.get(profile);
+ LazyManipulator manipulator = manipulators.get(profile);
if (manipulator == null) {
manipulator = new LazyManipulator(agent, profile);
manipulators.put(profile, manipulator);
@@ -57,13 +57,13 @@ public class EclipseTouchpoint extends Touchpoint {
}
private static synchronized void saveManipulator(IProfile profile) throws FrameworkAdminRuntimeException, IOException {
- LazyManipulator manipulator = (LazyManipulator) manipulators.remove(profile);
+ LazyManipulator manipulator = manipulators.remove(profile);
if (manipulator != null)
manipulator.save(false);
}
private static synchronized PlatformConfigurationWrapper getPlatformConfigurationWrapper(IProvisioningAgent agent, IProfile profile, LazyManipulator manipulator) {
- PlatformConfigurationWrapper wrapper = (PlatformConfigurationWrapper) wrappers.get(profile);
+ PlatformConfigurationWrapper wrapper = wrappers.get(profile);
if (wrapper == null) {
File configLocation = Util.getConfigurationFolder(profile);
URI poolURI = Util.getBundlePoolLocation(agent, profile);
@@ -74,13 +74,13 @@ public class EclipseTouchpoint extends Touchpoint {
}
private static synchronized void savePlatformConfigurationWrapper(IProfile profile) throws ProvisionException {
- PlatformConfigurationWrapper wrapper = (PlatformConfigurationWrapper) wrappers.remove(profile);
+ PlatformConfigurationWrapper wrapper = wrappers.remove(profile);
if (wrapper != null)
wrapper.save();
}
private static synchronized SourceManipulator getSourceManipulator(IProfile profile) {
- SourceManipulator sourceManipulator = (SourceManipulator) sourceManipulators.get(profile);
+ SourceManipulator sourceManipulator = sourceManipulators.get(profile);
if (sourceManipulator == null) {
sourceManipulator = new SourceManipulator(profile);
sourceManipulators.put(profile, sourceManipulator);
@@ -89,23 +89,23 @@ public class EclipseTouchpoint extends Touchpoint {
}
private static synchronized void saveSourceManipulator(IProfile profile) throws IOException {
- SourceManipulator sourceManipulator = (SourceManipulator) sourceManipulators.remove(profile);
+ SourceManipulator sourceManipulator = sourceManipulators.remove(profile);
if (sourceManipulator != null)
sourceManipulator.save();
}
private static synchronized IInstallableUnit getPreparedIU(IProfile profile, IInstallableUnit iu) {
- Map preparedProfileIUs = (Map) preparedIUs.get(profile);
+ Map<IInstallableUnit, IInstallableUnit> preparedProfileIUs = preparedIUs.get(profile);
if (preparedProfileIUs == null)
return null;
- return (IInstallableUnit) preparedProfileIUs.get(iu);
+ return preparedProfileIUs.get(iu);
}
private static synchronized void savePreparedIU(IProfile profile, IInstallableUnit iu) {
- Map preparedProfileIUs = (Map) preparedIUs.get(profile);
+ Map<IInstallableUnit, IInstallableUnit> preparedProfileIUs = preparedIUs.get(profile);
if (preparedProfileIUs == null) {
- preparedProfileIUs = new HashMap();
+ preparedProfileIUs = new HashMap<IInstallableUnit, IInstallableUnit>();
preparedIUs.put(profile, preparedProfileIUs);
}
preparedProfileIUs.put(iu, iu);
@@ -169,7 +169,7 @@ public class EclipseTouchpoint extends Touchpoint {
return touchpointQualifier + "." + actionId; //$NON-NLS-1$
}
- public IStatus initializePhase(IProgressMonitor monitor, IProfile profile, String phaseId, Map touchpointParameters) {
+ public IStatus initializePhase(IProgressMonitor monitor, IProfile profile, String phaseId, Map<String, Object> touchpointParameters) {
IProvisioningAgent agent = (IProvisioningAgent) touchpointParameters.get(PARM_AGENT);
LazyManipulator manipulator = getManipulator(agent, profile);
touchpointParameters.put(PARM_MANIPULATOR, manipulator);
@@ -178,7 +178,7 @@ public class EclipseTouchpoint extends Touchpoint {
return null;
}
- public IStatus initializeOperand(IProfile profile, Operand operand, Map parameters) {
+ public IStatus initializeOperand(IProfile profile, Operand operand, Map<String, Object> parameters) {
IInstallableUnit iu = (IInstallableUnit) parameters.get(PARM_IU);
IArtifactKey artifactKey = (IArtifactKey) parameters.get(PARM_ARTIFACT);
IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT);
@@ -203,7 +203,7 @@ public class EclipseTouchpoint extends Touchpoint {
if (preparedIU != null)
return preparedIU;
- Class c = null;
+ Class<?> c = null;
try {
c = Class.forName("org.eclipse.equinox.p2.publisher.eclipse.BundlesAction"); //$NON-NLS-1$
if (c != null)
@@ -240,7 +240,7 @@ public class EclipseTouchpoint extends Touchpoint {
if (Boolean.FALSE.toString().equals(profile.getProperty(VALIDATE_PROFILE)))
return Status.OK_STATUS;
- Class c = null;
+ Class<?> c = null;
try {
c = Class.forName("org.eclipse.equinox.internal.provisional.p2.director.IPlanner"); //$NON-NLS-1$
} catch (ClassNotFoundException e) {
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/PlatformConfigurationWrapper.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/PlatformConfigurationWrapper.java
index 5dcf1ab92..94cbcb8bf 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/PlatformConfigurationWrapper.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/PlatformConfigurationWrapper.java
@@ -104,8 +104,8 @@ public class PlatformConfigurationWrapper {
* Otherwise the default is USER-EXCLUDE.
*/
private String getDefaultPolicy() {
- for (Iterator iter = configuration.getSites().iterator(); iter.hasNext();) {
- Site site = (Site) iter.next();
+ for (Iterator<Site> iter = configuration.getSites().iterator(); iter.hasNext();) {
+ Site site = iter.next();
if (Site.POLICY_MANAGED_ONLY.equals(site.getPolicy()))
return Site.POLICY_MANAGED_ONLY;
}
@@ -133,10 +133,10 @@ public class PlatformConfigurationWrapper {
* the given URL. Return null if there is no match.
*/
private Site getSite(URI url) {
- List sites = configuration.getSites();
+ List<Site> sites = configuration.getSites();
File file = URIUtil.toFile(url);
- for (Iterator iter = sites.iterator(); iter.hasNext();) {
- Site nextSite = (Site) iter.next();
+ for (Iterator<Site> iter = sites.iterator(); iter.hasNext();) {
+ Site nextSite = iter.next();
try {
File nextFile = URLUtil.toFile(new URL(nextSite.getUrl()));
if (nextFile == null)
@@ -155,9 +155,9 @@ public class PlatformConfigurationWrapper {
* with the given identifier and version. Return null if there is none.
*/
private Site getSite(String id, String version) {
- List sites = configuration.getSites();
- for (Iterator iter = sites.iterator(); iter.hasNext();) {
- Site site = (Site) iter.next();
+ List<Site> sites = configuration.getSites();
+ for (Iterator<Site> iter = sites.iterator(); iter.hasNext();) {
+ Site site = iter.next();
Feature[] features = site.getFeatures();
for (int i = 0; i < features.length; i++) {
if (id.equals(features[i].getId()) && version.equals(features[i].getVersion()))
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/SourceManipulator.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/SourceManipulator.java
index fae3e80ad..7522379dc 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/SourceManipulator.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/SourceManipulator.java
@@ -19,7 +19,7 @@ import org.eclipse.equinox.p2.engine.IProfile;
//This class deals with source bundles and how their addition to the source.info
public class SourceManipulator {
- private List sourceBundles;
+ private List<BundleInfo> sourceBundles;
private IProfile profile;
boolean changed = false;
private SimpleConfiguratorManipulatorImpl manipulator;
@@ -32,7 +32,7 @@ public class SourceManipulator {
public BundleInfo[] getBundles() throws IOException {
if (sourceBundles == null)
load();
- return (BundleInfo[]) sourceBundles.toArray(new BundleInfo[sourceBundles.size()]);
+ return sourceBundles.toArray(new BundleInfo[sourceBundles.size()]);
}
public void addBundle(File bundleFile, String bundleId, Version bundleVersion) throws IOException {
@@ -58,14 +58,14 @@ public class SourceManipulator {
public void save() throws IOException {
if (sourceBundles != null)
- manipulator.saveConfiguration((BundleInfo[]) sourceBundles.toArray(new BundleInfo[sourceBundles.size()]), getFileLocation(), getLauncherLocation());
+ manipulator.saveConfiguration(sourceBundles.toArray(new BundleInfo[sourceBundles.size()]), getFileLocation(), getLauncherLocation());
}
private void load() throws MalformedURLException, IOException {
if (getFileLocation().exists())
- sourceBundles = new ArrayList(Arrays.asList(manipulator.loadConfiguration(getFileLocation().toURL(), getLauncherLocation())));
+ sourceBundles = new ArrayList<BundleInfo>(Arrays.asList(manipulator.loadConfiguration(getFileLocation().toURL(), getLauncherLocation())));
else
- sourceBundles = new ArrayList();
+ sourceBundles = new ArrayList<BundleInfo>();
}
private File getFileLocation() {
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java
index 8014c3a9e..fa3ceb779 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java
@@ -86,7 +86,7 @@ public class Util {
}
try {
String repositoryName = Messages.BundlePool;
- Map properties = new HashMap(1);
+ Map<String, String> properties = new HashMap<String, String>(1);
properties.put(IRepository.PROP_SYSTEM, Boolean.TRUE.toString());
return (IFileArtifactRepository) manager.createRepository(location, repositoryName, REPOSITORY_TYPE, properties);
} catch (ProvisionException e) {
@@ -100,7 +100,7 @@ public class Util {
}
public static IFileArtifactRepository getAggregatedBundleRepository(IProvisioningAgent agent, IProfile profile, int repoFilter) {
- List bundleRepositories = new ArrayList();
+ List<IFileArtifactRepository> bundleRepositories = new ArrayList<IFileArtifactRepository>();
// we check for a shared bundle pool first as it should be preferred over the user bundle pool in a shared install
IArtifactRepositoryManager manager = getArtifactRepositoryManager(agent);
@@ -111,7 +111,7 @@ public class Util {
URI repoLocation = new File(sharedCache).toURI();
IArtifactRepository repository = manager.loadRepository(repoLocation, null);
if (repository != null && repository instanceof IFileArtifactRepository && !bundleRepositories.contains(repository))
- bundleRepositories.add(repository);
+ bundleRepositories.add((IFileArtifactRepository) repository);
} catch (ProvisionException e) {
//skip repository if it could not be read
}
@@ -125,10 +125,10 @@ public class Util {
}
if ((repoFilter & AGGREGATE_CACHE_EXTENSIONS) != 0) {
- List repos = getListProfileProperty(profile, CACHE_EXTENSIONS);
- for (Iterator iterator = repos.iterator(); iterator.hasNext();) {
+ List<String> repos = getListProfileProperty(profile, CACHE_EXTENSIONS);
+ for (Iterator<String> iterator = repos.iterator(); iterator.hasNext();) {
try {
- String repo = (String) iterator.next();
+ String repo = iterator.next();
URI repoLocation;
try {
repoLocation = new URI(repo);
@@ -138,7 +138,7 @@ public class Util {
}
IArtifactRepository repository = manager.loadRepository(repoLocation, null);
if (repository != null && repository instanceof IFileArtifactRepository && !bundleRepositories.contains(repository))
- bundleRepositories.add(repository);
+ bundleRepositories.add((IFileArtifactRepository) repository);
} catch (ProvisionException e) {
//skip repositories that could not be read
} catch (URISyntaxException e) {
@@ -150,8 +150,8 @@ public class Util {
return new AggregatedBundleRepository(bundleRepositories);
}
- private static List getListProfileProperty(IProfile profile, String key) {
- List listProperty = new ArrayList();
+ private static List<String> getListProfileProperty(IProfile profile, String key) {
+ List<String> listProperty = new ArrayList<String>();
String dropinRepositories = profile.getProperty(key);
if (dropinRepositories != null) {
StringTokenizer tokenizer = new StringTokenizer(dropinRepositories, PIPE);
@@ -169,20 +169,21 @@ public class Util {
bundleInfo.setManifest(manifest);
try {
- Map headers = ManifestElement.parseBundleManifest(new ByteArrayInputStream(manifest.getBytes("UTF-8")), new HashMap()); //$NON-NLS-1$
- ManifestElement[] element = ManifestElement.parseHeader("bsn", (String) headers.get(Constants.BUNDLE_SYMBOLICNAME)); //$NON-NLS-1$
+ @SuppressWarnings("unchecked")
+ Map<String, String> headers = ManifestElement.parseBundleManifest(new ByteArrayInputStream(manifest.getBytes("UTF-8")), new HashMap<String, String>()); //$NON-NLS-1$
+ ManifestElement[] element = ManifestElement.parseHeader("bsn", headers.get(Constants.BUNDLE_SYMBOLICNAME)); //$NON-NLS-1$
if (element == null || element.length == 0)
return null;
bundleInfo.setSymbolicName(element[0].getValue());
- String version = (String) headers.get(Constants.BUNDLE_VERSION);
+ String version = headers.get(Constants.BUNDLE_VERSION);
if (version == null)
return null;
// convert to a Version object first to ensure we are consistent with our version number w.r.t.
// padding zeros at the end
bundleInfo.setVersion(Version.parseVersion(version).toString());
- String fragmentHost = (String) headers.get(Constants.FRAGMENT_HOST);
+ String fragmentHost = headers.get(Constants.FRAGMENT_HOST);
if (fragmentHost != null)
bundleInfo.setFragmentHost(fragmentHost.trim());
@@ -300,9 +301,9 @@ public class Util {
return null;
}
- public static String getManifest(ITouchpointData[] data) {
- for (int i = 0; i < data.length; i++) {
- ITouchpointInstruction manifestInstruction = data[i].getInstruction("manifest"); //$NON-NLS-1$
+ public static String getManifest(List<ITouchpointData> data) {
+ for (int i = 0; i < data.size(); i++) {
+ ITouchpointInstruction manifestInstruction = data.get(i).getInstruction("manifest"); //$NON-NLS-1$
if (manifestInstruction == null)
return null;
String manifest = manifestInstruction.getBody();
@@ -325,7 +326,7 @@ public class Util {
return launcherConfig == null ? null : new File(launcherConfig);
}
- public static String resolveArtifactParam(Map parameters) throws CoreException {
+ public static String resolveArtifactParam(Map<String, Object> parameters) throws CoreException {
String artifactLocation = (String) parameters.get(EclipseTouchpoint.PARM_ARTIFACT_LOCATION);
if (artifactLocation != null)
return artifactLocation;
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddJVMArgumentAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddJVMArgumentAction.java
index 9855bb7a5..9268549a8 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddJVMArgumentAction.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddJVMArgumentAction.java
@@ -27,14 +27,14 @@ public class AddJVMArgumentAction extends ProvisioningAction {
protected static final String XX_MAX_PERM_SIZE = "-XX:MaxPermSize="; //$NON-NLS-1$
protected static final String PREFIX_USER_VALUE = "eclipse.userDefined:"; //$NON-NLS-1$
- public IStatus execute(Map parameters) {
+ public IStatus execute(Map<String, Object> parameters) {
String jvmArg = (String) parameters.get(ActionConstants.PARM_JVM_ARG);
if (jvmArg == null)
return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_JVM_ARG, ID));
return addArg(jvmArg, parameters);
}
- public IStatus undo(Map parameters) {
+ public IStatus undo(Map<String, Object> parameters) {
String jvmArg = (String) parameters.get(ActionConstants.PARM_JVM_ARG);
if (jvmArg == null)
return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_JVM_ARG, ID));
@@ -45,7 +45,7 @@ public class AddJVMArgumentAction extends ProvisioningAction {
return storedValues.getProperty(PREFIX_USER_VALUE + flag);
}
- protected static IStatus addArg(String arg, Map parameters) {
+ protected static IStatus addArg(String arg, Map<String, Object> parameters) {
LauncherData launcherData = ((Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR)).getLauncherData();
File storageArea = (File) parameters.get(ActionConstants.PARM_PROFILE_DATA_DIRECTORY);
try {
@@ -215,7 +215,7 @@ public class AddJVMArgumentAction extends ProvisioningAction {
if (argString == null || argString.length() == 0)
return new String[0];
- List list = new ArrayList();
+ List<String> list = new ArrayList<String>();
int i = 0;
String arg = ""; //$NON-NLS-1$
@@ -230,10 +230,7 @@ public class AddJVMArgumentAction extends ProvisioningAction {
}
list.add(arg);
- String[] argList = new String[list.size()];
- list.toArray(argList);
-
- return argList;
+ return list.toArray(new String[list.size()]);
}
// Store a single user argument, null removes stored values
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddProgramArgumentAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddProgramArgumentAction.java
index 913fa0132..b44806f9d 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddProgramArgumentAction.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddProgramArgumentAction.java
@@ -21,7 +21,7 @@ import org.eclipse.osgi.util.NLS;
public class AddProgramArgumentAction extends ProvisioningAction {
public static final String ID = "addProgramArg"; //$NON-NLS-1$
- public IStatus execute(Map parameters) {
+ public IStatus execute(Map<String, Object> parameters) {
Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR);
String programArg = (String) parameters.get(ActionConstants.PARM_PROGRAM_ARG);
if (programArg == null)
@@ -54,7 +54,7 @@ public class AddProgramArgumentAction extends ProvisioningAction {
return Status.OK_STATUS;
}
- public IStatus undo(Map parameters) {
+ public IStatus undo(Map<String, Object> parameters) {
Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR);
String programArg = (String) parameters.get(ActionConstants.PARM_PROGRAM_ARG);
if (programArg == null)
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddRepositoryAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddRepositoryAction.java
index e64266ede..2a05a1c2c 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddRepositoryAction.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddRepositoryAction.java
@@ -24,7 +24,7 @@ import org.eclipse.equinox.p2.engine.IProfileRegistry;
public class AddRepositoryAction extends RepositoryAction {
public static final String ID = "addRepository"; //$NON-NLS-1$
- public IStatus execute(Map parameters) {
+ public IStatus execute(Map<String, Object> parameters) {
try {
IProvisioningAgent agent = getAgent(parameters);
IProfileRegistry registry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME);
@@ -46,7 +46,7 @@ public class AddRepositoryAction extends RepositoryAction {
return ID;
}
- public IStatus undo(Map parameters) {
+ public IStatus undo(Map<String, Object> parameters) {
try {
IProvisioningAgent agent = getAgent(parameters);
IProfileRegistry registry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME);
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddSourceBundleAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddSourceBundleAction.java
index 5815e72a2..771b8ef98 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddSourceBundleAction.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddSourceBundleAction.java
@@ -10,6 +10,7 @@ package org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions;
import java.io.File;
import java.io.IOException;
+import java.util.List;
import java.util.Map;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
@@ -24,15 +25,15 @@ import org.eclipse.osgi.util.NLS;
public class AddSourceBundleAction extends ProvisioningAction {
public static final String ID = "addSourceBundle"; //$NON-NLS-1$
- public IStatus execute(Map parameters) {
+ public IStatus execute(Map<String, Object> parameters) {
return AddSourceBundleAction.addSourceBundle(parameters);
}
- public IStatus undo(Map parameters) {
+ public IStatus undo(Map<String, Object> parameters) {
return RemoveSourceBundleAction.removeSourceBundle(parameters);
}
- public static IStatus addSourceBundle(Map parameters) {
+ public static IStatus addSourceBundle(Map<String, Object> parameters) {
IProvisioningAgent agent = (IProvisioningAgent) parameters.get(ActionConstants.PARM_AGENT);
IProfile profile = (IProfile) parameters.get(ActionConstants.PARM_PROFILE);
IInstallableUnit iu = (IInstallableUnit) parameters.get(EclipseTouchpoint.PARM_IU);
@@ -41,14 +42,15 @@ public class AddSourceBundleAction extends ProvisioningAction {
if (bundleId == null)
return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_BUNDLE, ID));
- IArtifactKey[] artifacts = iu.getArtifacts();
- if (artifacts == null || artifacts.length == 0)
+ List<IArtifactKey> artifacts = iu.getArtifacts();
+ if (artifacts == null || artifacts.size() == 0)
return Util.createError(NLS.bind(Messages.iu_contains_no_arifacts, iu));
IArtifactKey artifactKey = null;
- for (int i = 0; i < artifacts.length; i++) {
- if (artifacts[i].toString().equals(bundleId)) {
- artifactKey = artifacts[i];
+ for (int i = 0; i < artifacts.size(); i++) {
+ IArtifactKey candidate = artifacts.get(i);
+ if (candidate.toString().equals(bundleId)) {
+ artifactKey = candidate;
break;
}
}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/CheckTrustAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/CheckTrustAction.java
index d1768ff9c..e96b3fc38 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/CheckTrustAction.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/CheckTrustAction.java
@@ -11,8 +11,7 @@
package org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions;
import java.io.File;
-import java.util.Collection;
-import java.util.Map;
+import java.util.*;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.equinox.internal.p2.touchpoint.eclipse.EclipseTouchpoint;
@@ -35,7 +34,7 @@ public class CheckTrustAction extends ProvisioningAction {
/* (non-Javadoc)
* @see org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningAction#execute(java.util.Map)
*/
- public IStatus execute(Map parameters) {
+ public IStatus execute(Map<String, Object> parameters) {
IInstallableUnit iu = (IInstallableUnit) parameters.get(EclipseTouchpoint.PARM_IU);
if (iu == null)
return null;
@@ -44,12 +43,13 @@ public class CheckTrustAction extends ProvisioningAction {
//if the IU is already in the profile there is nothing to do
if (!profile.available(new InstallableUnitQuery(iu), null).isEmpty())
return null;
- Collection bundleFiles = (Collection) parameters.get(ActionConstants.PARM_ARTIFACT_FILES);
- IArtifactKey[] artifacts = iu.getArtifacts();
+ @SuppressWarnings("unchecked")
+ Collection<File> bundleFiles = (Collection<File>) parameters.get(ActionConstants.PARM_ARTIFACT_FILES);
+ List<IArtifactKey> artifacts = iu.getArtifacts();
if (artifacts == null)
return null;
- for (int i = 0; i < artifacts.length; i++) {
- File bundleFile = Util.getArtifactFile(agent, artifacts[i], profile);
+ for (int i = 0; i < artifacts.size(); i++) {
+ File bundleFile = Util.getArtifactFile(agent, artifacts.get(i), profile);
if (!bundleFiles.contains(bundleFile))
bundleFiles.add(bundleFile);
}
@@ -59,7 +59,7 @@ public class CheckTrustAction extends ProvisioningAction {
/* (non-Javadoc)
* @see org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningAction#undo(java.util.Map)
*/
- public IStatus undo(Map parameters) {
+ public IStatus undo(Map<String, Object> parameters) {
return Status.OK_STATUS;
}
}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/ChmodAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/ChmodAction.java
index c5bab23df..bc1d51d80 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/ChmodAction.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/ChmodAction.java
@@ -25,7 +25,7 @@ import org.eclipse.osgi.util.NLS;
public class ChmodAction extends ProvisioningAction {
private static final String ACTION_CHMOD = "chmod"; //$NON-NLS-1$
- public IStatus execute(Map parameters) {
+ public IStatus execute(Map<String, Object> parameters) {
String targetDir = (String) parameters.get(ActionConstants.PARM_TARGET_DIR);
if (targetDir == null)
return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_TARGET_DIR, ACTION_CHMOD));
@@ -57,7 +57,7 @@ public class ChmodAction extends ProvisioningAction {
String options[] = null;
if (optionsString != null) {
- ArrayList collect = new ArrayList();
+ ArrayList<String> collect = new ArrayList<String>();
String r = optionsString.trim();
while (r.length() > 0) {
int spaceIdx = r.indexOf(' ');
@@ -71,8 +71,7 @@ public class ChmodAction extends ProvisioningAction {
}
}
if (collect.size() > 0) {
- options = new String[collect.size()];
- collect.toArray(options);
+ options = collect.toArray(new String[collect.size()]);
}
}
@@ -80,7 +79,7 @@ public class ChmodAction extends ProvisioningAction {
return Status.OK_STATUS;
}
- public IStatus undo(Map parameters) {
+ public IStatus undo(Map<String, Object> parameters) {
//TODO: implement undo ??
return Status.OK_STATUS;
}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/CollectAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/CollectAction.java
index 13693fdc5..7d3fa0ca9 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/CollectAction.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/CollectAction.java
@@ -27,7 +27,7 @@ public class CollectAction extends ProvisioningAction {
public static final String ID = "collect"; //$NON-NLS-1$
public static final String ARTIFACT_FOLDER = "artifact.folder"; //$NON-NLS-1$
- public IStatus execute(Map parameters) {
+ public IStatus execute(Map<String, Object> parameters) {
IProvisioningAgent agent = (IProvisioningAgent) parameters.get(ActionConstants.PARM_AGENT);
IProfile profile = (IProfile) parameters.get(ActionConstants.PARM_PROFILE);
InstallableUnitOperand operand = (InstallableUnitOperand) parameters.get(ActionConstants.PARM_OPERAND);
@@ -38,39 +38,40 @@ public class CollectAction extends ProvisioningAction {
return e.getStatus();
}
- Collection artifactRequests = (Collection) parameters.get(ActionConstants.PARM_ARTIFACT_REQUESTS);
+ @SuppressWarnings("unchecked")
+ Collection<IArtifactRequest[]> artifactRequests = (Collection<IArtifactRequest[]>) parameters.get(ActionConstants.PARM_ARTIFACT_REQUESTS);
artifactRequests.add(requests);
return Status.OK_STATUS;
}
- public IStatus undo(Map parameters) {
+ public IStatus undo(Map<String, Object> parameters) {
// nothing to do for now
return Status.OK_STATUS;
}
- public static boolean isZipped(ITouchpointData[] data) {
- if (data == null || data.length == 0)
+ public static boolean isZipped(List<ITouchpointData> data) {
+ if (data == null || data.size() == 0)
return false;
- for (int i = 0; i < data.length; i++) {
- if (data[i].getInstruction("zipped") != null) //$NON-NLS-1$
+ for (int i = 0; i < data.size(); i++) {
+ if (data.get(i).getInstruction("zipped") != null) //$NON-NLS-1$
return true;
}
return false;
}
- public static Properties createArtifactDescriptorProperties(IInstallableUnit installableUnit) {
- Properties descriptorProperties = null;
+ public static Map<String, String> createArtifactDescriptorProperties(IInstallableUnit installableUnit) {
+ Map<String, String> descriptorProperties = null;
if (CollectAction.isZipped(installableUnit.getTouchpointData())) {
- descriptorProperties = new Properties();
- descriptorProperties.setProperty(CollectAction.ARTIFACT_FOLDER, Boolean.TRUE.toString());
+ descriptorProperties = new HashMap<String, String>();
+ descriptorProperties.put(CollectAction.ARTIFACT_FOLDER, Boolean.TRUE.toString());
}
return descriptorProperties;
}
// TODO: Here we may want to consult multiple caches
static IArtifactRequest[] collect(IProvisioningAgent agent, IProfile profile, IInstallableUnit installableUnit) throws ProvisionException {
- IArtifactKey[] toDownload = installableUnit.getArtifacts();
- if (toDownload == null || toDownload.length == 0)
+ List<IArtifactKey> toDownload = installableUnit.getArtifacts();
+ if (toDownload == null || toDownload.size() == 0)
return IArtifactRepositoryManager.NO_ARTIFACT_REQUEST;
IArtifactRepository aggregatedRepositoryView = Util.getAggregatedBundleRepository(agent, profile);
@@ -78,11 +79,11 @@ public class CollectAction extends ProvisioningAction {
if (bundlePool == null)
throw new ProvisionException(Util.createError(NLS.bind(Messages.no_bundle_pool, profile.getProfileId())));
- List requests = new ArrayList();
- for (int i = 0; i < toDownload.length; i++) {
- IArtifactKey key = toDownload[i];
+ List<IArtifactRequest> requests = new ArrayList<IArtifactRequest>();
+ for (int i = 0; i < toDownload.size(); i++) {
+ IArtifactKey key = toDownload.get(i);
if (!aggregatedRepositoryView.contains(key)) {
- Properties repositoryProperties = CollectAction.createArtifactDescriptorProperties(installableUnit);
+ Map<String, String> repositoryProperties = CollectAction.createArtifactDescriptorProperties(installableUnit);
requests.add(Util.getArtifactRepositoryManager(agent).createMirrorRequest(key, bundlePool, null, repositoryProperties));
}
}
@@ -90,7 +91,7 @@ public class CollectAction extends ProvisioningAction {
if (requests.isEmpty())
return IArtifactRepositoryManager.NO_ARTIFACT_REQUEST;
- IArtifactRequest[] result = (IArtifactRequest[]) requests.toArray(new IArtifactRequest[requests.size()]);
+ IArtifactRequest[] result = requests.toArray(new IArtifactRequest[requests.size()]);
return result;
}
} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/InstallBundleAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/InstallBundleAction.java
index 909f83902..62a298c0f 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/InstallBundleAction.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/InstallBundleAction.java
@@ -9,6 +9,7 @@
package org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions;
import java.io.File;
+import java.util.List;
import java.util.Map;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
@@ -27,15 +28,15 @@ import org.eclipse.osgi.util.NLS;
public class InstallBundleAction extends ProvisioningAction {
public static final String ID = "installBundle"; //$NON-NLS-1$
- public IStatus execute(Map parameters) {
+ public IStatus execute(Map<String, Object> parameters) {
return InstallBundleAction.installBundle(parameters);
}
- public IStatus undo(Map parameters) {
+ public IStatus undo(Map<String, Object> parameters) {
return UninstallBundleAction.uninstallBundle(parameters);
}
- public static IStatus installBundle(Map parameters) {
+ public static IStatus installBundle(Map<String, Object> parameters) {
IProvisioningAgent agent = (IProvisioningAgent) parameters.get(ActionConstants.PARM_AGENT);
IProfile profile = (IProfile) parameters.get(ActionConstants.PARM_PROFILE);
IInstallableUnit iu = (IInstallableUnit) parameters.get(EclipseTouchpoint.PARM_IU);
@@ -50,14 +51,15 @@ public class InstallBundleAction extends ProvisioningAction {
return Status.OK_STATUS;
}
- IArtifactKey[] artifacts = iu.getArtifacts();
- if (artifacts == null || artifacts.length == 0)
+ List<IArtifactKey> artifacts = iu.getArtifacts();
+ if (artifacts == null || artifacts.isEmpty())
return Util.createError(NLS.bind(Messages.iu_contains_no_arifacts, iu));
IArtifactKey artifactKey = null;
- for (int i = 0; i < artifacts.length; i++) {
- if (artifacts[i].toString().equals(bundleId)) {
- artifactKey = artifacts[i];
+ for (int i = 0; i < artifacts.size(); i++) {
+ IArtifactKey candidate = artifacts.get(i);
+ if (candidate.toString().equals(bundleId)) {
+ artifactKey = candidate;
break;
}
}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/InstallFeatureAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/InstallFeatureAction.java
index 4524b971b..9ccf40908 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/InstallFeatureAction.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/InstallFeatureAction.java
@@ -9,6 +9,7 @@
package org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions;
import java.io.File;
+import java.util.List;
import java.util.Map;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.equinox.internal.p2.touchpoint.eclipse.*;
@@ -26,29 +27,30 @@ public class InstallFeatureAction extends ProvisioningAction {
private static final String UPDATE_FEATURE_PLUGIN_PROP = "org.eclipse.update.feature.plugin"; //$NON-NLS-1$
private static final String UPDATE_FEATURE_PRIMARY_PROP = "org.eclipse.update.feature.primary"; //$NON-NLS-1$
- public IStatus execute(Map parameters) {
+ public IStatus execute(Map<String, Object> parameters) {
return InstallFeatureAction.installFeature(parameters);
}
- public IStatus undo(Map parameters) {
+ public IStatus undo(Map<String, Object> parameters) {
return UninstallFeatureAction.uninstallFeature(parameters);
}
- public static IStatus installFeature(Map parameters) {
+ public static IStatus installFeature(Map<String, Object> parameters) {
IInstallableUnit iu = (IInstallableUnit) parameters.get(EclipseTouchpoint.PARM_IU);
PlatformConfigurationWrapper configuration = (PlatformConfigurationWrapper) parameters.get(EclipseTouchpoint.PARM_PLATFORM_CONFIGURATION);
String feature = (String) parameters.get(ActionConstants.PARM_FEATURE);
String featureId = (String) parameters.get(ActionConstants.PARM_FEATURE_ID);
String featureVersion = (String) parameters.get(ActionConstants.PARM_FEATURE_VERSION);
- IArtifactKey[] artifacts = iu.getArtifacts();
- if (artifacts == null || artifacts.length == 0)
+ List<IArtifactKey> artifacts = iu.getArtifacts();
+ if (artifacts == null || artifacts.isEmpty())
return Util.createError(NLS.bind(Messages.iu_contains_no_arifacts, iu));
IArtifactKey artifactKey = null;
- for (int i = 0; i < artifacts.length; i++) {
- if (artifacts[i].toString().equals(feature)) {
- artifactKey = artifacts[i];
+ for (int i = 0; i < artifacts.size(); i++) {
+ IArtifactKey candidate = artifacts.get(i);
+ if (candidate.toString().equals(feature)) {
+ artifactKey = candidate;
break;
}
}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/LinkAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/LinkAction.java
index 1cf493b3e..708d8bf69 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/LinkAction.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/LinkAction.java
@@ -22,7 +22,7 @@ import org.eclipse.osgi.util.NLS;
public class LinkAction extends ProvisioningAction {
public static final String ID = "ln"; //$NON-NLS-1$
- public IStatus execute(Map parameters) {
+ public IStatus execute(Map<String, Object> parameters) {
String targetDir = (String) parameters.get(ActionConstants.PARM_TARGET_DIR);
if (targetDir == null)
return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_TARGET_DIR, ID));
@@ -53,7 +53,7 @@ public class LinkAction extends ProvisioningAction {
return Status.OK_STATUS;
}
- public IStatus undo(Map parameters) {
+ public IStatus undo(Map<String, Object> parameters) {
return null;
}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/MarkStartedAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/MarkStartedAction.java
index 6cb4d75a8..71720fb57 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/MarkStartedAction.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/MarkStartedAction.java
@@ -11,6 +11,7 @@
package org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions;
import java.io.File;
+import java.util.List;
import java.util.Map;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
@@ -28,7 +29,7 @@ import org.eclipse.osgi.util.NLS;
public class MarkStartedAction extends ProvisioningAction {
public static final String ID = "markStarted"; //$NON-NLS-1$
- public IStatus execute(Map parameters) {
+ public IStatus execute(Map<String, Object> parameters) {
IProvisioningAgent agent = (IProvisioningAgent) parameters.get(ActionConstants.PARM_AGENT);
IProfile profile = (IProfile) parameters.get(ActionConstants.PARM_PROFILE);
Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR);
@@ -37,11 +38,11 @@ public class MarkStartedAction extends ProvisioningAction {
if (started == null)
return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_STARTED, ID));
- IArtifactKey[] artifacts = iu.getArtifacts();
- if (artifacts == null || artifacts.length == 0)
+ List<IArtifactKey> artifacts = iu.getArtifacts();
+ if (artifacts == null || artifacts.size() == 0)
return Util.createError(NLS.bind(Messages.iu_contains_no_arifacts, iu));
- IArtifactKey artifactKey = artifacts[0];
+ IArtifactKey artifactKey = artifacts.get(0);
// the bundleFile might be null here, that's OK.
File bundleFile = Util.getArtifactFile(agent, artifactKey, profile);
@@ -68,7 +69,7 @@ public class MarkStartedAction extends ProvisioningAction {
return Status.OK_STATUS;
}
- public IStatus undo(Map parameters) {
+ public IStatus undo(Map<String, Object> parameters) {
IProvisioningAgent agent = (IProvisioningAgent) parameters.get(ActionConstants.PARM_AGENT);
Boolean previousStarted = (Boolean) getMemento().get(ActionConstants.PARM_PREVIOUS_STARTED);
if (previousStarted == null)
@@ -78,11 +79,11 @@ public class MarkStartedAction extends ProvisioningAction {
Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR);
IInstallableUnit iu = (IInstallableUnit) parameters.get(EclipseTouchpoint.PARM_IU);
- IArtifactKey[] artifacts = iu.getArtifacts();
- if (artifacts == null || artifacts.length == 0)
+ List<IArtifactKey> artifacts = iu.getArtifacts();
+ if (artifacts == null || artifacts.isEmpty())
return Util.createError(NLS.bind(Messages.iu_contains_no_arifacts, iu));
- IArtifactKey artifactKey = artifacts[0];
+ IArtifactKey artifactKey = artifacts.get(0);
// the bundleFile might be null here, that's OK.
File bundleFile = Util.getArtifactFile(agent, artifactKey, profile);
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveJVMArgumentAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveJVMArgumentAction.java
index 9ebd394dd..10d00d6ad 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveJVMArgumentAction.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveJVMArgumentAction.java
@@ -23,7 +23,7 @@ import org.eclipse.osgi.util.NLS;
public class RemoveJVMArgumentAction extends ProvisioningAction {
public static final String ID = "removeJvmArg"; //$NON-NLS-1$
- public IStatus execute(Map parameters) {
+ public IStatus execute(Map<String, Object> parameters) {
String jvmArg = (String) parameters.get(ActionConstants.PARM_JVM_ARG);
if (jvmArg == null)
return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_JVM_ARG, ID));
@@ -31,7 +31,7 @@ public class RemoveJVMArgumentAction extends ProvisioningAction {
return Status.OK_STATUS;
}
- public IStatus undo(Map parameters) {
+ public IStatus undo(Map<String, Object> parameters) {
String jvmArg = (String) parameters.get(ActionConstants.PARM_JVM_ARG);
if (jvmArg == null)
return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_JVM_ARG, ID));
@@ -39,7 +39,7 @@ public class RemoveJVMArgumentAction extends ProvisioningAction {
return Status.OK_STATUS;
}
- public static IStatus removeArg(String arg, Map parameters) {
+ public static IStatus removeArg(String arg, Map<String, Object> parameters) {
LauncherData launcherData = ((Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR)).getLauncherData();
File storageArea = (File) parameters.get(ActionConstants.PARM_PROFILE_DATA_DIRECTORY);
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveProgramArgumentAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveProgramArgumentAction.java
index b6a890015..e61c38692 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveProgramArgumentAction.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveProgramArgumentAction.java
@@ -23,14 +23,14 @@ public class RemoveProgramArgumentAction extends ProvisioningAction {
public static final String ID = "removeProgramArg"; //$NON-NLS-1$
public static final String EMPTY_ARGUMENT = ""; //$NON-NLS-1$
- public IStatus execute(Map parameters) {
+ public IStatus execute(Map<String, Object> parameters) {
Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR);
String programArg = (String) parameters.get(ActionConstants.PARM_PROGRAM_ARG);
if (programArg == null)
return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PROGRAM_ARG, ID));
if (programArg.startsWith("-")) {//$NON-NLS-1$
- List programArgs = Arrays.asList(manipulator.getLauncherData().getProgramArgs());
+ List<String> programArgs = Arrays.asList(manipulator.getLauncherData().getProgramArgs());
int index = programArgs.indexOf(programArg);
if (index == -1)
@@ -38,7 +38,7 @@ public class RemoveProgramArgumentAction extends ProvisioningAction {
index++; // move index to potential programArgValue
if (programArgs.size() > index) {
- String programArgValue = (String) programArgs.get(index);
+ String programArgValue = programArgs.get(index);
if (!programArgValue.startsWith("-")) //$NON-NLS-1$
getMemento().put(ActionConstants.PARM_PROGRAM_ARG_VALUE, programArgValue);
}
@@ -48,7 +48,7 @@ public class RemoveProgramArgumentAction extends ProvisioningAction {
return Status.OK_STATUS;
}
- public IStatus undo(Map parameters) {
+ public IStatus undo(Map<String, Object> parameters) {
Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR);
String programArg = (String) parameters.get(ActionConstants.PARM_PROGRAM_ARG);
if (programArg == null)
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveRepositoryAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveRepositoryAction.java
index e7c7e2a08..b1d388932 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveRepositoryAction.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveRepositoryAction.java
@@ -24,7 +24,7 @@ import org.eclipse.equinox.p2.engine.IProfileRegistry;
public class RemoveRepositoryAction extends RepositoryAction {
public static final String ID = "removeRepository"; //$NON-NLS-1$
- public IStatus execute(Map parameters) {
+ public IStatus execute(Map<String, Object> parameters) {
try {
IProvisioningAgent agent = getAgent(parameters);
IProfileRegistry registry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME);
@@ -42,7 +42,7 @@ public class RemoveRepositoryAction extends RepositoryAction {
return Status.OK_STATUS;
}
- public IStatus undo(Map parameters) {
+ public IStatus undo(Map<String, Object> parameters) {
try {
IProvisioningAgent agent = getAgent(parameters);
IProfileRegistry registry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME);
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveSourceBundleAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveSourceBundleAction.java
index 5b8418488..4e8c3dd66 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveSourceBundleAction.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveSourceBundleAction.java
@@ -10,6 +10,7 @@ package org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions;
import java.io.File;
import java.io.IOException;
+import java.util.List;
import java.util.Map;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
@@ -24,15 +25,15 @@ import org.eclipse.osgi.util.NLS;
public class RemoveSourceBundleAction extends ProvisioningAction {
public static final String ID = "removeSourceBundle"; //$NON-NLS-1$
- public IStatus execute(Map parameters) {
+ public IStatus execute(Map<String, Object> parameters) {
return RemoveSourceBundleAction.removeSourceBundle(parameters);
}
- public IStatus undo(Map parameters) {
+ public IStatus undo(Map<String, Object> parameters) {
return AddSourceBundleAction.addSourceBundle(parameters);
}
- public static IStatus removeSourceBundle(Map parameters) {
+ public static IStatus removeSourceBundle(Map<String, Object> parameters) {
IProvisioningAgent agent = (IProvisioningAgent) parameters.get(ActionConstants.PARM_AGENT);
IProfile profile = (IProfile) parameters.get(ActionConstants.PARM_PROFILE);
IInstallableUnit iu = (IInstallableUnit) parameters.get(EclipseTouchpoint.PARM_IU);
@@ -41,14 +42,15 @@ public class RemoveSourceBundleAction extends ProvisioningAction {
if (bundleId == null)
return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_BUNDLE, ID));
- IArtifactKey[] artifacts = iu.getArtifacts();
- if (artifacts == null || artifacts.length == 0)
+ List<IArtifactKey> artifacts = iu.getArtifacts();
+ if (artifacts == null || artifacts.isEmpty())
return Util.createError(NLS.bind(Messages.iu_contains_no_arifacts, iu));
IArtifactKey artifactKey = null;
- for (int i = 0; i < artifacts.length; i++) {
- if (artifacts[i].toString().equals(bundleId)) {
- artifactKey = artifacts[i];
+ for (int i = 0; i < artifacts.size(); i++) {
+ IArtifactKey candidate = artifacts.get(i);
+ if (candidate.toString().equals(bundleId)) {
+ artifactKey = candidate;
break;
}
}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RepositoryAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RepositoryAction.java
index 33ee6be77..38defc24c 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RepositoryAction.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RepositoryAction.java
@@ -53,11 +53,11 @@ abstract class RepositoryAction extends ProvisioningAction {
* Returns the repository manager of the given type, or <code>null</code>
* if not available.
*/
- private static IRepositoryManager getRepositoryManager(int type) {
+ private static IRepositoryManager<?> getRepositoryManager(int type) {
if (type == IRepository.TYPE_METADATA) {
- return (IRepositoryManager) ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.SERVICE_NAME);
+ return (IRepositoryManager<?>) ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.SERVICE_NAME);
} else if (type == IRepository.TYPE_ARTIFACT) {
- return (IRepositoryManager) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.SERVICE_NAME);
+ return (IRepositoryManager<?>) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.SERVICE_NAME);
}
return null;
}
@@ -93,7 +93,7 @@ abstract class RepositoryAction extends ProvisioningAction {
* Adds the repository corresponding to the given event to the currently running instance.
*/
protected void addToSelf(IAgentLocation agentLocation, RepositoryEvent event) {
- IRepositoryManager manager = getRepositoryManager(event.getRepositoryType());
+ IRepositoryManager<?> manager = getRepositoryManager(event.getRepositoryType());
final URI location = event.getRepositoryLocation();
Preferences node = getRepositoryPreferenceNode(agentLocation, null, location, event.getRepositoryType());
@@ -117,7 +117,7 @@ abstract class RepositoryAction extends ProvisioningAction {
manager.setRepositoryProperty(location, IRepository.PROP_NICKNAME, name);
}
- protected RepositoryEvent createEvent(Map parameters) throws CoreException {
+ protected RepositoryEvent createEvent(Map<String, Object> parameters) throws CoreException {
String parm = (String) parameters.get(ActionConstants.PARM_REPOSITORY_LOCATION);
if (parm == null)
throw new CoreException(Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_REPOSITORY_LOCATION, getId())));
@@ -169,7 +169,7 @@ abstract class RepositoryAction extends ProvisioningAction {
* Removes the repository corresponding to the given event from the currently running instance.
*/
protected void removeFromSelf(IAgentLocation agentLocation, RepositoryEvent event) {
- IRepositoryManager manager = getRepositoryManager(event.getRepositoryType());
+ IRepositoryManager<?> manager = getRepositoryManager(event.getRepositoryType());
Preferences node = getRepositoryPreferenceNode(agentLocation, null, event.getRepositoryLocation(), event.getRepositoryType());
int count = getRepositoryCount(node);
if (--count < 1 && manager != null)
@@ -253,7 +253,7 @@ abstract class RepositoryAction extends ProvisioningAction {
return key;
}
- protected IProvisioningAgent getAgent(Map parameters) throws CoreException {
+ protected IProvisioningAgent getAgent(Map<String, Object> parameters) throws CoreException {
//We shouldn't really know about the session parameter
IProvisioningAgent agent = (IProvisioningAgent) parameters.get("agent"); //$NON-NLS-1$
if (agent == null)
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetLauncherNameAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetLauncherNameAction.java
index 922ce3851..6fadd2397 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetLauncherNameAction.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetLauncherNameAction.java
@@ -21,7 +21,7 @@ import org.eclipse.equinox.p2.engine.spi.ProvisioningAction;
public class SetLauncherNameAction extends ProvisioningAction {
public static final String ID = "setLauncherName"; //$NON-NLS-1$
- public IStatus execute(Map parameters) {
+ public IStatus execute(Map<String, Object> parameters) {
Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR);
Profile profile = (Profile) parameters.get(ActionConstants.PARM_PROFILE);
getMemento().put(EclipseTouchpoint.PROFILE_PROP_LAUNCHER_NAME, profile.getProperty(EclipseTouchpoint.PROFILE_PROP_LAUNCHER_NAME));
@@ -30,7 +30,7 @@ public class SetLauncherNameAction extends ProvisioningAction {
return Status.OK_STATUS;
}
- public IStatus undo(Map parameters) {
+ public IStatus undo(Map<String, Object> parameters) {
Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR);
Profile profile = (Profile) parameters.get(ActionConstants.PARM_PROFILE);
String previousLauncherName = (String) getMemento().get(EclipseTouchpoint.PROFILE_PROP_LAUNCHER_NAME);
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetProgramPropertyAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetProgramPropertyAction.java
index 1cfee2a4c..e334402a8 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetProgramPropertyAction.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetProgramPropertyAction.java
@@ -21,7 +21,7 @@ import org.eclipse.osgi.util.NLS;
public class SetProgramPropertyAction extends ProvisioningAction {
public static final String ID = "setProgramProperty"; //$NON-NLS-1$
- public IStatus execute(Map parameters) {
+ public IStatus execute(Map<String, Object> parameters) {
Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR);
String propName = (String) parameters.get(ActionConstants.PARM_PROP_NAME);
if (propName == null)
@@ -40,7 +40,7 @@ public class SetProgramPropertyAction extends ProvisioningAction {
return Status.OK_STATUS;
}
- public IStatus undo(Map parameters) {
+ public IStatus undo(Map<String, Object> parameters) {
Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR);
String propName = (String) parameters.get(ActionConstants.PARM_PROP_NAME);
if (propName == null)
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetStartLevelAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetStartLevelAction.java
index 1da5f54eb..e98141808 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetStartLevelAction.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetStartLevelAction.java
@@ -11,6 +11,7 @@
package org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions;
import java.io.File;
+import java.util.List;
import java.util.Map;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
@@ -28,7 +29,7 @@ import org.eclipse.osgi.util.NLS;
public class SetStartLevelAction extends ProvisioningAction {
public static final String ID = "setStartLevel"; //$NON-NLS-1$
- public IStatus execute(Map parameters) {
+ public IStatus execute(Map<String, Object> parameters) {
IProvisioningAgent agent = (IProvisioningAgent) parameters.get(ActionConstants.PARM_AGENT);
IProfile profile = (IProfile) parameters.get(ActionConstants.PARM_PROFILE);
Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR);
@@ -37,11 +38,11 @@ public class SetStartLevelAction extends ProvisioningAction {
if (startLevel == null)
return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_START_LEVEL, ID));
- IArtifactKey[] artifacts = iu.getArtifacts();
- if (artifacts == null || artifacts.length == 0)
+ List<IArtifactKey> artifacts = iu.getArtifacts();
+ if (artifacts == null || artifacts.isEmpty())
return Util.createError(NLS.bind(Messages.iu_contains_no_arifacts, iu));
- IArtifactKey artifactKey = artifacts[0];
+ IArtifactKey artifactKey = artifacts.get(0);
// the bundleFile might be null here, that's OK.
File bundleFile = Util.getArtifactFile(agent, artifactKey, profile);
@@ -71,7 +72,7 @@ public class SetStartLevelAction extends ProvisioningAction {
return Status.OK_STATUS;
}
- public IStatus undo(Map parameters) {
+ public IStatus undo(Map<String, Object> parameters) {
IProvisioningAgent agent = (IProvisioningAgent) parameters.get(ActionConstants.PARM_AGENT);
Integer previousStartLevel = (Integer) getMemento().get(ActionConstants.PARM_PREVIOUS_START_LEVEL);
if (previousStartLevel == null)
@@ -81,11 +82,11 @@ public class SetStartLevelAction extends ProvisioningAction {
Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR);
IInstallableUnit iu = (IInstallableUnit) parameters.get(EclipseTouchpoint.PARM_IU);
- IArtifactKey[] artifacts = iu.getArtifacts();
- if (artifacts == null || artifacts.length == 0)
+ List<IArtifactKey> artifacts = iu.getArtifacts();
+ if (artifacts == null || artifacts.isEmpty())
return Util.createError(NLS.bind(Messages.iu_contains_no_arifacts, iu));
- IArtifactKey artifactKey = artifacts[0];
+ IArtifactKey artifactKey = artifacts.get(0);
// the bundleFile might be null here, that's OK.
File bundleFile = Util.getArtifactFile(agent, artifactKey, profile);
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/UninstallBundleAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/UninstallBundleAction.java
index 2ad51aef4..c405b0ec7 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/UninstallBundleAction.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/UninstallBundleAction.java
@@ -9,6 +9,7 @@
package org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions;
import java.io.File;
+import java.util.List;
import java.util.Map;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
@@ -24,19 +25,18 @@ import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.query.FragmentQuery;
import org.eclipse.osgi.util.NLS;
-
public class UninstallBundleAction extends ProvisioningAction {
public static final String ID = "uninstallBundle"; //$NON-NLS-1$
- public IStatus execute(Map parameters) {
+ public IStatus execute(Map<String, Object> parameters) {
return UninstallBundleAction.uninstallBundle(parameters);
}
- public IStatus undo(Map parameters) {
+ public IStatus undo(Map<String, Object> parameters) {
return InstallBundleAction.installBundle(parameters);
}
- public static IStatus uninstallBundle(Map parameters) {
+ public static IStatus uninstallBundle(Map<String, Object> parameters) {
IProvisioningAgent agent = (IProvisioningAgent) parameters.get(ActionConstants.PARM_AGENT);
IProfile profile = (IProfile) parameters.get(ActionConstants.PARM_PROFILE);
IInstallableUnit iu = (IInstallableUnit) parameters.get(EclipseTouchpoint.PARM_IU);
@@ -51,14 +51,15 @@ public class UninstallBundleAction extends ProvisioningAction {
return Status.OK_STATUS;
}
- IArtifactKey[] artifacts = iu.getArtifacts();
- if (artifacts == null || artifacts.length == 0)
+ List<IArtifactKey> artifacts = iu.getArtifacts();
+ if (artifacts == null || artifacts.isEmpty())
return Util.createError(NLS.bind(Messages.iu_contains_no_arifacts, iu));
IArtifactKey artifactKey = null;
- for (int i = 0; i < artifacts.length; i++) {
- if (artifacts[i].toString().equals(bundleId)) {
- artifactKey = artifacts[i];
+ for (int i = 0; i < artifacts.size(); i++) {
+ IArtifactKey candidate = artifacts.get(i);
+ if (candidate.toString().equals(bundleId)) {
+ artifactKey = candidate;
break;
}
}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/UninstallFeatureAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/UninstallFeatureAction.java
index e91cf7ff7..6a7eae12b 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/UninstallFeatureAction.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/UninstallFeatureAction.java
@@ -8,6 +8,7 @@
******************************************************************************/
package org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions;
+import java.util.List;
import java.util.Map;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.equinox.internal.p2.touchpoint.eclipse.*;
@@ -19,29 +20,30 @@ import org.eclipse.osgi.util.NLS;
public class UninstallFeatureAction extends ProvisioningAction {
public static final String ID = "uninstallFeature"; //$NON-NLS-1$
- public IStatus execute(Map parameters) {
+ public IStatus execute(Map<String, Object> parameters) {
return UninstallFeatureAction.uninstallFeature(parameters);
}
- public IStatus undo(Map parameters) {
+ public IStatus undo(Map<String, Object> parameters) {
return InstallFeatureAction.installFeature(parameters);
}
- public static IStatus uninstallFeature(Map parameters) {
+ public static IStatus uninstallFeature(Map<String, Object> parameters) {
IInstallableUnit iu = (IInstallableUnit) parameters.get(EclipseTouchpoint.PARM_IU);
PlatformConfigurationWrapper configuration = (PlatformConfigurationWrapper) parameters.get(EclipseTouchpoint.PARM_PLATFORM_CONFIGURATION);
String feature = (String) parameters.get(ActionConstants.PARM_FEATURE);
String featureId = (String) parameters.get(ActionConstants.PARM_FEATURE_ID);
String featureVersion = (String) parameters.get(ActionConstants.PARM_FEATURE_VERSION);
- IArtifactKey[] artifacts = iu.getArtifacts();
- if (artifacts == null || artifacts.length == 0)
+ List<IArtifactKey> artifacts = iu.getArtifacts();
+ if (artifacts == null || artifacts.isEmpty())
return Util.createError(NLS.bind(Messages.iu_contains_no_arifacts, iu));
IArtifactKey artifactKey = null;
- for (int i = 0; i < artifacts.length; i++) {
- if (artifacts[i].toString().equals(feature)) {
- artifactKey = artifacts[i];
+ for (int i = 0; i < artifacts.size(); i++) {
+ IArtifactKey candidate = artifacts.get(i);
+ if (candidate.toString().equals(feature)) {
+ artifactKey = candidate;
break;
}
}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/Configuration.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/Configuration.java
index 26de44c16..1db43649b 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/Configuration.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/Configuration.java
@@ -28,7 +28,7 @@ import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
*/
public class Configuration {
- private List sites = new ArrayList();
+ private List<Site> sites = new ArrayList<Site>();
String date;
boolean transientProperty;
String version;
@@ -54,17 +54,17 @@ public class Configuration {
shared_ur = value;
}
- public List getSites() {
+ public List<Site> getSites() {
return internalGetSites(true);
}
- List internalGetSites(boolean includeParent) {
+ List<Site> internalGetSites(boolean includeParent) {
if (!includeParent)
return sites;
String shared = getSharedUR();
if (shared == null)
return sites;
- List result = new ArrayList(sites);
+ List<Site> result = new ArrayList<Site>(sites);
try {
URL url = new URL(shared);
File location = URLUtil.toFile(url);
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/ConfigurationCache.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/ConfigurationCache.java
index 7e95e10de..53c5c65f5 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/ConfigurationCache.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/ConfigurationCache.java
@@ -20,7 +20,7 @@ import java.util.Map;
*
*/
public class ConfigurationCache {
- private static Map cache = new HashMap();
+ private static Map<String, CacheEntry> cache = new HashMap<String, CacheEntry>();
// class used to represent cache values
static class CacheEntry {
@@ -46,7 +46,7 @@ public class ConfigurationCache {
*/
public static Configuration get(File file) {
String key = toKey(file);
- CacheEntry entry = (CacheEntry) cache.get(key);
+ CacheEntry entry = cache.get(key);
if (entry == null)
return null;
return file.lastModified() == entry.timestamp ? entry.config : null;
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/ConfigurationParser.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/ConfigurationParser.java
index f52d2d80b..2047b7454 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/ConfigurationParser.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/ConfigurationParser.java
@@ -79,7 +79,7 @@ public class ConfigurationParser implements ConfigurationConstants {
String locations = getAttribute(node, ATTRIBUTE_ROOT);
if (locations != null) {
StringTokenizer tokenizer = new StringTokenizer(locations, ","); //$NON-NLS-1$
- ArrayList rootList = new ArrayList();
+ ArrayList<URL> rootList = new ArrayList<URL>();
while (tokenizer.hasMoreTokens()) {
try {
URL rootEntry = new URL(tokenizer.nextToken().trim());
@@ -88,7 +88,7 @@ public class ConfigurationParser implements ConfigurationConstants {
// skip bad entries ...
}
}
- URL[] roots = (URL[]) rootList.toArray(new URL[rootList.size()]);
+ URL[] roots = rootList.toArray(new URL[rootList.size()]);
result.setRoots(roots);
}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/ConfigurationWriter.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/ConfigurationWriter.java
index aeea26038..501dde8b5 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/ConfigurationWriter.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/ConfigurationWriter.java
@@ -35,7 +35,7 @@ public class ConfigurationWriter implements ConfigurationConstants {
try {
OutputStream output = new BufferedOutputStream(new FileOutputStream(location));
writer = new XMLWriter(output);
- Map args = new HashMap();
+ Map<String, String> args = new HashMap<String, String>();
String value = configuration.getDate();
if (value != null)
@@ -53,8 +53,8 @@ public class ConfigurationWriter implements ConfigurationConstants {
writer.startTag(ELEMENT_CONFIG, args);
- for (Iterator iter = configuration.internalGetSites(false).iterator(); iter.hasNext();) {
- Site site = (Site) iter.next();
+ for (Iterator<Site> iter = configuration.internalGetSites(false).iterator(); iter.hasNext();) {
+ Site site = iter.next();
write(writer, site, osgiInstallArea);
}
@@ -77,7 +77,7 @@ public class ConfigurationWriter implements ConfigurationConstants {
* Write out the given site.
*/
private static void write(XMLWriter writer, Site site, URL osgiInstallArea) {
- Map args = new HashMap();
+ Map<String, String> args = new HashMap<String, String>();
String value = site.getLinkFile();
if (value != null)
@@ -146,7 +146,7 @@ public class ConfigurationWriter implements ConfigurationConstants {
return;
for (int i = 0; i < features.length; i++) {
Feature feature = features[i];
- Map args = new HashMap();
+ Map<String, String> args = new HashMap<String, String>();
String value = feature.getId();
if (value != null)
args.put(ATTRIBUTE_ID, value);
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/Site.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/Site.java
index c4404f16e..b04581cc3 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/Site.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/Site.java
@@ -27,8 +27,8 @@ public class Site {
private boolean updateable = true;
private String url;
private String linkFile;
- private Collection features = new HashSet();
- private List list = new ArrayList();
+ private Collection<Feature> features = new HashSet<Feature>();
+ private List<String> list = new ArrayList<String>();
public void addFeature(Feature feature) {
this.features.add(feature);
@@ -39,7 +39,7 @@ public class Site {
}
public Feature[] getFeatures() {
- return (Feature[]) features.toArray(new Feature[features.size()]);
+ return features.toArray(new Feature[features.size()]);
}
/*
@@ -50,8 +50,8 @@ public class Site {
public Feature getFeature(String id, String version) {
if (id == null)
return null;
- for (Iterator iter = features.iterator(); iter.hasNext();) {
- Feature feature = (Feature) iter.next();
+ for (Iterator<Feature> iter = features.iterator(); iter.hasNext();) {
+ Feature feature = iter.next();
if (id.equals(feature.getId())) {
if (version == null || version.equals(feature.getVersion()))
return feature;
@@ -61,8 +61,8 @@ public class Site {
}
public Feature removeFeature(String featureURL) {
- for (Iterator iter = features.iterator(); iter.hasNext();) {
- Feature feature = (Feature) iter.next();
+ for (Iterator<Feature> iter = features.iterator(); iter.hasNext();) {
+ Feature feature = iter.next();
String nextURL = feature.getUrl();
if (nextURL != null && nextURL.equals(featureURL))
return features.remove(feature) ? feature : null;
@@ -75,7 +75,7 @@ public class Site {
}
public String[] getList() {
- return (String[]) list.toArray(new String[list.size()]);
+ return list.toArray(new String[list.size()]);
}
public String getPolicy() {
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/XMLWriter.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/XMLWriter.java
index 9b86646c1..27b2a8880 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/XMLWriter.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/XMLWriter.java
@@ -49,18 +49,18 @@ public class XMLWriter extends PrintWriter {
super.print('\t');
}
- public void printTag(String name, Map parameters) {
+ public void printTag(String name, Map<String, String> parameters) {
printTag(name, parameters, true, true);
}
- public void printTag(String name, Map parameters, boolean shouldTab, boolean newLine) {
+ public void printTag(String name, Map<String, String> parameters, boolean shouldTab, boolean newLine) {
StringBuffer sb = new StringBuffer();
sb.append("<"); //$NON-NLS-1$
sb.append(name);
if (parameters != null)
- for (Iterator it = parameters.keySet().iterator(); it.hasNext();) {
+ for (Iterator<String> it = parameters.keySet().iterator(); it.hasNext();) {
sb.append(" "); //$NON-NLS-1$
- String key = (String) it.next();
+ String key = it.next();
sb.append(key);
sb.append("=\""); //$NON-NLS-1$
sb.append(getEscaped(String.valueOf(parameters.get(key))));
@@ -75,11 +75,11 @@ public class XMLWriter extends PrintWriter {
print(sb.toString());
}
- public void startTag(String name, Map parameters) {
+ public void startTag(String name, Map<String, String> parameters) {
startTag(name, parameters, true);
}
- public void startTag(String name, Map parameters, boolean newLine) {
+ public void startTag(String name, Map<String, String> parameters, boolean newLine) {
printTag(name, parameters, true, newLine);
tab++;
}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/p2/touchpoint/eclipse/query/OSGiBundleQuery.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/p2/touchpoint/eclipse/query/OSGiBundleQuery.java
index 91130a4bb..6d1afa235 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/p2/touchpoint/eclipse/query/OSGiBundleQuery.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/p2/touchpoint/eclipse/query/OSGiBundleQuery.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.equinox.p2.touchpoint.eclipse.query;
+import java.util.List;
import org.eclipse.equinox.internal.provisional.p2.metadata.IProvidedCapability;
import org.eclipse.equinox.internal.provisional.p2.metadata.query.MatchQuery;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
@@ -18,13 +19,10 @@ import org.eclipse.equinox.p2.metadata.IInstallableUnit;
* A query matching every {@link IInstallableUnit} that describes an OSGi bundle.
* @since 2.0
*/
-public class OSGiBundleQuery extends MatchQuery {
+public class OSGiBundleQuery extends MatchQuery<IInstallableUnit> {
- public boolean isMatch(Object candidate) {
- if (candidate instanceof IInstallableUnit) {
- return isOSGiBundle((IInstallableUnit) candidate);
- }
- return false;
+ public boolean isMatch(IInstallableUnit candidate) {
+ return isOSGiBundle(candidate);
}
/**
@@ -33,9 +31,10 @@ public class OSGiBundleQuery extends MatchQuery {
* @return <tt>true</tt> if the parameter describes an OSGi bundle.
*/
public static boolean isOSGiBundle(IInstallableUnit iu) {
- IProvidedCapability[] provided = iu.getProvidedCapabilities();
- for (int i = 0; i < provided.length; i++) {
- if (provided[i].getNamespace().equals("osgi.bundle")) { //$NON-NLS-1$
+ List<IProvidedCapability> provided = iu.getProvidedCapabilities();
+ int sz = provided.size();
+ for (int i = 0; i < sz; i++) {
+ if (provided.get(i).getNamespace().equals("osgi.bundle")) { //$NON-NLS-1$
return true;
}
}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/.classpath b/bundles/org.eclipse.equinox.p2.touchpoint.natives/.classpath
index 7cdeb7319..64c5e31b7 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/.classpath
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/.classpath
@@ -1,7 +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.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
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
index 78523cd05..8744e90d5 100644
--- 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
@@ -1,4 +1,4 @@
-#Thu Aug 16 11:00:59 EDT 2007
+#Tue Dec 22 23:15:07 CET 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
org.eclipse.jdt.core.builder.duplicateResourceTask=warning
@@ -7,24 +7,24 @@ 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.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.compliance=1.5
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.assertIdentifier=error
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.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
@@ -62,7 +62,6 @@ 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
@@ -72,7 +71,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=en
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.compiler.source=1.5
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
@@ -144,7 +143,6 @@ 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
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
index 5348a1af6..ddcf469c1 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/META-INF/MANIFEST.MF
@@ -20,7 +20,8 @@ Import-Package: org.eclipse.equinox.internal.p2.core.helpers,
org.osgi.framework;version="1.3.0"
Bundle-ActivationPolicy: lazy
Require-Bundle: org.eclipse.equinox.common
-Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
- J2SE-1.4
+Bundle-RequiredExecutionEnvironment: J2SE-1.5,
+ J2SE-1.4,
+ CDC-1.1/Foundation-1.1
Export-Package: org.eclipse.equinox.internal.p2.touchpoint.natives;x-internal:=true,
org.eclipse.equinox.internal.p2.touchpoint.natives.actions;x-internal:=true
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/build.properties b/bundles/org.eclipse.equinox.p2.touchpoint.natives/build.properties
index 4bbd9bd55..0328daa18 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/build.properties
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/build.properties
@@ -16,3 +16,5 @@ bin.includes = META-INF/,\
about.html,\
plugin.properties
src.includes = about.html
+javacTarget=jsr14
+javacSource=1.5
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/BackupStore.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/BackupStore.java
index 29fdbfdd1..43bc3496c 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/BackupStore.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/BackupStore.java
@@ -406,7 +406,7 @@ public class BackupStore implements IBackupStore {
throw new ClosedBackupStoreException(Messages.BackupStore_restore_closed_store);
// put back all files
// collect things that could not be restored (so final status can be reported)
- Set unrestorable = new HashSet();
+ Set<File> unrestorable = new HashSet<File>();
boolean restored = true;
if (!backupRoot.exists()) {
logError(NLS.bind(Messages.BackupStore_missing_backup_directory, backupRoot.getAbsolutePath()));
@@ -421,12 +421,12 @@ public class BackupStore implements IBackupStore {
closed = true;
}
- private void logUnrestorables(Set unrestorable) {
+ private void logUnrestorables(Set<File> unrestorable) {
// if there are unrestorable units log them
//
if (unrestorable != null && unrestorable.size() > 0) {
- for (Iterator itor = unrestorable.iterator(); itor.hasNext();)
- logError(NLS.bind(Messages.BackupStore_manual_restore_needed, ((File) itor.next()).getAbsolutePath()));
+ for (Iterator<File> itor = unrestorable.iterator(); itor.hasNext();)
+ logError(NLS.bind(Messages.BackupStore_manual_restore_needed, itor.next().getAbsolutePath()));
}
}
@@ -509,7 +509,7 @@ public class BackupStore implements IBackupStore {
return file.delete();
}
- private void restore(File root, File buRoot, Set unrestorable) {
+ private void restore(File root, File buRoot, Set<File> unrestorable) {
File[] children = buRoot.listFiles();
if (children == null) { // error - can't read the backup directory
unrestorable.add(buRoot);
@@ -576,7 +576,7 @@ public class BackupStore implements IBackupStore {
* @param buRoot
* @param unrestorable
*/
- private void restoreRoots(File buRoot, Set unrestorable) {
+ private void restoreRoots(File buRoot, Set<File> unrestorable) {
File[] children = buRoot.listFiles();
if (children == null) { // error - can't read the backup directory
unrestorable.add(buRoot);
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/NativeTouchpoint.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/NativeTouchpoint.java
index 6e4adc864..88a8efcd3 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/NativeTouchpoint.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/NativeTouchpoint.java
@@ -33,9 +33,9 @@ public class NativeTouchpoint extends Touchpoint {
public static final String PARM_ARTIFACT_LOCATION = "artifact.location"; //$NON-NLS-1$
- private static Map backups = new WeakHashMap();
+ private static Map<IProfile, IBackupStore> backups = new WeakHashMap<IProfile, IBackupStore>();
- public IStatus initializeOperand(IProfile profile, Operand operand, Map parameters) {
+ public IStatus initializeOperand(IProfile profile, Operand operand, Map<String, Object> parameters) {
IProvisioningAgent agent = (IProvisioningAgent) parameters.get(ActionConstants.PARM_AGENT);
IArtifactKey artifactKey = (IArtifactKey) parameters.get(PARM_ARTIFACT);
if (!parameters.containsKey(PARM_ARTIFACT_LOCATION) && artifactKey != null) {
@@ -51,7 +51,7 @@ public class NativeTouchpoint extends Touchpoint {
return Status.OK_STATUS;
}
- public IStatus initializePhase(IProgressMonitor monitor, IProfile profile, String phaseId, Map touchpointParameters) {
+ public IStatus initializePhase(IProgressMonitor monitor, IProfile profile, String phaseId, Map<String, Object> touchpointParameters) {
touchpointParameters.put(PARM_BACKUP, getBackupStore(profile));
return null;
}
@@ -129,7 +129,7 @@ public class NativeTouchpoint extends Touchpoint {
* @return a lazily initialized backup store
*/
private static synchronized IBackupStore getBackupStore(IProfile profile) {
- IBackupStore store = (IBackupStore) backups.get(profile);
+ IBackupStore store = backups.get(profile);
if (store == null) {
store = new LazyBackupStore(escape(profile.getProfileId()));
backups.put(profile, store);
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/Util.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/Util.java
index 1e58b41ce..62314c495 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/Util.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/Util.java
@@ -60,7 +60,7 @@ public class Util {
} catch (ProvisionException e) {
// the download cache doesn't exist or couldn't be read. Create new cache.
String repositoryName = location + " - Agent download cache"; //$NON-NLS-1$
- Map properties = new HashMap(1);
+ Map<String, String> properties = new HashMap<String, String>(1);
properties.put(IRepository.PROP_SYSTEM, Boolean.TRUE.toString());
repository = manager.createRepository(location, repositoryName, IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties);
}
@@ -108,7 +108,7 @@ public class Util {
in.close();
throw new IOException(Messages.Util_Invalid_Zip_File_Format);
}
- ArrayList unzippedFiles = new ArrayList();
+ ArrayList<File> unzippedFiles = new ArrayList<File>();
do {
File outFile = new File(outputDir, ze.getName());
unzippedFiles.add(outFile);
@@ -135,7 +135,7 @@ public class Util {
} while ((ze = in.getNextEntry()) != null);
in.close();
- return (File[]) unzippedFiles.toArray(new File[unzippedFiles.size()]);
+ return unzippedFiles.toArray(new File[unzippedFiles.size()]);
}
/**
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/ChmodAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/ChmodAction.java
index 36315a80d..b9d5d5b1b 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/ChmodAction.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/ChmodAction.java
@@ -24,7 +24,7 @@ import org.eclipse.osgi.util.NLS;
public class ChmodAction extends ProvisioningAction {
private static final String ACTION_CHMOD = "chmod"; //$NON-NLS-1$
- public IStatus execute(Map parameters) {
+ public IStatus execute(Map<String, Object> parameters) {
String targetDir = (String) parameters.get(ActionConstants.PARM_TARGET_DIR);
if (targetDir == null)
return Util.createError(NLS.bind(Messages.param_not_set, ActionConstants.PARM_TARGET_DIR, ACTION_CHMOD));
@@ -43,7 +43,7 @@ public class ChmodAction extends ProvisioningAction {
String options[] = null;
if (optionsString != null) {
- ArrayList collect = new ArrayList();
+ ArrayList<String> collect = new ArrayList<String>();
String r = optionsString.trim();
while (r.length() > 0) {
int spaceIdx = r.indexOf(' ');
@@ -66,7 +66,7 @@ public class ChmodAction extends ProvisioningAction {
return Status.OK_STATUS;
}
- public IStatus undo(Map parameters) {
+ public IStatus undo(Map<String, Object> parameters) {
//TODO: implement undo ??
return Status.OK_STATUS;
}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CleanupcopyAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CleanupcopyAction.java
index f6e51cf1f..8cab6b9a1 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CleanupcopyAction.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CleanupcopyAction.java
@@ -25,11 +25,11 @@ public class CleanupcopyAction extends ProvisioningAction {
public static final String ACTION_CLEANUPCOPY = "cleanupcopy"; //$NON-NLS-1$
- public IStatus execute(Map parameters) {
+ public IStatus execute(Map<String, Object> parameters) {
return cleanupcopy(parameters, true);
}
- public IStatus undo(Map parameters) {
+ public IStatus undo(Map<String, Object> parameters) {
return CopyAction.copy(parameters, false);
}
@@ -39,7 +39,7 @@ public class CleanupcopyAction extends ProvisioningAction {
* @param restoreable flag indicating if the operation should be backed up
* @return status
*/
- public static IStatus cleanupcopy(Map parameters, boolean restoreable) {
+ public static IStatus cleanupcopy(Map<String, Object> parameters, boolean restoreable) {
String source = (String) parameters.get(ActionConstants.PARM_SOURCE);
if (source == null)
return Util.createError(NLS.bind(Messages.param_not_set, ActionConstants.PARM_SOURCE, ACTION_CLEANUPCOPY));
@@ -57,7 +57,7 @@ public class CleanupcopyAction extends ProvisioningAction {
return Status.OK_STATUS;
StringTokenizer tokenizer = new StringTokenizer(copied, ActionConstants.PIPE);
- List directories = new ArrayList();
+ List<File> directories = new ArrayList<File>();
while (tokenizer.hasMoreTokens()) {
String fileName = tokenizer.nextToken();
File file = new File(fileName);
@@ -80,8 +80,8 @@ public class CleanupcopyAction extends ProvisioningAction {
}
}
- for (Iterator it = directories.iterator(); it.hasNext();) {
- File directory = (File) it.next();
+ for (Iterator<File> it = directories.iterator(); it.hasNext();) {
+ File directory = it.next();
File[] children = directory.listFiles();
if (children == null)
return Util.createError(NLS.bind(Messages.Error_list_children_0, directory));
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CleanupzipAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CleanupzipAction.java
index 60eedeff5..1e86c500b 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CleanupzipAction.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CleanupzipAction.java
@@ -26,15 +26,15 @@ public class CleanupzipAction extends ProvisioningAction {
private static final String UNZIPPED = "unzipped"; //$NON-NLS-1$
public static final String ACTION_CLEANUPZIP = "cleanupzip"; //$NON-NLS-1$
- public IStatus execute(Map parameters) {
+ public IStatus execute(Map<String, Object> parameters) {
return cleanupzip(parameters, true);
}
- public IStatus undo(Map parameters) {
+ public IStatus undo(Map<String, Object> parameters) {
return UnzipAction.unzip(parameters, false);
}
- public static IStatus cleanupzip(Map parameters, boolean restoreable) {
+ public static IStatus cleanupzip(Map<String, Object> parameters, boolean restoreable) {
String source = (String) parameters.get(ActionConstants.PARM_SOURCE);
if (source == null)
return Util.createError(NLS.bind(Messages.param_not_set, ActionConstants.PARM_SOURCE, ACTION_CLEANUPZIP));
@@ -51,15 +51,15 @@ public class CleanupzipAction extends ProvisioningAction {
if (unzipped == null) {
// best effort
// we try to substitute the current target with what was written.
- Map iuProperties = profile.getInstallableUnitProperties(iu);
+ Map<String, String> iuProperties = profile.getInstallableUnitProperties(iu);
String sourcePrefix = UNZIPPED + ActionConstants.PIPE + source + ActionConstants.PIPE;
- for (Iterator iterator = iuProperties.keySet().iterator(); iterator.hasNext();) {
- String key = (String) iterator.next();
+ for (Iterator<String> iterator = iuProperties.keySet().iterator(); iterator.hasNext();) {
+ String key = iterator.next();
if (key.startsWith(sourcePrefix)) {
if (unzipped == null) {
iuPropertyKey = key;
String storedTarget = key.substring(sourcePrefix.length());
- unzipped = substituteTarget(storedTarget, target, (String) iuProperties.get(key));
+ unzipped = substituteTarget(storedTarget, target, iuProperties.get(key));
} else
return Status.OK_STATUS; // possible two unzips of this source - give up on best effort
}
@@ -71,7 +71,7 @@ public class CleanupzipAction extends ProvisioningAction {
IBackupStore store = restoreable ? (IBackupStore) parameters.get(NativeTouchpoint.PARM_BACKUP) : null;
StringTokenizer tokenizer = new StringTokenizer(unzipped, ActionConstants.PIPE);
- List directories = new ArrayList();
+ List<File> directories = new ArrayList<File>();
while (tokenizer.hasMoreTokens()) {
String fileName = tokenizer.nextToken();
File file = new File(fileName);
@@ -96,8 +96,8 @@ public class CleanupzipAction extends ProvisioningAction {
// the leafs first in the list of directories.
// Since backup will deny backup of non empty directory a check must be made
//
- for (Iterator it = directories.iterator(); it.hasNext();) {
- File directory = (File) it.next();
+ for (Iterator<File> it = directories.iterator(); it.hasNext();) {
+ File directory = it.next();
if (store != null) {
File[] children = directory.listFiles();
if (children == null || children.length == 0)
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CollectAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CollectAction.java
index 73d057862..50e0edc2c 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CollectAction.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CollectAction.java
@@ -10,8 +10,7 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.touchpoint.natives.actions;
-import java.util.Collection;
-import java.util.Map;
+import java.util.*;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.equinox.internal.p2.touchpoint.natives.Util;
@@ -29,13 +28,14 @@ public class CollectAction extends ProvisioningAction {
public static final String ACTION_COLLECT = "collect"; //$NON-NLS-1$
- public IStatus execute(Map parameters) {
+ public IStatus execute(Map<String, Object> parameters) {
IProfile profile = (IProfile) parameters.get(ActionConstants.PARM_PROFILE);
IProvisioningAgent agent = (IProvisioningAgent) parameters.get(ActionConstants.PARM_AGENT);
InstallableUnitOperand operand = (InstallableUnitOperand) parameters.get(ActionConstants.PARM_OPERAND);
try {
IArtifactRequest[] requests = collect(agent, operand.second(), profile);
- Collection artifactRequests = (Collection) parameters.get(ActionConstants.PARM_ARTIFACT_REQUESTS);
+ @SuppressWarnings("unchecked")
+ Collection<IArtifactRequest[]> artifactRequests = (Collection<IArtifactRequest[]>) parameters.get(ActionConstants.PARM_ARTIFACT_REQUESTS);
artifactRequests.add(requests);
} catch (ProvisionException e) {
return e.getStatus();
@@ -43,21 +43,21 @@ public class CollectAction extends ProvisioningAction {
return Status.OK_STATUS;
}
- public IStatus undo(Map parameters) {
+ public IStatus undo(Map<String, Object> parameters) {
// nothing to do for now
return Status.OK_STATUS;
}
IArtifactRequest[] collect(IProvisioningAgent agent, IInstallableUnit installableUnit, IProfile profile) throws ProvisionException {
- IArtifactKey[] toDownload = installableUnit.getArtifacts();
+ List<IArtifactKey> toDownload = installableUnit.getArtifacts();
if (toDownload == null)
return new IArtifactRequest[0];
IArtifactRepository destination = Util.getDownloadCacheRepo(agent);
- IArtifactRequest[] requests = new IArtifactRequest[toDownload.length];
+ IArtifactRequest[] requests = new IArtifactRequest[toDownload.size()];
int count = 0;
- for (int i = 0; i < toDownload.length; i++) {
+ for (int i = 0; i < toDownload.size(); 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++] = Util.getArtifactRepositoryManager(agent).createMirrorRequest(toDownload[i], destination, null, null);
+ requests[count++] = Util.getArtifactRepositoryManager(agent).createMirrorRequest(toDownload.get(i), destination, null, null);
}
if (requests.length == count)
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CopyAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CopyAction.java
index 9f273fedf..d9dab3c98 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CopyAction.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CopyAction.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.touchpoint.natives.actions;
+import java.io.File;
+
import java.io.*;
import java.util.ArrayList;
import java.util.Map;
@@ -33,7 +35,7 @@ import org.eclipse.osgi.util.NLS;
public class CopyAction extends ProvisioningAction {
public static final String ID = "cp"; //$NON-NLS-1$
- public IStatus execute(Map parameters) {
+ public IStatus execute(Map<String, Object> parameters) {
return copy(parameters, true);
}
@@ -43,7 +45,7 @@ public class CopyAction extends ProvisioningAction {
* @param restoreable flag indicating if the operation should be backed up
* @return status
*/
- public static IStatus copy(Map parameters, boolean restoreable) {
+ public static IStatus copy(Map<String, Object> parameters, boolean restoreable) {
String target = (String) parameters.get(ActionConstants.PARM_COPY_TARGET);
IBackupStore backupStore = restoreable ? (IBackupStore) parameters.get(NativeTouchpoint.PARM_BACKUP) : null;
@@ -86,7 +88,7 @@ public class CopyAction extends ProvisioningAction {
return Status.OK_STATUS;
}
- public IStatus undo(Map parameters) {
+ public IStatus undo(Map<String, Object> parameters) {
return CleanupcopyAction.cleanupcopy(parameters, false);
}
@@ -98,9 +100,9 @@ public class CopyAction extends ProvisioningAction {
* @throws IOException
*/
private static File[] mergeCopy(File source, File target, boolean overwrite, IBackupStore backupStore) throws IOException {
- ArrayList copiedFiles = new ArrayList();
+ ArrayList<File> copiedFiles = new ArrayList<File>();
xcopy(copiedFiles, source, target, overwrite, backupStore);
- return (File[]) copiedFiles.toArray(new File[copiedFiles.size()]);
+ return copiedFiles.toArray(new File[copiedFiles.size()]);
}
/**
@@ -111,7 +113,7 @@ public class CopyAction extends ProvisioningAction {
* @param overwrite
* @throws IOException
*/
- private static void xcopy(ArrayList copiedFiles, File source, File target, boolean overwrite, IBackupStore backupStore) throws IOException {
+ private static void xcopy(ArrayList<File> copiedFiles, File source, File target, boolean overwrite, IBackupStore backupStore) throws IOException {
if (!source.exists())
throw new IOException("Source: " + source + "does not exists"); //$NON-NLS-1$//$NON-NLS-2$
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/LinkAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/LinkAction.java
index 415451ec3..d5cfd2761 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/LinkAction.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/LinkAction.java
@@ -20,7 +20,7 @@ import org.eclipse.osgi.util.NLS;
public class LinkAction extends ProvisioningAction {
public static final String ID = "ln"; //$NON-NLS-1$
- public IStatus execute(Map parameters) {
+ public IStatus execute(Map<String, Object> parameters) {
String targetDir = (String) parameters.get(ActionConstants.PARM_TARGET_DIR);
if (targetDir == null)
return new Status(IStatus.ERROR, Activator.ID, IStatus.OK, NLS.bind(Messages.param_not_set, ActionConstants.PARM_TARGET_DIR, ID), null);
@@ -45,7 +45,7 @@ public class LinkAction extends ProvisioningAction {
return Status.OK_STATUS;
}
- public IStatus undo(Map parameters) {
+ public IStatus undo(Map<String, Object> parameters) {
String targetDir = (String) parameters.get(ActionConstants.PARM_TARGET_DIR);
String linkName = (String) parameters.get(ActionConstants.PARM_LINK_NAME);
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/MkdirAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/MkdirAction.java
index df19ad9bd..bea5668c0 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/MkdirAction.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/MkdirAction.java
@@ -22,7 +22,7 @@ import org.eclipse.osgi.util.NLS;
public class MkdirAction extends ProvisioningAction {
public static final String ID = "mkdir"; //$NON-NLS-1$
- public IStatus execute(Map parameters) {
+ public IStatus execute(Map<String, Object> parameters) {
String path = (String) parameters.get(ActionConstants.PARM_PATH);
if (path == null)
return Util.createError(NLS.bind(Messages.param_not_set, ActionConstants.PARM_PATH, ID));
@@ -35,7 +35,7 @@ public class MkdirAction extends ProvisioningAction {
return Util.createError(NLS.bind(Messages.mkdir_failed, path, ID));
}
- public IStatus undo(Map parameters) {
+ public IStatus undo(Map<String, Object> parameters) {
String path = (String) parameters.get(ActionConstants.PARM_PATH);
if (path == null)
return Util.createError(NLS.bind(Messages.param_not_set, ActionConstants.PARM_PATH, ID));
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/RemoveAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/RemoveAction.java
index 8a2bf5b5d..c820a9bbd 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/RemoveAction.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/RemoveAction.java
@@ -22,7 +22,7 @@ import org.eclipse.osgi.util.NLS;
public class RemoveAction extends ProvisioningAction {
public static final String ID = "remove"; //$NON-NLS-1$
- public IStatus execute(Map parameters) {
+ public IStatus execute(Map<String, Object> parameters) {
String path = (String) parameters.get(ActionConstants.PARM_PATH);
if (path == null)
return Util.createError(NLS.bind(Messages.param_not_set, ActionConstants.PARM_PATH, ID));
@@ -41,7 +41,7 @@ public class RemoveAction extends ProvisioningAction {
return Status.OK_STATUS;
}
- public IStatus undo(Map parameters) {
+ public IStatus undo(Map<String, Object> parameters) {
// Does not have to do anything as the backup will restore what was deleted
return Status.OK_STATUS;
}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/RmdirAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/RmdirAction.java
index 565e100d4..8473a2ae8 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/RmdirAction.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/RmdirAction.java
@@ -22,7 +22,7 @@ import org.eclipse.osgi.util.NLS;
public class RmdirAction extends ProvisioningAction {
public static final String ID = "rmdir"; //$NON-NLS-1$
- public IStatus execute(Map parameters) {
+ public IStatus execute(Map<String, Object> parameters) {
String path = (String) parameters.get(ActionConstants.PARM_PATH);
if (path == null)
return Util.createError(NLS.bind(Messages.param_not_set, ActionConstants.PARM_PATH, ID));
@@ -49,7 +49,7 @@ public class RmdirAction extends ProvisioningAction {
return Status.OK_STATUS;
}
- public IStatus undo(Map parameters) {
+ public IStatus undo(Map<String, Object> parameters) {
String path = (String) parameters.get(ActionConstants.PARM_PATH);
IBackupStore store = (IBackupStore) parameters.get(NativeTouchpoint.PARM_BACKUP);
if (path == null)
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/UnzipAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/UnzipAction.java
index 85d66a833..108161650 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/UnzipAction.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/UnzipAction.java
@@ -25,11 +25,11 @@ public class UnzipAction extends ProvisioningAction {
public static final String ACTION_UNZIP = "unzip"; //$NON-NLS-1$
- public IStatus execute(Map parameters) {
+ public IStatus execute(Map<String, Object> parameters) {
return unzip(parameters, true);
}
- public IStatus undo(Map parameters) {
+ public IStatus undo(Map<String, Object> parameters) {
return CleanupzipAction.cleanupzip(parameters, false);
}
@@ -40,7 +40,7 @@ public class UnzipAction extends ProvisioningAction {
* @param restoreable - if the unzip should be backed up
* @return status
*/
- public static IStatus unzip(Map parameters, boolean restoreable) {
+ public static IStatus unzip(Map<String, Object> parameters, boolean restoreable) {
String source = (String) parameters.get(ActionConstants.PARM_SOURCE);
if (source == null)
return Util.createError(NLS.bind(Messages.param_not_set, ActionConstants.PARM_SOURCE, ACTION_UNZIP));
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/.classpath b/bundles/org.eclipse.equinox.p2.ui.admin/.classpath
index ce7393340..64c5e31b7 100644
--- a/bundles/org.eclipse.equinox.p2.ui.admin/.classpath
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/.classpath
@@ -1,7 +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.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
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
index 78523cd05..b8bd26840 100644
--- 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
@@ -1,4 +1,4 @@
-#Thu Aug 16 11:00:59 EDT 2007
+#Tue Dec 22 23:48:18 CET 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
org.eclipse.jdt.core.builder.duplicateResourceTask=warning
@@ -7,24 +7,24 @@ 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.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.compliance=1.5
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.assertIdentifier=error
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.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
@@ -62,7 +62,6 @@ 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
@@ -72,7 +71,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=en
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.compiler.source=1.5
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
@@ -144,7 +143,6 @@ 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
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
index 5ebda9e81..64c3a13f6 100644
--- a/bundles/org.eclipse.equinox.p2.ui.admin/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/META-INF/MANIFEST.MF
@@ -6,7 +6,8 @@ Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.equinox.p2.ui.admin;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: org.eclipse.equinox.internal.p2.ui.admin.ProvAdminUIActivator
-Bundle-RequiredExecutionEnvironment: J2SE-1.4,
+Bundle-RequiredExecutionEnvironment: J2SE-1.5,
+ J2SE-1.4,
CDC-1.1/Foundation-1.1
Import-Package: org.eclipse.equinox.internal.p2.core.helpers,
org.eclipse.equinox.internal.p2.ui,
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/build.properties b/bundles/org.eclipse.equinox.p2.ui.admin/build.properties
index 35011865d..b7d66df9b 100644
--- a/bundles/org.eclipse.equinox.p2.ui.admin/build.properties
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/build.properties
@@ -16,6 +16,5 @@ bin.includes = plugin.properties,\
META-INF/
src.includes = about.html
source.. = src/
-
-
-
+javacTarget=jsr14
+javacSource=1.5
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/AddProfileJob.java b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/AddProfileJob.java
index 5faf475bc..f68cc3ce7 100644
--- a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/AddProfileJob.java
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/AddProfileJob.java
@@ -23,9 +23,9 @@ import org.eclipse.equinox.p2.operations.ProvisioningSession;
*/
public class AddProfileJob extends ProvisioningJob {
private String profileId;
- private Map profileProperties;
+ private Map<String, String> profileProperties;
- public AddProfileJob(String label, ProvisioningSession session, String profileId, Map profileProperties) {
+ public AddProfileJob(String label, ProvisioningSession session, String profileId, Map<String, String> profileProperties) {
super(label, session);
this.profileId = profileId;
this.profileProperties = profileProperties;
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/MetadataRepositoriesView.java b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/MetadataRepositoriesView.java
index 07425fd81..df1c314c1 100644
--- a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/MetadataRepositoriesView.java
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/MetadataRepositoriesView.java
@@ -113,8 +113,8 @@ public class MetadataRepositoriesView extends RepositoriesView {
return ProvUIProvisioningListener.PROV_EVENT_METADATA_REPOSITORY;
}
- protected List getVisualProperties() {
- List list = super.getVisualProperties();
+ protected List<String> getVisualProperties() {
+ List<String> list = super.getVisualProperties();
list.add(PreferenceConstants.PREF_USE_CATEGORIES);
list.add(PreferenceConstants.PREF_COLLAPSE_IU_VERSIONS);
return list;
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/ProfileFactory.java b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/ProfileFactory.java
index 064ed1337..9bd6f9236 100644
--- a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/ProfileFactory.java
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/ProfileFactory.java
@@ -33,7 +33,7 @@ public class ProfileFactory {
static private EnvironmentInfo info;
public static IProfile makeProfile(String profileId) {
- Map profileProperties = new HashMap();
+ Map<String, String> profileProperties = new HashMap<String, String>();
profileProperties.put(IProfile.PROP_INSTALL_FOLDER, getDefaultLocation());
profileProperties.put(IProfile.PROP_ENVIRONMENTS, getDefaultEnvironments());
profileProperties.put(IProfile.PROP_NL, getDefaultNL());
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/ProfilesView.java b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/ProfilesView.java
index 88a641b5e..df5cef119 100644
--- a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/ProfilesView.java
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/ProfilesView.java
@@ -53,12 +53,12 @@ public class ProfilesView extends ProvView {
public void run() {
Object[] selections = getSelection().toArray();
- List profilesOnly = new ArrayList();
+ List<String> profilesOnly = new ArrayList<String>();
for (int i = 0; i < selections.length; i++) {
if (selections[i] instanceof ProfileElement)
profilesOnly.add(((ProfileElement) selections[i]).getProfileId());
}
- RemoveProfilesJob op = new RemoveProfilesJob(ProvAdminUIMessages.Ops_RemoveProfileOperationLabel, getProvisioningUI().getSession(), (String[]) profilesOnly.toArray(new String[profilesOnly.size()]));
+ RemoveProfilesJob op = new RemoveProfilesJob(ProvAdminUIMessages.Ops_RemoveProfileOperationLabel, getProvisioningUI().getSession(), profilesOnly.toArray(new String[profilesOnly.size()]));
ProfilesView.this.run(op);
}
}
@@ -160,7 +160,7 @@ public class ProfilesView extends ProvView {
if (selectionArray.length > 0) {
removeProfileAction.setEnabled(true);
for (int i = 0; i < selectionArray.length; i++) {
- IProfile profile = (IProfile) ProvUI.getAdapter(selectionArray[i], IProfile.class);
+ IProfile profile = ProvUI.getAdapter(selectionArray[i], IProfile.class);
if (profile == null) {
removeProfileAction.setEnabled(false);
break;
@@ -186,14 +186,14 @@ public class ProfilesView extends ProvView {
if (firstElement instanceof InstalledIUElement) {
return ((InstalledIUElement) firstElement).getProfileId();
}
- IProfile profile = (IProfile) ProvUI.getAdapter(firstElement, IProfile.class);
+ IProfile profile = ProvUI.getAdapter(firstElement, IProfile.class);
if (profile != null)
return profile.getProfileId();
return null;
}
- protected List getVisualProperties() {
- List list = super.getVisualProperties();
+ protected List<String> getVisualProperties() {
+ List<String> list = super.getVisualProperties();
list.add(PreferenceConstants.PREF_SHOW_INSTALL_ROOTS_ONLY);
return list;
}
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/ProvView.java b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/ProvView.java
index 0f6ecd825..c6d28b7e1 100644
--- a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/ProvView.java
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/ProvView.java
@@ -223,8 +223,8 @@ abstract class ProvView extends ViewPart {
// do nothing by default
}
- protected List getVisualProperties() {
- ArrayList list = new ArrayList(1);
+ protected List<String> getVisualProperties() {
+ ArrayList<String> list = new ArrayList<String>(1);
list.add(PreferenceConstants.PREF_SHOW_GROUPS_ONLY);
return list;
}
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/RepositoriesView.java b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/RepositoriesView.java
index 2614fbd09..cf21efabc 100644
--- a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/RepositoriesView.java
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/RepositoriesView.java
@@ -55,12 +55,12 @@ abstract class RepositoriesView extends ProvView {
public void run() {
RepositoryTracker tracker = RepositoriesView.this.getRepositoryTracker();
Object[] elements = getSelection().toArray();
- ArrayList uris = new ArrayList(elements.length);
+ ArrayList<URI> uris = new ArrayList<URI>(elements.length);
for (int i = 0; i < elements.length; i++) {
- if (elements[i] instanceof IRepositoryElement)
- uris.add(((IRepositoryElement) elements[i]).getLocation());
+ if (elements[i] instanceof IRepositoryElement<?>)
+ uris.add(((IRepositoryElement<?>) elements[i]).getLocation());
}
- tracker.removeRepositories((URI[]) uris.toArray(new URI[uris.size()]), RepositoriesView.this.getProvisioningUI().getSession());
+ tracker.removeRepositories(uris.toArray(new URI[uris.size()]), RepositoriesView.this.getProvisioningUI().getSession());
}
}
@@ -74,10 +74,10 @@ abstract class RepositoriesView extends ProvView {
public void run() {
Object[] elements = ((ITreeContentProvider) viewer.getContentProvider()).getElements(getInput());
- ArrayList urls = new ArrayList();
+ ArrayList<URI> urls = new ArrayList<URI>();
for (int i = 0; i < elements.length; i++)
- if (elements[i] instanceof IRepositoryElement)
- urls.add(((IRepositoryElement) elements[i]).getLocation());
+ if (elements[i] instanceof IRepositoryElement<?>)
+ urls.add(((IRepositoryElement<?>) elements[i]).getLocation());
openAddRepositoryDialog(getShell());
}
}
@@ -193,13 +193,13 @@ abstract class RepositoriesView extends ProvView {
protected abstract String getRemoveCommandTooltip();
protected boolean isRepository(Object element) {
- return element instanceof IRepositoryElement;
+ return element instanceof IRepositoryElement<?>;
}
protected abstract int getListenerEventTypes();
- protected List getVisualProperties() {
- List list = super.getVisualProperties();
+ protected List<String> getVisualProperties() {
+ List<String> list = super.getVisualProperties();
list.add(PreferenceConstants.PREF_HIDE_SYSTEM_REPOS);
return list;
}
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/AddProfileDialog.java b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/AddProfileDialog.java
index dcbbee6c7..7d5d88ce2 100644
--- a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/AddProfileDialog.java
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/AddProfileDialog.java
@@ -73,7 +73,7 @@ public class AddProfileDialog extends StatusDialog {
return;
}
addedProfileId = profileGroup.getProfileId();
- Map profileProperties = profileGroup.getProfileProperties();
+ Map<String, String> profileProperties = profileGroup.getProfileProperties();
AddProfileJob job = new AddProfileJob(ProvAdminUIMessages.AddProfileDialog_OperationLabel, ProvisioningUI.getDefaultUI().getSession(), addedProfileId, profileProperties);
job.runModal(new NullProgressMonitor());
}
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/IUGroup.java b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/IUGroup.java
index 3f792c844..e3729873a 100644
--- a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/IUGroup.java
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/IUGroup.java
@@ -38,7 +38,7 @@ public abstract class IUGroup {
}
public IInstallableUnit getIU() {
- return (IInstallableUnit) ProvUI.getAdapter(iuElement, IInstallableUnit.class);
+ return ProvUI.getAdapter(iuElement, IInstallableUnit.class);
}
public void updateIU() {
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/IUImplementationGroup.java b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/IUImplementationGroup.java
index b6982d4d0..e34243db5 100644
--- a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/IUImplementationGroup.java
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/IUImplementationGroup.java
@@ -154,23 +154,23 @@ public class IUImplementationGroup extends IUGroup {
if (type != null) {
touchpointType.setText(type.getId());
}
- ITouchpointData[] data = iu.getTouchpointData();
- String[] items = new String[data.length];
- for (int i = 0; i < data.length; i++) {
- items[i] = data[i].toString();
+ java.util.List<ITouchpointData> data = iu.getTouchpointData();
+ String[] items = new String[data.size()];
+ for (int i = 0; i < data.size(); i++) {
+ items[i] = data.get(i).toString();
}
touchpointData.setItems(items);
- IRequirement[] req = iu.getRequiredCapabilities();
- items = new String[req.length];
- for (int i = 0; i < req.length; i++) {
- items[i] = req[i].toString();
+ java.util.List<IRequirement> req = iu.getRequiredCapabilities();
+ items = new String[req.size()];
+ for (int i = 0; i < req.size(); i++) {
+ items[i] = req.get(i).toString();
}
requiredCapabilities.setItems(items);
- IProvidedCapability[] prov = iu.getProvidedCapabilities();
- items = new String[prov.length];
- for (int i = 0; i < prov.length; i++) {
- items[i] = prov[i].toString();
+ java.util.List<IProvidedCapability> prov = iu.getProvidedCapabilities();
+ items = new String[prov.size()];
+ for (int i = 0; i < prov.size(); i++) {
+ items[i] = prov.get(i).toString();
}
providedCapabilities.setItems(items);
}
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/IUImplementationPropertyPage.java b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/IUImplementationPropertyPage.java
index 50c6cab05..04a751e26 100644
--- a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/IUImplementationPropertyPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/IUImplementationPropertyPage.java
@@ -31,7 +31,7 @@ public class IUImplementationPropertyPage extends PropertyPage {
private IUImplementationGroup iuGroup;
protected Control createContents(Composite parent) {
- IInstallableUnit iu = (IInstallableUnit) ProvUI.getAdapter(getElement(), IInstallableUnit.class);
+ IInstallableUnit iu = ProvUI.getAdapter(getElement(), IInstallableUnit.class);
if (iu == null) {
Label label = new Label(parent, SWT.DEFAULT);
label.setText(ProvAdminUIMessages.No_Property_Item_Selected);
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/ProfileGroup.java b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/ProfileGroup.java
index b6ac85b41..07f546092 100644
--- a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/ProfileGroup.java
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/ProfileGroup.java
@@ -177,9 +177,9 @@ public class ProfileGroup {
}
}
- public Map getProfileProperties() {
+ public Map<String, String> getProfileProperties() {
if (profile == null) {
- Map profileProperties = new HashMap();
+ Map<String, String> profileProperties = new HashMap<String, String>();
String value = location.getText().trim();
if (value.length() > 0) {
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/ProfilePropertyPage.java b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/ProfilePropertyPage.java
index f4eba7f8d..cea15ad83 100644
--- a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/ProfilePropertyPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/ProfilePropertyPage.java
@@ -28,7 +28,7 @@ public class ProfilePropertyPage extends PropertyPage {
private ProfileGroup profileGroup;
protected Control createContents(Composite parent) {
- IProfile profile = (IProfile) ProvUI.getAdapter(getElement(), IProfile.class);
+ IProfile profile = ProvUI.getAdapter(getElement(), IProfile.class);
if (profile == null) {
Label label = new Label(parent, SWT.DEFAULT);
label.setText(ProvAdminUIMessages.No_Property_Item_Selected);
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/RepositoryImplementationPropertyPage.java b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/RepositoryImplementationPropertyPage.java
index 028c9b127..7c28fc184 100644
--- a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/RepositoryImplementationPropertyPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/RepositoryImplementationPropertyPage.java
@@ -27,7 +27,7 @@ import org.eclipse.ui.dialogs.PropertyPage;
* @since 3.4
*/
public class RepositoryImplementationPropertyPage extends PropertyPage {
- private IRepositoryElement repositoryElement;
+ private IRepositoryElement<?> repositoryElement;
private Composite composite;
private Text name;
private Text location;
@@ -105,9 +105,9 @@ public class RepositoryImplementationPropertyPage extends PropertyPage {
}
private void initializeFields() {
- IRepositoryElement element = getRepositoryElement();
+ IRepositoryElement<?> element = getRepositoryElement();
if (element != null) {
- IRepository repo = getRepositoryElement().getRepository(null);
+ IRepository<?> repo = getRepositoryElement().getRepository(null);
location.setText(repo.getLocation().toString());
String value = repo.getName();
if (value != null)
@@ -126,9 +126,9 @@ public class RepositoryImplementationPropertyPage extends PropertyPage {
private void initializeTable() {
if (getRepositoryElement() != null) {
- Map repoProperties = getRepositoryElement().getRepository(null).getProperties();
+ Map<String, String> repoProperties = getRepositoryElement().getRepository(null).getProperties();
if (repoProperties != null) {
- String[] propNames = (String[]) repoProperties.keySet().toArray(new String[repoProperties.size()]);
+ String[] propNames = 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()});
@@ -137,9 +137,9 @@ public class RepositoryImplementationPropertyPage extends PropertyPage {
}
}
- private IRepositoryElement getRepositoryElement() {
+ private IRepositoryElement<?> getRepositoryElement() {
if (repositoryElement == null) {
- repositoryElement = (IRepositoryElement) ProvUI.getAdapter(getElement(), IRepositoryElement.class);
+ repositoryElement = ProvUI.getAdapter(getElement(), IRepositoryElement.class);
}
return repositoryElement;
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/.classpath b/bundles/org.eclipse.equinox.p2.ui/.classpath
index ce7393340..64c5e31b7 100644
--- a/bundles/org.eclipse.equinox.p2.ui/.classpath
+++ b/bundles/org.eclipse.equinox.p2.ui/.classpath
@@ -1,7 +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.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
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
index a6b401a0d..2ecd40133 100644
--- 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
@@ -1,4 +1,4 @@
-#Tue Sep 18 21:22:20 EDT 2007
+#Tue Dec 22 23:22:15 CET 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
org.eclipse.jdt.core.builder.duplicateResourceTask=warning
@@ -7,24 +7,24 @@ 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.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.compliance=1.5
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.assertIdentifier=error
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.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
@@ -71,7 +71,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=en
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.compiler.source=1.5
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
@@ -143,7 +143,6 @@ 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
diff --git a/bundles/org.eclipse.equinox.p2.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.ui/META-INF/MANIFEST.MF
index b76ddaac3..adcf8ec0a 100644
--- a/bundles/org.eclipse.equinox.p2.ui/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.ui/META-INF/MANIFEST.MF
@@ -55,7 +55,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.equinox.security.ui;bundle-version="[1.0.0,2.0.0)",
org.eclipse.compare
Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: J2SE-1.4,
+Bundle-RequiredExecutionEnvironment: J2SE-1.5,
+ J2SE-1.4,
CDC-1.1/Foundation-1.1
Service-Component: OSGI-INF/serviceui_component.xml, OSGI-INF/repositoryTracker_component.xml
diff --git a/bundles/org.eclipse.equinox.p2.ui/build.properties b/bundles/org.eclipse.equinox.p2.ui/build.properties
index 368f2601a..8e36e3064 100644
--- a/bundles/org.eclipse.equinox.p2.ui/build.properties
+++ b/bundles/org.eclipse.equinox.p2.ui/build.properties
@@ -17,3 +17,5 @@ bin.includes = plugin.properties,\
OSGI-INF/
ssrc.includes = about.html
source.. = src/
+javacTarget=jsr14
+javacSource=1.5
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ElementQueryDescriptor.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ElementQueryDescriptor.java
index 96acd3524..2f4a992be 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ElementQueryDescriptor.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ElementQueryDescriptor.java
@@ -26,16 +26,16 @@ import org.eclipse.equinox.p2.metadata.query.IQuery;
*/
public class ElementQueryDescriptor {
- private IQuery query;
- private Collector collector;
- private IQueryable queryable;
+ private IQuery<Object> query;
+ private Collector<Object> collector;
+ private IQueryable<Object> queryable;
private ElementWrapper wrapper;
/**
* Creates an ElementQueryDescriptor to represent a Query, its collector the queryable
* on which it will run.
*/
- public ElementQueryDescriptor(IQueryable queryable, IQuery query, Collector collector) {
+ public ElementQueryDescriptor(IQueryable<?> queryable, IQuery<?> query, Collector<?> collector) {
this(queryable, query, collector, null);
}
@@ -43,10 +43,11 @@ public class ElementQueryDescriptor {
* Creates an ElementQueryDescriptor to represent a Query, its collector the queryable
* on which it will run, and the transformer used to transform the results.
*/
- public ElementQueryDescriptor(IQueryable queryable, IQuery query, Collector collector, ElementWrapper wrapper) {
- this.query = query;
- this.collector = collector;
- this.queryable = queryable;
+ @SuppressWarnings("unchecked")
+ public ElementQueryDescriptor(IQueryable<?> queryable, IQuery<?> query, Collector<?> collector, ElementWrapper wrapper) {
+ this.query = (IQuery<Object>) query;
+ this.collector = (Collector<Object>) collector;
+ this.queryable = (IQueryable<Object>) queryable;
this.wrapper = wrapper;
}
@@ -54,13 +55,13 @@ public class ElementQueryDescriptor {
* Performs the query returning a collection of results.
* @param monitor
*/
- public Collection performQuery(IProgressMonitor monitor) {
- Collector results = this.collector;
+ public Collection<?> performQuery(IProgressMonitor monitor) {
+ Collector<Object> results = this.collector;
// If the query is completely described, perform it
if (query != null && collector != null && queryable != null)
results.addAll(this.queryable.query(this.query, monitor));
else if (results == null)
- results = new Collector();
+ results = new Collector<Object>();
// Let the wrapper analyze the results, even if we didn't perform the query.
// This allows the wrapper to modify the results with explanations.
if (wrapper != null)
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ElementWrapper.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ElementWrapper.java
index 9ca11d8af..4ee4dee20 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ElementWrapper.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ElementWrapper.java
@@ -11,6 +11,7 @@
package org.eclipse.equinox.internal.p2.ui;
import java.util.*;
+import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils;
import org.eclipse.equinox.internal.provisional.p2.metadata.query.Collector;
/**
@@ -18,15 +19,15 @@ import org.eclipse.equinox.internal.provisional.p2.metadata.query.Collector;
*/
public abstract class ElementWrapper {
- private Collection collection = null;
+ private Collection<Object> collection = null;
/**
* Transforms a collector returned by a query to a collection
* of UI elements
*/
- public Collection getElements(Collector collector) {
- collection = new ArrayList(collector.size());
- Iterator iter = collector.iterator();
+ public Collection<?> getElements(Collector<?> collector) {
+ collection = new ArrayList<Object>(collector.size());
+ Iterator<?> iter = collector.iterator();
while (iter.hasNext()) {
Object o = iter.next();
if (shouldWrap(o))
@@ -38,8 +39,8 @@ public abstract class ElementWrapper {
/**
* Gets the collection where the elements are being stored.
*/
- protected Collection getCollection() {
- return collection == null ? Collections.EMPTY_LIST : collection;
+ protected Collection<?> getCollection() {
+ return collection == null ? CollectionUtils.emptyList() : collection;
}
/**
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUI.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUI.java
index c4ec3c970..22c7a5ff9 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUI.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUI.java
@@ -108,13 +108,13 @@ public class ProvUI {
return queryContext;
}
- public static Object getAdapter(Object object, Class adapterType) {
+ public static <T> T getAdapter(Object object, Class<T> adapterType) {
if (object == null)
return null;
if (adapterType.isInstance(object))
- return object;
+ return adapterType.cast(object);
if (object instanceof IAdaptable)
- return ((IAdaptable) object).getAdapter(adapterType);
+ return adapterType.cast(((IAdaptable) object).getAdapter(adapterType));
return null;
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIAdapterFactory.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIAdapterFactory.java
index 957ec2517..922e7390d 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIAdapterFactory.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIAdapterFactory.java
@@ -25,13 +25,14 @@ import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
*/
public class ProvUIAdapterFactory implements IAdapterFactory {
- private static final Class[] CLASSES = new Class[] {IInstallableUnit.class, IProfile.class, IRepository.class, IMetadataRepository.class, IArtifactRepository.class};
+ private static final Class<?>[] CLASSES = new Class[] {IInstallableUnit.class, IProfile.class, IRepository.class, IMetadataRepository.class, IArtifactRepository.class};
+ @SuppressWarnings({"rawtypes", "unchecked"})
public Object getAdapter(Object adaptableObject, Class adapterType) {
return ProvUI.getAdapter(adaptableObject, adapterType);
}
- public Class[] getAdapterList() {
+ public Class<?>[] getAdapterList() {
return CLASSES;
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryProvider.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryProvider.java
index c984f7ad7..b12ea488f 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryProvider.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryProvider.java
@@ -11,6 +11,8 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.ui;
+import java.net.URI;
+import java.util.List;
import org.eclipse.equinox.internal.p2.ui.model.*;
import org.eclipse.equinox.internal.p2.ui.query.*;
import org.eclipse.equinox.internal.provisional.p2.metadata.query.*;
@@ -42,8 +44,8 @@ public class QueryProvider {
public static final int INSTALLED_IUS = 6;
public static final int AVAILABLE_ARTIFACTS = 7;
- private IQuery allQuery = new MatchQuery() {
- public boolean isMatch(Object candidate) {
+ private IQuery<IInstallableUnit> allQuery = new MatchQuery<IInstallableUnit>() {
+ public boolean isMatch(IInstallableUnit candidate) {
return true;
}
};
@@ -56,7 +58,7 @@ public class QueryProvider {
// Initialize queryable, queryContext, and queryType from the element.
// In some cases we override this.
Policy policy = ui.getPolicy();
- IQueryable queryable = element.getQueryable();
+ IQueryable<?> queryable = element.getQueryable();
int queryType = element.getQueryType();
IUViewQueryContext context = element.getQueryContext();
if (context == null) {
@@ -65,8 +67,8 @@ public class QueryProvider {
RepositoryTracker tracker = ui.getRepositoryTracker();
switch (queryType) {
case ARTIFACT_REPOS :
- queryable = new QueryableArtifactRepositoryManager(ui, false);
- return new ElementQueryDescriptor(queryable, new RepositoryLocationQuery(), new Collector(), new ArtifactRepositoryElementWrapper(null, element));
+ queryable = new QueryableArtifactRepositoryManager(ui, false).locationsQueriable();
+ return new ElementQueryDescriptor(queryable, new RepositoryLocationQuery(), new Collector<URI>(), new ArtifactRepositoryElementWrapper(null, element));
case AVAILABLE_IUS :
// Things get more complicated if the user wants to filter out installed items.
@@ -82,21 +84,21 @@ public class QueryProvider {
targetProfile = ui.getSession().getProfileRegistry().getProfile(profileId);
}
- IQuery topLevelQuery = policy.getVisibleAvailableIUQuery();
- IQuery categoryQuery = new CategoryQuery();
+ IQuery<IInstallableUnit> topLevelQuery = policy.getVisibleAvailableIUQuery();
+ IQuery<IInstallableUnit> categoryQuery = new CategoryQuery();
// Showing child IU's of a group of repositories, or of a single repository
if (element instanceof MetadataRepositories || element instanceof MetadataRepositoryElement) {
if (context.getViewType() == IUViewQueryContext.AVAILABLE_VIEW_FLAT || !context.getUseCategories()) {
AvailableIUWrapper wrapper = new AvailableIUWrapper(queryable, element, false, context.getShowAvailableChildren());
if (showLatest)
- topLevelQuery = new PipedQuery(new IQuery[] {topLevelQuery, new LatestIUVersionQuery()});
+ topLevelQuery = new PipedQuery<IInstallableUnit>(topLevelQuery, new LatestIUVersionQuery<IInstallableUnit>());
if (targetProfile != null)
wrapper.markInstalledIUs(targetProfile, hideInstalled);
- return new ElementQueryDescriptor(queryable, topLevelQuery, new Collector(), wrapper);
+ return new ElementQueryDescriptor(queryable, topLevelQuery, new Collector<Object>(), wrapper);
}
// Installed content not a concern for collecting categories
- return new ElementQueryDescriptor(queryable, categoryQuery, new Collector(), new CategoryElementWrapper(queryable, element));
+ return new ElementQueryDescriptor(queryable, categoryQuery, new Collector<Object>(), new CategoryElementWrapper(queryable, element));
}
// If it's a category or some other IUElement to drill down in, we get the requirements and show all requirements
@@ -105,7 +107,7 @@ public class QueryProvider {
// children of a category should drill down according to the context. If we aren't in a category, we are already drilling down and
// continue to do so.
boolean drillDown = element instanceof CategoryElement ? context.getShowAvailableChildren() : true;
- IQuery memberOfCategoryQuery = new CategoryMemberQuery(((IIUElement) element).getIU());
+ IQuery<IInstallableUnit> memberOfCategoryQuery = new CategoryMemberQuery(((IIUElement) element).getIU());
availableIUWrapper = new AvailableIUWrapper(queryable, element, true, drillDown);
if (targetProfile != null)
availableIUWrapper.markInstalledIUs(targetProfile, hideInstalled);
@@ -113,14 +115,15 @@ public class QueryProvider {
// be visible in the category.
if (element instanceof CategoryElement) {
if (showLatest)
- memberOfCategoryQuery = new PipedQuery(new IQuery[] {memberOfCategoryQuery, new LatestIUVersionQuery()});
- return new ElementQueryDescriptor(queryable, memberOfCategoryQuery, new Collector(), availableIUWrapper);
+ memberOfCategoryQuery = new PipedQuery<IInstallableUnit>(memberOfCategoryQuery, new LatestIUVersionQuery<IInstallableUnit>());
+ return new ElementQueryDescriptor(queryable, memberOfCategoryQuery, new Collector<Object>(), availableIUWrapper);
}
- IQuery query = CompoundQuery.createCompoundQuery(new IQuery[] {topLevelQuery, memberOfCategoryQuery}, true);
+ @SuppressWarnings("unchecked")
+ IQuery<IInstallableUnit> query = CompoundQuery.createCompoundQuery(new IQuery[] {topLevelQuery, memberOfCategoryQuery}, true);
if (showLatest)
- query = new PipedQuery(new IQuery[] {query, new LatestIUVersionQuery()});
+ query = new PipedQuery<IInstallableUnit>(query, new LatestIUVersionQuery<IInstallableUnit>());
// If it's not a category, these are generic requirements and should be filtered by the visibility property (topLevelQuery)
- return new ElementQueryDescriptor(queryable, query, new Collector(), availableIUWrapper);
+ return new ElementQueryDescriptor(queryable, query, new Collector<Object>(), availableIUWrapper);
}
return null;
@@ -133,55 +136,58 @@ public class QueryProvider {
profile = ui.getSession().getProfileRegistry().getProfile(((Updates) element).getProfileId());
toUpdate = ((Updates) element).getIUs();
} else {
- profile = (IProfile) ProvUI.getAdapter(element, IProfile.class);
+ profile = ProvUI.getAdapter(element, IProfile.class);
}
if (profile == null)
return null;
if (toUpdate == null) {
- IQueryResult queryResult = profile.query(policy.getVisibleInstalledIUQuery(), null);
- toUpdate = (IInstallableUnit[]) queryResult.toArray(IInstallableUnit.class);
+ IQueryResult<IInstallableUnit> queryResult = profile.query(policy.getVisibleInstalledIUQuery(), null);
+ toUpdate = queryResult.toArray(IInstallableUnit.class);
}
QueryableUpdates updateQueryable = new QueryableUpdates(ui, toUpdate);
- return new ElementQueryDescriptor(updateQueryable, context.getShowLatestVersionsOnly() ? new LatestIUVersionQuery() : allQuery, new Collector());
+ return new ElementQueryDescriptor(updateQueryable, context.getShowLatestVersionsOnly() ? new LatestIUVersionQuery<IInstallableUnit>() : allQuery, new Collector<Object>());
case INSTALLED_IUS :
// Querying of IU's. We are drilling down into the requirements.
if (element instanceof IIUElement && context.getShowInstallChildren()) {
- IRequirement[] reqs = ((IIUElement) element).getRequirements();
- IQuery[] meetsAnyRequirementQuery = new IQuery[reqs.length];
+ List<IRequirement> reqs = ((IIUElement) element).getRequirements();
+ @SuppressWarnings("unchecked")
+ IQuery<IInstallableUnit>[] meetsAnyRequirementQuery = new IQuery[reqs.size()];
for (int i = 0; i < meetsAnyRequirementQuery.length; i++) {
- meetsAnyRequirementQuery[i] = reqs[i].getMatches();
+ meetsAnyRequirementQuery[i] = reqs.get(i).getMatches();
}
- IQuery visibleAsAvailableQuery = policy.getVisibleAvailableIUQuery();
- return new ElementQueryDescriptor(queryable, CompoundQuery.createCompoundQuery(new IQuery[] {visibleAsAvailableQuery, CompoundQuery.createCompoundQuery(meetsAnyRequirementQuery, false)}, true), new Collector(), new InstalledIUElementWrapper(queryable, element));
+ IQuery<IInstallableUnit> visibleAsAvailableQuery = policy.getVisibleAvailableIUQuery();
+ @SuppressWarnings("unchecked")
+ CompoundQuery<IInstallableUnit> createCompoundQuery = CompoundQuery.createCompoundQuery(new IQuery[] {visibleAsAvailableQuery, CompoundQuery.createCompoundQuery(meetsAnyRequirementQuery, false)}, true);
+ return new ElementQueryDescriptor(queryable, createCompoundQuery, new Collector<IInstallableUnit>(), new InstalledIUElementWrapper(queryable, element));
}
- profile = (IProfile) ProvUI.getAdapter(element, IProfile.class);
+ profile = ProvUI.getAdapter(element, IProfile.class);
if (profile == null)
return null;
- return new ElementQueryDescriptor(profile, policy.getVisibleInstalledIUQuery(), new Collector(), new InstalledIUElementWrapper(profile, element));
+ return new ElementQueryDescriptor(profile, policy.getVisibleInstalledIUQuery(), new Collector<IInstallableUnit>(), new InstalledIUElementWrapper(profile, element));
case METADATA_REPOS :
if (element instanceof MetadataRepositories) {
if (queryable == null) {
- queryable = new QueryableMetadataRepositoryManager(ui, ((MetadataRepositories) element).getIncludeDisabledRepositories());
+ queryable = new QueryableMetadataRepositoryManager(ui, ((MetadataRepositories) element).getIncludeDisabledRepositories()).locationsQueriable();
element.setQueryable(queryable);
}
- return new ElementQueryDescriptor(element.getQueryable(), new RepositoryLocationQuery(), new Collector(), new MetadataRepositoryElementWrapper(null, element));
+ return new ElementQueryDescriptor(element.getQueryable(), new RepositoryLocationQuery(), new Collector<URI>(), new MetadataRepositoryElementWrapper(null, element));
}
return null;
case PROFILES :
queryable = new QueryableProfileRegistry(ui);
- return new ElementQueryDescriptor(queryable, new MatchQuery() {
+ return new ElementQueryDescriptor(queryable, new MatchQuery<Object>() {
public boolean isMatch(Object candidate) {
return ProvUI.getAdapter(candidate, IProfile.class) != null;
}
- }, new Collector(), new ProfileElementWrapper(null, element));
+ }, new Collector<Object>(), new ProfileElementWrapper(null, element));
case AVAILABLE_ARTIFACTS :
if (!(queryable instanceof IArtifactRepository))
return null;
- return new ElementQueryDescriptor(queryable, ArtifactKeyQuery.ALL_KEYS, new Collector(), new ArtifactKeyWrapper((IArtifactRepository) queryable, element));
+ return new ElementQueryDescriptor(queryable, ArtifactKeyQuery.ALL_KEYS, new Collector<Object>(), new ArtifactKeyWrapper((IArtifactRepository) queryable, element));
default :
return null;
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableArtifactRepositoryManager.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableArtifactRepositoryManager.java
index c855d4bda..9549e1607 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableArtifactRepositoryManager.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableArtifactRepositoryManager.java
@@ -15,25 +15,27 @@ import java.net.URI;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.equinox.internal.p2.artifact.repository.ArtifactRepositoryManager;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
+import org.eclipse.equinox.p2.metadata.IArtifactKey;
import org.eclipse.equinox.p2.operations.RepositoryTracker;
-import org.eclipse.equinox.p2.repository.IRepository;
import org.eclipse.equinox.p2.repository.IRepositoryManager;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
import org.eclipse.equinox.p2.ui.ProvisioningUI;
/**
* An object that queries a particular set of artifact repositories.
*/
-public class QueryableArtifactRepositoryManager extends QueryableRepositoryManager {
+public class QueryableArtifactRepositoryManager extends QueryableRepositoryManager<IArtifactKey> {
public QueryableArtifactRepositoryManager(ProvisioningUI ui, boolean includeDisabledRepos) {
super(ui, includeDisabledRepos);
}
- protected IRepositoryManager getRepositoryManager() {
+ protected IArtifactRepositoryManager getRepositoryManager() {
return getSession().getArtifactRepositoryManager();
}
- protected IRepository doLoadRepository(IRepositoryManager manager, URI location, IProgressMonitor monitor) throws ProvisionException {
+ protected IArtifactRepository doLoadRepository(IRepositoryManager<IArtifactKey> manager, URI location, IProgressMonitor monitor) throws ProvisionException {
return ui.loadArtifactRepository(location, false, monitor);
}
@@ -44,7 +46,7 @@ public class QueryableArtifactRepositoryManager extends QueryableRepositoryManag
return repositoryManipulator.getArtifactRepositoryFlags();
}
- protected IRepository getRepository(IRepositoryManager manager, URI location) {
+ protected IArtifactRepository getRepository(IRepositoryManager<IArtifactKey> manager, URI location) {
// note the use of ArtifactRepositoryManager (the concrete implementation).
if (manager instanceof ArtifactRepositoryManager) {
return ((ArtifactRepositoryManager) manager).getRepository(location);
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableMetadataRepositoryManager.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableMetadataRepositoryManager.java
index 0d8abb19b..f635a8a15 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableMetadataRepositoryManager.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableMetadataRepositoryManager.java
@@ -14,21 +14,23 @@ import java.net.URI;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.operations.RepositoryTracker;
-import org.eclipse.equinox.p2.repository.IRepository;
import org.eclipse.equinox.p2.repository.IRepositoryManager;
+import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
+import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
import org.eclipse.equinox.p2.ui.ProvisioningUI;
/**
* An object that queries a particular set of metadata repositories.
*/
-public class QueryableMetadataRepositoryManager extends QueryableRepositoryManager {
+public class QueryableMetadataRepositoryManager extends QueryableRepositoryManager<IInstallableUnit> {
public QueryableMetadataRepositoryManager(ProvisioningUI ui, boolean includeDisabledRepos) {
super(ui, includeDisabledRepos);
}
- protected IRepository getRepository(IRepositoryManager manager, URI location) {
+ protected IMetadataRepository getRepository(IRepositoryManager<IInstallableUnit> manager, URI location) {
// note the use of MetadataRepositoryManager (the concrete implementation).
if (manager instanceof MetadataRepositoryManager) {
return ((MetadataRepositoryManager) manager).getRepository(location);
@@ -36,11 +38,11 @@ public class QueryableMetadataRepositoryManager extends QueryableRepositoryManag
return null;
}
- protected IRepositoryManager getRepositoryManager() {
+ protected IMetadataRepositoryManager getRepositoryManager() {
return getSession().getMetadataRepositoryManager();
}
- protected IRepository doLoadRepository(IRepositoryManager manager, URI location, IProgressMonitor monitor) throws ProvisionException {
+ protected IMetadataRepository doLoadRepository(IRepositoryManager<IInstallableUnit> manager, URI location, IProgressMonitor monitor) throws ProvisionException {
return ui.loadMetadataRepository(location, false, monitor);
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableRepositoryManager.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableRepositoryManager.java
index c537f530a..7a88e24ea 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableRepositoryManager.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableRepositoryManager.java
@@ -32,7 +32,7 @@ import org.eclipse.osgi.util.NLS;
* query is performed over the URI's. Otherwise the repositories are loaded and
* the query is performed over the repositories themselves.
*/
-public abstract class QueryableRepositoryManager implements IQueryable {
+public abstract class QueryableRepositoryManager<T> implements IQueryable<T> {
private ProvisioningSession session;
protected boolean includeDisabledRepos;
protected RepositoryTracker tracker;
@@ -54,8 +54,7 @@ public abstract class QueryableRepositoryManager implements IQueryable {
/**
* Iterates over the repositories configured in this queryable.
* For most queries, the query is run on each repository, passing any objects that satisfy the
- * query. If the query is a {@link RepositoryLocationQuery}, the query
- * is run on the repository locations instead.
+ * query.
* <p>
* This method is long-running; progress and cancellation are provided
* by the given progress monitor.
@@ -66,20 +65,29 @@ public abstract class QueryableRepositoryManager implements IQueryable {
* reporting is not desired
* @return The QueryResult argument
*/
- public IQueryResult query(IQuery query, IProgressMonitor monitor) {
- IRepositoryManager manager = getRepositoryManager();
+ public IQueryResult<T> query(IQuery<T> query, IProgressMonitor monitor) {
+ IRepositoryManager<T> manager = getRepositoryManager();
if (monitor == null)
monitor = new NullProgressMonitor();
return query(getRepoLocations(manager), query, monitor);
}
- protected URI[] getRepoLocations(IRepositoryManager manager) {
- Set locations = new HashSet();
+ public IQueryable<URI> locationsQueriable() {
+ return new IQueryable<URI>() {
+
+ public IQueryResult<URI> query(IQuery<URI> query, IProgressMonitor monitor) {
+ return query.perform(Arrays.asList(getRepoLocations(getRepositoryManager())).iterator());
+ }
+ };
+ }
+
+ protected URI[] getRepoLocations(IRepositoryManager<T> manager) {
+ Set<URI> locations = new HashSet<URI>();
locations.addAll(Arrays.asList(manager.getKnownRepositories(repositoryFlags)));
if (includeDisabledRepos) {
locations.addAll(Arrays.asList(manager.getKnownRepositories(IRepositoryManager.REPOSITORIES_DISABLED | repositoryFlags)));
}
- return (URI[]) locations.toArray(new URI[locations.size()]);
+ return locations.toArray(new URI[locations.size()]);
}
/**
@@ -93,12 +101,12 @@ public abstract class QueryableRepositoryManager implements IQueryable {
* are not.
*/
public boolean areRepositoriesLoaded() {
- IRepositoryManager mgr = getRepositoryManager();
+ IRepositoryManager<T> mgr = getRepositoryManager();
if (mgr == null)
return false;
URI[] repoURIs = getRepoLocations(mgr);
for (int i = 0; i < repoURIs.length; i++) {
- IRepository repo = getRepository(mgr, repoURIs[i]);
+ IRepository<T> repo = getRepository(mgr, repoURIs[i]);
// A not-loaded repo doesn't count if it's considered missing (not found)
if (repo == null && !tracker.hasNotFoundStatusBeenReported(repoURIs[i]))
return false;
@@ -106,11 +114,11 @@ public abstract class QueryableRepositoryManager implements IQueryable {
return true;
}
- protected abstract IRepository getRepository(IRepositoryManager manager, URI location);
+ protected abstract IRepository<T> getRepository(IRepositoryManager<T> manager, URI location);
- protected IRepository loadRepository(IRepositoryManager manager, URI location, IProgressMonitor monitor) throws ProvisionException {
+ protected IRepository<T> loadRepository(IRepositoryManager<T> manager, URI location, IProgressMonitor monitor) throws ProvisionException {
monitor.setTaskName(NLS.bind(ProvUIMessages.QueryableMetadataRepositoryManager_LoadRepositoryProgress, URIUtil.toUnencodedString(location)));
- IRepository repo = doLoadRepository(manager, location, monitor);
+ IRepository<T> repo = doLoadRepository(manager, location, monitor);
return repo;
}
@@ -118,7 +126,7 @@ public abstract class QueryableRepositoryManager implements IQueryable {
* Return the appropriate repository manager, or <code>null</code> if none could be found.
* @return the repository manager
*/
- protected abstract IRepositoryManager getRepositoryManager();
+ protected abstract IRepositoryManager<T> getRepositoryManager();
/**
* Return the flags that should be used to access repositories given the
@@ -135,17 +143,13 @@ public abstract class QueryableRepositoryManager implements IQueryable {
* @return the repository that was loaded, or <code>null</code> if no repository could
* be found at that location.
*/
- protected abstract IRepository doLoadRepository(IRepositoryManager manager, URI location, IProgressMonitor monitor) throws ProvisionException;
-
- protected IQueryResult query(URI uris[], IQuery query, IProgressMonitor monitor) {
- if (query instanceof RepositoryLocationQuery) {
- return query.perform(Arrays.asList(uris).iterator());
- }
+ protected abstract IRepository<T> doLoadRepository(IRepositoryManager<T> manager, URI location, IProgressMonitor monitor) throws ProvisionException;
+ protected IQueryResult<T> query(URI uris[], IQuery<T> query, IProgressMonitor monitor) {
SubMonitor sub = SubMonitor.convert(monitor, (uris.length + 1) * 100);
- ArrayList loadedRepos = new ArrayList(uris.length);
+ ArrayList<IRepository<T>> loadedRepos = new ArrayList<IRepository<T>>(uris.length);
for (int i = 0; i < uris.length; i++) {
- IRepository repo = null;
+ IRepository<T> repo = null;
try {
repo = loadRepository(getRepositoryManager(), uris[i], sub.newChild(100));
} catch (ProvisionException e) {
@@ -158,10 +162,11 @@ public abstract class QueryableRepositoryManager implements IQueryable {
loadedRepos.add(repo);
}
if (loadedRepos.size() > 0) {
- IQueryable[] queryables = (IQueryable[]) loadedRepos.toArray(new IQueryable[loadedRepos.size()]);
- return new CompoundQueryable(queryables).query(query, sub.newChild(100));
+ @SuppressWarnings("unchecked")
+ IQueryable<T>[] queryables = loadedRepos.toArray(new IQueryable[loadedRepos.size()]);
+ return new CompoundQueryable<T>(queryables).query(query, sub.newChild(100));
}
- return Collector.EMPTY_COLLECTOR;
+ return Collector.emptyCollector();
}
public void setRespositoryFlags(int flags) {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/RepositoryLocationQuery.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/RepositoryLocationQuery.java
index fde79672e..bb3d4afd5 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/RepositoryLocationQuery.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/RepositoryLocationQuery.java
@@ -27,7 +27,7 @@ import org.eclipse.equinox.p2.repository.IRepository;
*
* @since 3.5
*/
-public class RepositoryLocationQuery implements IQuery {
+public class RepositoryLocationQuery implements IQuery<URI> {
/**
* Gets the ID for this Query.
@@ -44,8 +44,8 @@ public class RepositoryLocationQuery implements IQuery {
return QueryHelpers.getProperty(this, property);
}
- public IQueryResult perform(Iterator iterator) {
- Collector result = new Collector();
+ public IQueryResult<URI> perform(Iterator<URI> iterator) {
+ Collector<URI> result = new Collector<URI>();
while (iterator.hasNext()) {
Object candidate = iterator.next();
URI location = getLocation(candidate);
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/UpdateManagerCompatibility.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/UpdateManagerCompatibility.java
index e7fc91c60..c47baa7ab 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/UpdateManagerCompatibility.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/UpdateManagerCompatibility.java
@@ -13,7 +13,8 @@ package org.eclipse.equinox.internal.p2.ui;
import java.io.*;
import java.net.URI;
import java.net.URISyntaxException;
-import java.util.*;
+import java.util.Iterator;
+import java.util.Vector;
import javax.xml.parsers.*;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.ui.model.MetadataRepositoryElement;
@@ -41,7 +42,7 @@ public class UpdateManagerCompatibility {
private static final String ECLIPSE_INSTALL_HANDLER_PROP = "org.eclipse.update.installHandler"; //$NON-NLS-1$
private static final DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
- private static void parse(String fileName, Vector bookmarks) {
+ private static void parse(String fileName, Vector<MetadataRepositoryElement> bookmarks) {
File file = new File(fileName);
if (!file.exists())
return;
@@ -61,23 +62,18 @@ public class UpdateManagerCompatibility {
}
}
- private static MetadataRepositoryElement[] getSites(Vector bookmarks) {
- ArrayList result = new ArrayList();
- for (int i = 0; i < bookmarks.size(); i++) {
- if (bookmarks.get(i) instanceof MetadataRepositoryElement)
- result.add(bookmarks.get(i));
- }
- return (MetadataRepositoryElement[]) result.toArray(new MetadataRepositoryElement[result.size()]);
+ private static MetadataRepositoryElement[] getSites(Vector<MetadataRepositoryElement> bookmarks) {
+ return bookmarks.toArray(new MetadataRepositoryElement[bookmarks.size()]);
}
- private static void processRoot(Node root, Vector bookmarks) {
+ private static void processRoot(Node root, Vector<MetadataRepositoryElement> bookmarks) {
if (root.getNodeName().equals("bookmarks")) { //$NON-NLS-1$
NodeList children = root.getChildNodes();
processChildren(children, bookmarks);
}
}
- private static void processChildren(NodeList children, Vector bookmarks) {
+ private static void processChildren(NodeList children, Vector<MetadataRepositoryElement> bookmarks) {
for (int i = 0; i < children.getLength(); i++) {
Node child = children.item(i);
if (child.getNodeType() == Node.ELEMENT_NODE) {
@@ -90,7 +86,7 @@ public class UpdateManagerCompatibility {
}
}
- private static void createSite(Node child, Vector bookmarks) {
+ private static void createSite(Node child, Vector<MetadataRepositoryElement> bookmarks) {
URI uri = null;
try {
uri = URIUtil.fromString((getAttribute(child, "url"))); //$NON-NLS-1$
@@ -109,7 +105,7 @@ public class UpdateManagerCompatibility {
bookmarks.add(element);
}
- private static void createFolder(Node child, Vector bookmarks) {
+ private static void createFolder(Node child, Vector<MetadataRepositoryElement> bookmarks) {
if (child.hasChildNodes())
processChildren(child.getChildNodes(), bookmarks);
}
@@ -123,7 +119,7 @@ public class UpdateManagerCompatibility {
return ""; //$NON-NLS-1$
}
- private static void store(String fileName, Vector bookmarks) {
+ private static void store(String fileName, Vector<MetadataRepositoryElement> bookmarks) {
FileOutputStream fos = null;
OutputStreamWriter osw = null;
PrintWriter writer = null;
@@ -171,9 +167,9 @@ public class UpdateManagerCompatibility {
}
public static boolean requiresInstallHandlerSupport(IProvisioningPlan plan) {
- IQueryResult result = plan.getAdditions().query(InstallableUnitQuery.ANY, null);
- for (Iterator iterator = result.iterator(); iterator.hasNext();) {
- IInstallableUnit iu = (IInstallableUnit) iterator.next();
+ IQueryResult<IInstallableUnit> result = plan.getAdditions().query(InstallableUnitQuery.ANY, null);
+ for (Iterator<IInstallableUnit> iterator = result.iterator(); iterator.hasNext();) {
+ IInstallableUnit iu = iterator.next();
if (iu != null && iu.getProperty(ECLIPSE_INSTALL_HANDLER_PROP) != null)
return true;
}
@@ -206,13 +202,13 @@ public class UpdateManagerCompatibility {
}
public static MetadataRepositoryElement[] readBookmarkFile(File file) {
- Vector bookmarks = new Vector();
+ Vector<MetadataRepositoryElement> bookmarks = new Vector<MetadataRepositoryElement>();
parse(file.getAbsolutePath(), bookmarks);
return getSites(bookmarks);
}
public static void writeBookmarkFile(String filename, MetadataRepositoryElement[] sites) {
- Vector bookmarks = new Vector(sites.length);
+ Vector<MetadataRepositoryElement> bookmarks = new Vector<MetadataRepositoryElement>(sites.length);
for (int i = 0; i < sites.length; i++)
bookmarks.add(sites[i]);
store(filename, bookmarks);
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/ColocatedRepositoryAction.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/ColocatedRepositoryAction.java
index ccd46e608..2bbcacca5 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/ColocatedRepositoryAction.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/ColocatedRepositoryAction.java
@@ -27,12 +27,12 @@ public abstract class ColocatedRepositoryAction extends ProvisioningAction {
}
protected URI[] getSelectedLocations(Object[] selectionArray) {
- List urls = new ArrayList();
+ List<URI> urls = new ArrayList<URI>();
for (int i = 0; i < selectionArray.length; i++) {
if (selectionArray[i] instanceof MetadataRepositoryElement)
urls.add(((MetadataRepositoryElement) selectionArray[i]).getLocation());
}
- return (URI[]) urls.toArray(new URI[urls.size()]);
+ return urls.toArray(new URI[urls.size()]);
}
protected void checkEnablement(Object[] selectionArray) {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/ExistingIUInProfileAction.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/ExistingIUInProfileAction.java
index 66b8380b7..2ee36cab2 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/ExistingIUInProfileAction.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/ExistingIUInProfileAction.java
@@ -18,7 +18,6 @@ import org.eclipse.equinox.internal.provisional.p2.metadata.query.InstallableUni
import org.eclipse.equinox.internal.provisional.p2.metadata.query.PipedQuery;
import org.eclipse.equinox.p2.engine.IProfile;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.p2.metadata.query.IQuery;
import org.eclipse.equinox.p2.ui.ProvisioningUI;
import org.eclipse.jface.viewers.ISelectionProvider;
@@ -59,7 +58,7 @@ public abstract class ExistingIUInProfileAction extends ProfileModificationActio
if (!isSelectable(element.getIU(), profile))
return false;
} else {
- IInstallableUnit iu = (IInstallableUnit) ProvUI.getAdapter(selectionArray[i], IInstallableUnit.class);
+ IInstallableUnit iu = ProvUI.getAdapter(selectionArray[i], IInstallableUnit.class);
if (iu == null || !isSelectable(iu))
return false;
}
@@ -74,7 +73,7 @@ public abstract class ExistingIUInProfileAction extends ProfileModificationActio
return false;
Object parent = element.getParent(element);
if (parent != null) {
- IProfile profile = (IProfile) ProvUI.getAdapter(parent, IProfile.class);
+ IProfile profile = ProvUI.getAdapter(parent, IProfile.class);
if (profile != null)
return isSelectable(element.getIU(), profile);
}
@@ -91,7 +90,7 @@ public abstract class ExistingIUInProfileAction extends ProfileModificationActio
int lock = getLock(profile, iu);
if ((lock & getLockConstant()) == getLockConstant())
return false;
- return !profile.query(new PipedQuery(new IQuery[] {new InstallableUnitQuery(iu), getPolicy().getVisibleInstalledIUQuery()}), null).isEmpty();
+ return !profile.query(new PipedQuery<IInstallableUnit>(new InstallableUnitQuery(iu), getPolicy().getVisibleInstalledIUQuery()), null).isEmpty();
}
protected abstract int getLockConstant();
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/InstallAction.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/InstallAction.java
index 64ca93b7d..c74f19f66 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/InstallAction.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/InstallAction.java
@@ -39,7 +39,7 @@ public class InstallAction extends ProfileModificationAction {
for (int i = 0; i < selectionArray.length; i++) {
if (selectionArray[i] instanceof InstalledIUElement && isSelectable((IIUElement) selectionArray[i]))
return true;
- IInstallableUnit iu = (IInstallableUnit) ProvUI.getAdapter(selectionArray[i], IInstallableUnit.class);
+ IInstallableUnit iu = ProvUI.getAdapter(selectionArray[i], IInstallableUnit.class);
if (iu != null && isSelectable(iu))
return true;
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/ProfileModificationAction.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/ProfileModificationAction.java
index ffc6903e3..fdf72dafe 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/ProfileModificationAction.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/ProfileModificationAction.java
@@ -126,7 +126,7 @@ public abstract class ProfileModificationAction extends ProvisioningAction {
protected abstract int performAction(ProfileChangeOperation operation, IInstallableUnit[] ius);
protected IInstallableUnit getIU(Object element) {
- return (IInstallableUnit) ProvUI.getAdapter(element, IInstallableUnit.class);
+ return ProvUI.getAdapter(element, IInstallableUnit.class);
}
@@ -141,8 +141,8 @@ public abstract class ProfileModificationAction extends ProvisioningAction {
* enablement criteria for the action.
*/
protected IInstallableUnit[] getSelectedIUs() {
- List elements = getStructuredSelection().toList();
- List iusList = new ArrayList(elements.size());
+ List<?> elements = getStructuredSelection().toList();
+ List<IInstallableUnit> iusList = new ArrayList<IInstallableUnit>(elements.size());
for (int i = 0; i < elements.size(); i++) {
if (elements.get(i) instanceof IIUElement) {
@@ -150,12 +150,12 @@ public abstract class ProfileModificationAction extends ProvisioningAction {
if (isSelectable(element))
iusList.add(getIU(element));
} else {
- IInstallableUnit iu = (IInstallableUnit) ProvUI.getAdapter(elements.get(i), IInstallableUnit.class);
+ IInstallableUnit iu = ProvUI.getAdapter(elements.get(i), IInstallableUnit.class);
if (iu != null && isSelectable(iu))
iusList.add(iu);
}
}
- return (IInstallableUnit[]) iusList.toArray(new IInstallableUnit[iusList.size()]);
+ return iusList.toArray(new IInstallableUnit[iusList.size()]);
}
protected boolean isSelectable(IIUElement element) {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/UpdateAction.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/UpdateAction.java
index 80d12646a..4b848e5f8 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/UpdateAction.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/UpdateAction.java
@@ -25,7 +25,7 @@ import org.eclipse.jface.viewers.ISelectionProvider;
public class UpdateAction extends ExistingIUInProfileAction {
protected IUElementListRoot root; // root that will be used to seed the wizard
- protected ArrayList initialSelections; // the elements that should be selected in the wizard
+ protected ArrayList<?> initialSelections; // the elements that should be selected in the wizard
boolean resolveIsVisible = true;
boolean skipSelectionPage = false;
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/AvailableIUGroup.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/AvailableIUGroup.java
index 1105ff4bb..0d7882b0c 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/AvailableIUGroup.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/AvailableIUGroup.java
@@ -279,7 +279,7 @@ public class AvailableIUGroup extends StructuredIUGroup {
// overridden to weed out non-IU elements, such as repositories or empty explanations
public Object[] getSelectedIUElements() {
Object[] elements = ((IStructuredSelection) viewer.getSelection()).toArray();
- ArrayList list = new ArrayList(elements.length);
+ ArrayList<Object> list = new ArrayList<Object>(elements.length);
for (int i = 0; i < elements.length; i++)
if (ElementUtils.getIU(elements[i]) != null)
list.add(elements[i]);
@@ -298,15 +298,15 @@ public class AvailableIUGroup extends StructuredIUGroup {
Object[] selections = filteredTree.getCheckboxTreeViewer().getCheckedElements();
if (selections.length == 0)
return new IInstallableUnit[0];
- ArrayList leaves = new ArrayList(selections.length);
+ ArrayList<IInstallableUnit> leaves = new ArrayList<IInstallableUnit>(selections.length);
for (int i = 0; i < selections.length; i++) {
if (!getCheckboxTreeViewer().getGrayed(selections[i])) {
- IInstallableUnit iu = (IInstallableUnit) ProvUI.getAdapter(selections[i], IInstallableUnit.class);
+ IInstallableUnit iu = ProvUI.getAdapter(selections[i], IInstallableUnit.class);
if (iu != null && !ProvUI.isCategory(iu) && !leaves.contains(iu))
leaves.add(iu);
}
}
- return (IInstallableUnit[]) leaves.toArray(new IInstallableUnit[leaves.size()]);
+ return leaves.toArray(new IInstallableUnit[leaves.size()]);
}
public Tree getTree() {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ComboAutoCompleteField.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ComboAutoCompleteField.java
index 34cb29a84..62d1124ee 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ComboAutoCompleteField.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ComboAutoCompleteField.java
@@ -54,7 +54,7 @@ public class ComboAutoCompleteField {
if (contents.length() == 0 || items.length == 0)
return new IContentProposal[0];
StringMatcher matcher = new StringMatcher("*" + contents + "*", true, false); //$NON-NLS-1$ //$NON-NLS-2$
- ArrayList matches = new ArrayList();
+ ArrayList<String> matches = new ArrayList<String>();
for (int i = 0; i < items.length; i++)
if (matcher.match(items[i]))
matches.add(items[i]);
@@ -63,7 +63,7 @@ public class ComboAutoCompleteField {
// what is in the combo. This prevents the popup from
// opening when the user is merely scrolling through the combo values or
// has accepted a combo value.
- if (matches.size() == 1 && ((String) matches.get(0)).equals(combo.getText()))
+ if (matches.size() == 1 && matches.get(0).equals(combo.getText()))
return new IContentProposal[0];
if (matches.isEmpty())
@@ -72,7 +72,7 @@ public class ComboAutoCompleteField {
// Make the proposals
IContentProposal[] proposals = new IContentProposal[matches.size()];
for (int i = 0; i < matches.size(); i++) {
- final String proposal = (String) matches.get(i);
+ final String proposal = matches.get(i);
proposals[i] = new IContentProposal() {
public String getContent() {
@@ -367,7 +367,7 @@ public class ComboAutoCompleteField {
}
}
- Vector temp = new Vector();
+ Vector<String> temp = new Vector<String>();
int pos = 0;
StringBuffer buf = new StringBuffer();
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ContainerCheckedTreeViewer.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ContainerCheckedTreeViewer.java
index b130cf45b..fef8274d3 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ContainerCheckedTreeViewer.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ContainerCheckedTreeViewer.java
@@ -52,7 +52,7 @@ import org.eclipse.swt.widgets.*;
public class ContainerCheckedTreeViewer extends CheckboxTreeViewer {
private boolean rippleCheckMarks = true;
- private ArrayList savedCheckState;
+ private ArrayList<Object> savedCheckState;
/**
* Constructor for ContainerCheckedTreeViewer.
@@ -219,7 +219,7 @@ public class ContainerCheckedTreeViewer extends CheckboxTreeViewer {
public Object[] getCheckedElements() {
Object[] checked = super.getCheckedElements();
// add all items that are children of a checked node but not created yet
- ArrayList result = new ArrayList();
+ ArrayList<Object> result = new ArrayList<Object>();
for (int i = 0; i < checked.length; i++) {
Object curr = checked[i];
result.add(curr);
@@ -241,7 +241,7 @@ public class ContainerCheckedTreeViewer extends CheckboxTreeViewer {
* @param element
* @param result
*/
- private void collectChildren(Object element, ArrayList result) {
+ private void collectChildren(Object element, ArrayList<Object> result) {
Object[] filteredChildren = getFilteredChildren(element);
for (int i = 0; i < filteredChildren.length; i++) {
Object curr = filteredChildren[i];
@@ -276,7 +276,7 @@ public class ContainerCheckedTreeViewer extends CheckboxTreeViewer {
// problem.
private void saveCheckedState() {
Object[] checked = getCheckedElements();
- savedCheckState = new ArrayList(checked.length);
+ savedCheckState = new ArrayList<Object>(checked.length);
for (int i = 0; i < checked.length; i++)
if (!isExpandable(checked[i]) && !getGrayed(checked[i]))
savedCheckState.add(checked[i]);
@@ -288,7 +288,7 @@ public class ContainerCheckedTreeViewer extends CheckboxTreeViewer {
setGrayedElements(new Object[0]);
Object element = null;
// We are assuming that once a leaf, always a leaf.
- Iterator iter = savedCheckState.iterator();
+ Iterator<Object> iter = savedCheckState.iterator();
while (iter.hasNext()) {
element = iter.next();
setChecked(element, true);
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/DelayedFilterCheckboxTree.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/DelayedFilterCheckboxTree.java
index 8d1579d78..5614d4aaf 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/DelayedFilterCheckboxTree.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/DelayedFilterCheckboxTree.java
@@ -48,8 +48,8 @@ public class DelayedFilterCheckboxTree extends FilteredTree {
WorkbenchJob filterJob;
boolean ignoreFiltering = true;
Object viewerInput;
- ArrayList checkState = new ArrayList();
- Set expanded = new HashSet();
+ ArrayList<Object> checkState = new ArrayList<Object>();
+ Set<Object> expanded = new HashSet<Object>();
ContainerCheckedTreeViewer checkboxViewer;
public DelayedFilterCheckboxTree(Composite parent, int treeStyle, PatternFilter filter) {
@@ -66,8 +66,8 @@ public class DelayedFilterCheckboxTree extends FilteredTree {
// We use an additive check state cache so we need to remove
// previously checked items if the user unchecked them.
if (!event.getChecked() && checkState != null) {
- Iterator iter = checkState.iterator();
- ArrayList toRemove = new ArrayList(1);
+ Iterator<Object> iter = checkState.iterator();
+ ArrayList<Object> toRemove = new ArrayList<Object>(1);
while (iter.hasNext()) {
Object element = iter.next();
if (checkboxViewer.getComparer().equals(element, event.getElement())) {
@@ -256,7 +256,7 @@ public class DelayedFilterCheckboxTree extends FilteredTree {
ContainerCheckedTreeViewer v = (ContainerCheckedTreeViewer) getViewer();
Object[] checked = v.getCheckedElements();
if (checkState == null)
- checkState = new ArrayList(checked.length);
+ checkState = new ArrayList<Object>(checked.length);
for (int i = 0; i < checked.length; i++)
if (!v.getGrayed(checked[i]) && contentProvider.getChildren(checked[i]).length == 0)
if (!checkState.contains(checked[i]))
@@ -273,7 +273,7 @@ public class DelayedFilterCheckboxTree extends FilteredTree {
checkboxViewer.setGrayedElements(new Object[0]);
// Now we are only going to set the check state of the leaf nodes
// and rely on our container checked code to update the parents properly.
- Iterator iter = checkState.iterator();
+ Iterator<Object> iter = checkState.iterator();
Object element = null;
if (iter.hasNext())
checkboxViewer.expandAll();
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/IUPropertyPage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/IUPropertyPage.java
index 491ba1201..5109868fd 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/IUPropertyPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/IUPropertyPage.java
@@ -35,7 +35,7 @@ public abstract class IUPropertyPage extends PropertyPage {
protected Control createContents(Composite parent) {
noDefaultAndApplyButton();
- IInstallableUnit iu = (IInstallableUnit) ProvUI.getAdapter(getElement(), IInstallableUnit.class);
+ IInstallableUnit iu = ProvUI.getAdapter(getElement(), IInstallableUnit.class);
Control control;
if (iu == null) {
Label label = new Label(parent, SWT.DEFAULT);
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/InstallWizard.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/InstallWizard.java
index 0c3f1db63..1bf65a96d 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/InstallWizard.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/InstallWizard.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.ui.dialogs;
+import org.eclipse.equinox.internal.p2.ui.model.AvailableIUElement;
+
import java.util.ArrayList;
import org.eclipse.equinox.internal.p2.ui.ProvUIImages;
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
@@ -56,8 +58,8 @@ public class InstallWizard extends WizardWithLicenses {
if (selectedElements == null)
return;
root = new IUElementListRoot();
- ArrayList list = new ArrayList(selectedElements.length);
- ArrayList selections = new ArrayList(selectedElements.length);
+ ArrayList<AvailableIUElement> list = new ArrayList<AvailableIUElement>(selectedElements.length);
+ ArrayList<AvailableIUElement> selections = new ArrayList<AvailableIUElement>(selectedElements.length);
for (int i = 0; i < selectedElements.length; i++) {
IInstallableUnit iu = ElementUtils.getIU(selectedElements[i]);
if (iu != null) {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/PreselectedIUInstallWizard.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/PreselectedIUInstallWizard.java
index 9b3ca8fb7..45d4f22dc 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/PreselectedIUInstallWizard.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/PreselectedIUInstallWizard.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.ui.dialogs;
+import org.eclipse.equinox.internal.p2.ui.model.AvailableIUElement;
+
import java.util.ArrayList;
import org.eclipse.equinox.internal.p2.ui.*;
import org.eclipse.equinox.internal.p2.ui.model.*;
@@ -49,8 +51,8 @@ public class PreselectedIUInstallWizard extends WizardWithLicenses {
protected void initializeResolutionModelElements(Object[] selectedElements) {
root = new IUElementListRoot();
- ArrayList list = new ArrayList(selectedElements.length);
- ArrayList selected = new ArrayList(selectedElements.length);
+ ArrayList<AvailableIUElement> list = new ArrayList<AvailableIUElement>(selectedElements.length);
+ ArrayList<AvailableIUElement> selected = new ArrayList<AvailableIUElement>(selectedElements.length);
for (int i = 0; i < selectedElements.length; i++) {
IInstallableUnit iu = ElementUtils.getIU(selectedElements[i]);
if (iu != null) {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ProvisioningOperationWizard.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ProvisioningOperationWizard.java
index 8b3a0e512..f2d38fe8c 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ProvisioningOperationWizard.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ProvisioningOperationWizard.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.ui.dialogs;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import java.util.HashSet;
@@ -125,10 +127,10 @@ public abstract class ProvisioningOperationWizard extends Wizard {
}
private boolean pageSelectionsHaveChanged(ISelectableIUsPage page) {
- HashSet selectedIUs = new HashSet();
+ HashSet<IInstallableUnit> selectedIUs = new HashSet<IInstallableUnit>();
Object[] currentSelections = page.getCheckedIUElements();
selectedIUs.addAll(Arrays.asList(ElementUtils.elementsToIUs(currentSelections)));
- HashSet lastIUSelections = new HashSet();
+ HashSet<IInstallableUnit> lastIUSelections = new HashSet<IInstallableUnit>();
lastIUSelections.addAll(Arrays.asList(ElementUtils.elementsToIUs(planSelections)));
return !(selectedIUs.equals(lastIUSelections));
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositorySelectionGroup.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositorySelectionGroup.java
index 8b6ca400f..25d2a612f 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositorySelectionGroup.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositorySelectionGroup.java
@@ -75,7 +75,7 @@ public class RepositorySelectionGroup {
Image info, warning, error;
URI[] comboRepos; // the URIs shown in the combo, kept in sync with combo items
- HashMap disabledRepoProposals = new HashMap(); // proposal string -> disabled URI
+ HashMap<String, URI> disabledRepoProposals = new HashMap<String, URI>(); // proposal string -> disabled URI
public RepositorySelectionGroup(ProvisioningUI ui, IWizardContainer container, Composite parent, IUViewQueryContext queryContext) {
this.container = container;
@@ -396,18 +396,18 @@ public class RepositorySelectionGroup {
int sortEnd = hasLocalSites ? strings.length - 2 : strings.length - 1;
if (sortStart >= sortEnd)
return;
- final HashMap uriToString = new HashMap();
+ final HashMap<URI, String> uriToString = new HashMap<URI, String>();
for (int i = sortStart; i <= sortEnd; i++) {
uriToString.put(locations[i], strings[i]);
}
final Collator collator = Collator.getInstance(Locale.getDefault());
- Comparator stringComparator = new Comparator() {
- public int compare(Object a, Object b) {
+ Comparator<String> stringComparator = new Comparator<String>() {
+ public int compare(String a, String b) {
return collator.compare(a, b);
}
};
- Comparator uriComparator = new Comparator() {
- public int compare(Object a, Object b) {
+ Comparator<URI> uriComparator = new Comparator<URI>() {
+ public int compare(URI a, URI b) {
return collator.compare(uriToString.get(a), uriToString.get(b));
}
};
@@ -426,7 +426,7 @@ public class RepositorySelectionGroup {
int flags = ui.getRepositoryTracker().getMetadataRepositoryFlags() | IRepositoryManager.REPOSITORIES_DISABLED;
String[] items = repoCombo.getItems();
// Clear any previously remembered disabled repos
- disabledRepoProposals = new HashMap();
+ disabledRepoProposals = new HashMap<String, URI>();
URI[] disabled = ui.getSession().getMetadataRepositoryManager().getKnownRepositories(flags);
String[] disabledItems = new String[disabled.length];
for (int i = 0; i < disabledItems.length; i++) {
@@ -531,7 +531,7 @@ public class RepositorySelectionGroup {
IStatus status;
// This might be a disabled repo. If so, no need to validate further.
if (disabledRepoProposals.containsKey(selectedRepo)) {
- location = (URI) disabledRepoProposals.get(selectedRepo);
+ location = disabledRepoProposals.get(selectedRepo);
status = Status.OK_STATUS;
} else {
location = manipulator.locationFromString(selectedRepo);
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionResultsWizardPage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionResultsWizardPage.java
index 4bbfea477..2df6739d4 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionResultsWizardPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionResultsWizardPage.java
@@ -206,7 +206,7 @@ public abstract class ResolutionResultsWizardPage extends ResolutionStatusPage {
return new TreeViewer(parent, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
}
- protected abstract IQueryable getQueryable(IProvisioningPlan plan);
+ protected abstract IQueryable<IInstallableUnit> getQueryable(IProvisioningPlan plan);
protected String getClipboardText(Control control) {
return CopyUtils.getIndentedClipboardText(getSelectedElements(), labelProvider);
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/SelectableIUsPage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/SelectableIUsPage.java
index 75f8a82f2..7e83e395f 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/SelectableIUsPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/SelectableIUsPage.java
@@ -201,7 +201,7 @@ public class SelectableIUsPage extends ResolutionStatusPage implements IResoluti
protected IInstallableUnit[] elementsToIUs(Object[] elements) {
IInstallableUnit[] theIUs = new IInstallableUnit[elements.length];
for (int i = 0; i < elements.length; i++) {
- theIUs[i] = (IInstallableUnit) ProvUI.getAdapter(elements[i], IInstallableUnit.class);
+ theIUs[i] = ProvUI.getAdapter(elements[i], IInstallableUnit.class);
}
return theIUs;
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/SizeComputingWizardPage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/SizeComputingWizardPage.java
index 989c5a0f4..ede6f9934 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/SizeComputingWizardPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/SizeComputingWizardPage.java
@@ -18,6 +18,7 @@ import org.eclipse.equinox.internal.p2.ui.model.IUElementListRoot;
import org.eclipse.equinox.internal.provisional.p2.metadata.query.IQueryable;
import org.eclipse.equinox.p2.engine.IProvisioningPlan;
import org.eclipse.equinox.p2.engine.ProvisioningContext;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.operations.ProfileChangeOperation;
import org.eclipse.equinox.p2.operations.ProvisioningSession;
import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob;
@@ -125,7 +126,7 @@ public abstract class SizeComputingWizardPage extends ResolutionResultsWizardPag
computeSizing(op.getProvisioningPlan(), op.getProvisioningContext());
}
- protected IQueryable getQueryable(IProvisioningPlan plan) {
+ protected IQueryable<IInstallableUnit> getQueryable(IProvisioningPlan plan) {
return plan.getAdditions();
}
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UninstallWizard.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UninstallWizard.java
index 6f01e1a1e..e5cb26203 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UninstallWizard.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UninstallWizard.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.ui.dialogs;
+import org.eclipse.equinox.internal.p2.ui.model.InstalledIUElement;
+
import java.util.ArrayList;
import org.eclipse.equinox.internal.p2.ui.ProvUIImages;
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
@@ -46,8 +48,8 @@ public class UninstallWizard extends ProvisioningOperationWizard {
protected void initializeResolutionModelElements(Object[] selectedElements) {
root = new IUElementListRoot();
- ArrayList list = new ArrayList(selectedElements.length);
- ArrayList selections = new ArrayList(selectedElements.length);
+ ArrayList<InstalledIUElement> list = new ArrayList<InstalledIUElement>(selectedElements.length);
+ ArrayList<InstalledIUElement> selections = new ArrayList<InstalledIUElement>(selectedElements.length);
for (int i = 0; i < selectedElements.length; i++) {
IInstallableUnit iu = ElementUtils.getIU(selectedElements[i]);
if (iu != null) {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UninstallWizardPage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UninstallWizardPage.java
index 72845e5a3..6ec19eb1f 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UninstallWizardPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UninstallWizardPage.java
@@ -14,6 +14,7 @@ import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
import org.eclipse.equinox.internal.p2.ui.model.IUElementListRoot;
import org.eclipse.equinox.internal.provisional.p2.metadata.query.IQueryable;
import org.eclipse.equinox.p2.engine.IProvisioningPlan;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.operations.UninstallOperation;
import org.eclipse.equinox.p2.ui.ProvisioningUI;
@@ -33,7 +34,7 @@ public class UninstallWizardPage extends ResolutionResultsWizardPage {
return ProvUIMessages.UninstallIUOperationTask;
}
- protected IQueryable getQueryable(IProvisioningPlan plan) {
+ protected IQueryable<IInstallableUnit> getQueryable(IProvisioningPlan plan) {
return plan.getRemovals();
}
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UpdateWizard.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UpdateWizard.java
index e1a966032..46b375868 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UpdateWizard.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UpdateWizard.java
@@ -31,33 +31,33 @@ public class UpdateWizard extends WizardWithLicenses {
boolean skipSelectionsPage = false;
public static IInstallableUnit[] getIUsToReplace(Object[] elements) {
- Set iusToReplace = new HashSet();
+ Set<IInstallableUnit> iusToReplace = new HashSet<IInstallableUnit>();
for (int i = 0; i < elements.length; i++) {
if (elements[i] instanceof AvailableUpdateElement) {
iusToReplace.add(((AvailableUpdateElement) elements[i]).getIUToBeUpdated());
}
}
- return (IInstallableUnit[]) iusToReplace.toArray(new IInstallableUnit[iusToReplace.size()]);
+ return iusToReplace.toArray(new IInstallableUnit[iusToReplace.size()]);
}
public static IInstallableUnit[] getReplacementIUs(Object[] elements) {
- Set replacements = new HashSet();
+ Set<IInstallableUnit> replacements = new HashSet<IInstallableUnit>();
for (int i = 0; i < elements.length; i++) {
if (elements[i] instanceof AvailableUpdateElement) {
replacements.add(((AvailableUpdateElement) elements[i]).getIU());
}
}
- return (IInstallableUnit[]) replacements.toArray(new IInstallableUnit[replacements.size()]);
+ return replacements.toArray(new IInstallableUnit[replacements.size()]);
}
public static Update[] makeUpdatesFromElements(Object[] elements) {
- Set updates = new HashSet();
+ Set<Update> updates = new HashSet<Update>();
for (int i = 0; i < elements.length; i++) {
if (elements[i] instanceof AvailableUpdateElement) {
updates.add(((AvailableUpdateElement) elements[i]).getUpdate());
}
}
- return (Update[]) updates.toArray(new Update[updates.size()]);
+ return updates.toArray(new Update[updates.size()]);
}
public UpdateWizard(ProvisioningUI ui, UpdateOperation operation, Object[] initialSelections, LoadMetadataRepositoryJob preloadJob) {
@@ -80,8 +80,8 @@ public class UpdateWizard extends WizardWithLicenses {
protected void initializeResolutionModelElements(Object[] selectedElements) {
root = new IUElementListRoot();
- ArrayList list = new ArrayList(selectedElements.length);
- ArrayList selected = new ArrayList(selectedElements.length);
+ ArrayList<AvailableUpdateElement> list = new ArrayList<AvailableUpdateElement>(selectedElements.length);
+ ArrayList<AvailableUpdateElement> selected = new ArrayList<AvailableUpdateElement>(selectedElements.length);
for (int i = 0; i < selectedElements.length; i++) {
if (selectedElements[i] instanceof AvailableUpdateElement) {
AvailableUpdateElement element = (AvailableUpdateElement) selectedElements[i];
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ArtifactElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ArtifactElement.java
index 4f19a63de..9ba9f4a7b 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ArtifactElement.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ArtifactElement.java
@@ -46,6 +46,7 @@ public class ArtifactElement extends ProvElement {
return repo.getArtifactDescriptors(key);
}
+ @SuppressWarnings("rawtypes")
public Object getAdapter(Class adapter) {
if (adapter == IArtifactRepository.class)
return getArtifactRepository();
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ArtifactRepositoryElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ArtifactRepositoryElement.java
index d4d248c61..c7f331cab 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ArtifactRepositoryElement.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ArtifactRepositoryElement.java
@@ -15,6 +15,7 @@ import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.ui.*;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
import org.eclipse.equinox.internal.provisional.p2.metadata.query.IQueryable;
+import org.eclipse.equinox.p2.metadata.IArtifactKey;
import org.eclipse.equinox.p2.repository.IRepository;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
import org.eclipse.equinox.p2.ui.ProvisioningUI;
@@ -26,7 +27,7 @@ import org.eclipse.osgi.util.NLS;
*
* @since 3.4
*/
-public class ArtifactRepositoryElement extends RemoteQueriedElement implements IRepositoryElement {
+public class ArtifactRepositoryElement extends RemoteQueriedElement implements IRepositoryElement<IArtifactKey> {
URI location;
IArtifactRepository repo;
@@ -44,6 +45,7 @@ public class ArtifactRepositoryElement extends RemoteQueriedElement implements I
ui = ProvUIActivator.getDefault().getProvisioningUI();
}
+ @SuppressWarnings("rawtypes")
public Object getAdapter(Class adapter) {
if (adapter == IArtifactRepository.class)
return getRepository(null);
@@ -64,7 +66,7 @@ public class ArtifactRepositoryElement extends RemoteQueriedElement implements I
return URIUtil.toUnencodedString(getLocation());
}
- public IRepository getRepository(IProgressMonitor monitor) {
+ public IArtifactRepository getRepository(IProgressMonitor monitor) {
if (repo == null)
try {
repo = ui.getSession().getArtifactRepositoryManager().loadRepository(location, monitor);
@@ -133,7 +135,7 @@ public class ArtifactRepositoryElement extends RemoteQueriedElement implements I
* (non-Javadoc)
* @see org.eclipse.equinox.internal.provisional.p2.ui.query.QueriedElement#getQueryable()
*/
- public IQueryable getQueryable() {
+ public IQueryable<?> getQueryable() {
if (queryable == null)
queryable = getRepository(new NullProgressMonitor());
return queryable;
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/AvailableIUElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/AvailableIUElement.java
index ad037b059..bc6cbf5aa 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/AvailableIUElement.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/AvailableIUElement.java
@@ -11,6 +11,7 @@
package org.eclipse.equinox.internal.p2.ui.model;
import java.net.URI;
+import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.equinox.internal.p2.ui.ProvUIImages;
@@ -69,6 +70,7 @@ public class AvailableIUElement extends QueriedElement implements IIUElement {
return iu.getId();
}
+ @SuppressWarnings("rawtypes")
public Object getAdapter(Class adapter) {
if (adapter == IInstallableUnit.class)
return iu;
@@ -119,7 +121,7 @@ public class AvailableIUElement extends QueriedElement implements IIUElement {
/* (non-Javadoc)
* @see org.eclipse.equinox.internal.p2.ui.model.IUElement#getRequirements()
*/
- public IRequirement[] getRequirements() {
+ public List<IRequirement> getRequirements() {
return iu.getRequiredCapabilities();
}
@@ -171,8 +173,8 @@ public class AvailableIUElement extends QueriedElement implements IIUElement {
}
private ProvisioningContext getProvisioningContext() {
- if (hasQueryable() && getQueryable() instanceof IRepository)
- return new ProvisioningContext(new URI[] {((IRepository) getQueryable()).getLocation()});
+ if (hasQueryable() && getQueryable() instanceof IRepository<?>)
+ return new ProvisioningContext(new URI[] {((IRepository<?>) getQueryable()).getLocation()});
return new ProvisioningContext();
}
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/CategoryElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/CategoryElement.java
index cb4526b63..05ead28ec 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/CategoryElement.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/CategoryElement.java
@@ -12,6 +12,7 @@ package org.eclipse.equinox.internal.p2.ui.model;
import java.util.*;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils;
import org.eclipse.equinox.internal.p2.ui.ProvUIImages;
import org.eclipse.equinox.internal.p2.ui.QueryProvider;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
@@ -26,8 +27,8 @@ import org.eclipse.equinox.p2.operations.ProvisioningSession;
*/
public class CategoryElement extends RemoteQueriedElement implements IIUElement {
- private ArrayList ius = new ArrayList(1);
- private IRequirement[] requirements;
+ private ArrayList<IInstallableUnit> ius = new ArrayList<IInstallableUnit>(1);
+ private List<IRequirement> requirements;
public CategoryElement(Object parent, IInstallableUnit iu) {
super(parent);
@@ -50,6 +51,7 @@ public class CategoryElement extends RemoteQueriedElement implements IIUElement
return null;
}
+ @SuppressWarnings("rawtypes")
public Object getAdapter(Class adapter) {
if (adapter == IInstallableUnit.class)
return getIU();
@@ -63,7 +65,7 @@ public class CategoryElement extends RemoteQueriedElement implements IIUElement
public IInstallableUnit getIU() {
if (ius == null || ius.isEmpty())
return null;
- return (IInstallableUnit) ius.get(0);
+ return ius.get(0);
}
public long getSize() {
@@ -101,20 +103,20 @@ public class CategoryElement extends RemoteQueriedElement implements IIUElement
return mergeKey;
}
- public IRequirement[] getRequirements() {
+ public List<IRequirement> getRequirements() {
if (ius == null || ius.isEmpty())
- return new IRequirement[0];
+ return CollectionUtils.emptyList();
if (requirements == null) {
if (ius.size() == 1)
requirements = getIU().getRequiredCapabilities();
else {
- ArrayList capabilities = new ArrayList();
- Iterator iter = ius.iterator();
+ ArrayList<IRequirement> capabilities = new ArrayList<IRequirement>();
+ Iterator<IInstallableUnit> iter = ius.iterator();
while (iter.hasNext()) {
- IInstallableUnit iu = (IInstallableUnit) iter.next();
- capabilities.addAll(Arrays.asList(iu.getRequiredCapabilities()));
+ IInstallableUnit iu = iter.next();
+ capabilities.addAll(iu.getRequiredCapabilities());
}
- requirements = (IRequirement[]) capabilities.toArray(new IRequirement[capabilities.size()]);
+ requirements = capabilities;
}
}
return requirements;
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ElementUtils.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ElementUtils.java
index a6b780595..b75a0d8ee 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ElementUtils.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ElementUtils.java
@@ -73,7 +73,7 @@ public class ElementUtils {
}
// Are there any elements that need to be deleted? Go over the original state
// and remove any elements that weren't in the elements we were given
- Set nowKnown = new HashSet();
+ Set<String> nowKnown = new HashSet<String>();
for (int i = 0; i < elements.length; i++)
nowKnown.add(URIUtil.toUnencodedString(elements[i].getLocation()));
for (int i = 0; i < currentlyEnabled.length; i++) {
@@ -107,17 +107,17 @@ public class ElementUtils {
return (IInstallableUnit) element;
if (element instanceof IIUElement)
return ((IIUElement) element).getIU();
- return (IInstallableUnit) ProvUI.getAdapter(element, IInstallableUnit.class);
+ return ProvUI.getAdapter(element, IInstallableUnit.class);
}
public static IInstallableUnit[] elementsToIUs(Object[] elements) {
- ArrayList theIUs = new ArrayList(elements.length);
+ ArrayList<IInstallableUnit> theIUs = new ArrayList<IInstallableUnit>(elements.length);
for (int i = 0; i < elements.length; i++) {
- IInstallableUnit iu = (IInstallableUnit) ProvUI.getAdapter(elements[i], IInstallableUnit.class);
+ IInstallableUnit iu = ProvUI.getAdapter(elements[i], IInstallableUnit.class);
if (iu != null)
theIUs.add(iu);
}
- return (IInstallableUnit[]) theIUs.toArray(new IInstallableUnit[theIUs.size()]);
+ return theIUs.toArray(new IInstallableUnit[theIUs.size()]);
}
static boolean containsURI(URI[] locations, URI url) {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/IIUElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/IIUElement.java
index 15513b800..061ea535a 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/IIUElement.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/IIUElement.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.ui.model;
+import java.util.List;
+
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.IRequirement;
@@ -31,7 +33,7 @@ public interface IIUElement {
public void computeSize(IProgressMonitor monitor);
- public IRequirement[] getRequirements();
+ public List<IRequirement> getRequirements();
public Object getParent(Object obj);
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/IRepositoryElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/IRepositoryElement.java
index 21bfcda7f..f2890b704 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/IRepositoryElement.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/IRepositoryElement.java
@@ -19,7 +19,7 @@ import org.eclipse.equinox.p2.repository.IRepository;
*
* @since 3.4
*/
-public interface IRepositoryElement {
+public interface IRepositoryElement<T> {
public URI getLocation();
@@ -31,5 +31,5 @@ public interface IRepositoryElement {
public void setEnabled(boolean enabled);
- public IRepository getRepository(IProgressMonitor monitor);
+ public IRepository<T> getRepository(IProgressMonitor monitor);
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/InstalledIUElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/InstalledIUElement.java
index 3013f5592..7424086d1 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/InstalledIUElement.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/InstalledIUElement.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.ui.model;
+import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.equinox.internal.p2.ui.ProvUIImages;
import org.eclipse.equinox.internal.p2.ui.QueryProvider;
@@ -47,6 +48,7 @@ public class InstalledIUElement extends QueriedElement implements IIUElement {
return iu.getId();
}
+ @SuppressWarnings("rawtypes")
public Object getAdapter(Class adapter) {
if (adapter == IInstallableUnit.class)
return iu;
@@ -82,7 +84,7 @@ public class InstalledIUElement extends QueriedElement implements IIUElement {
/* (non-Javadoc)
* @see org.eclipse.equinox.internal.p2.ui.model.IUElement#getRequirements()
*/
- public IRequirement[] getRequirements() {
+ public List<IRequirement> getRequirements() {
return iu.getRequiredCapabilities();
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/MetadataRepositoryElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/MetadataRepositoryElement.java
index 332979556..952c2298b 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/MetadataRepositoryElement.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/MetadataRepositoryElement.java
@@ -18,6 +18,7 @@ import org.eclipse.equinox.internal.p2.ui.*;
import org.eclipse.equinox.internal.p2.ui.query.IUViewQueryContext;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
import org.eclipse.equinox.internal.provisional.p2.metadata.query.IQueryable;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.operations.ProvisioningSession;
import org.eclipse.equinox.p2.repository.IRepository;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
@@ -33,7 +34,7 @@ import org.eclipse.equinox.p2.ui.ProvisioningUI;
*
* @since 3.4
*/
-public class MetadataRepositoryElement extends RootElement implements IRepositoryElement {
+public class MetadataRepositoryElement extends RootElement implements IRepositoryElement<IInstallableUnit> {
URI location;
boolean isEnabled;
@@ -53,6 +54,7 @@ public class MetadataRepositoryElement extends RootElement implements IRepositor
this.isEnabled = isEnabled;
}
+ @SuppressWarnings("rawtypes")
public Object getAdapter(Class adapter) {
if (adapter == IMetadataRepository.class)
return getQueryable();
@@ -98,13 +100,13 @@ public class MetadataRepositoryElement extends RootElement implements IRepositor
* (non-Javadoc)
* @see org.eclipse.equinox.internal.provisional.p2.ui.query.QueriedElement#getQueryable()
*/
- public IQueryable getQueryable() {
+ public IQueryable<?> getQueryable() {
if (queryable == null)
queryable = getRepository(new NullProgressMonitor());
return queryable;
}
- public IRepository getRepository(IProgressMonitor monitor) {
+ public IMetadataRepository getRepository(IProgressMonitor monitor) {
try {
return getMetadataRepository(monitor);
} catch (ProvisionException e) {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ProfileElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ProfileElement.java
index acb2c3059..c2836b831 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ProfileElement.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ProfileElement.java
@@ -29,6 +29,7 @@ public class ProfileElement extends RemoteQueriedElement {
this.profileId = profileId;
}
+ @SuppressWarnings("rawtypes")
public Object getAdapter(Class adapter) {
if (adapter == IProfile.class)
return getQueryable();
@@ -51,7 +52,7 @@ public class ProfileElement extends RemoteQueriedElement {
return QueryProvider.INSTALLED_IUS;
}
- public IQueryable getQueryable() {
+ public IQueryable<?> getQueryable() {
return getProvisioningUI().getSession().getProfileRegistry().getProfile(profileId);
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ProvElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ProvElement.java
index 2c23d8740..047bd7034 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ProvElement.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ProvElement.java
@@ -34,6 +34,7 @@ public abstract class ProvElement implements IWorkbenchAdapter, IAdaptable {
this.parent = parent;
}
+ @SuppressWarnings("rawtypes")
public Object getAdapter(Class adapter) {
if (adapter == IWorkbenchAdapter.class)
return this;
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/QueriedElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/QueriedElement.java
index b3b9e274e..1b1088518 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/QueriedElement.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/QueriedElement.java
@@ -13,6 +13,7 @@ package org.eclipse.equinox.internal.p2.ui.model;
import java.util.*;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils;
import org.eclipse.equinox.internal.p2.ui.*;
import org.eclipse.equinox.internal.p2.ui.query.IUViewQueryContext;
import org.eclipse.equinox.internal.provisional.p2.metadata.query.IQueryable;
@@ -28,11 +29,11 @@ import org.eclipse.equinox.p2.ui.ProvisioningUI;
*/
public abstract class QueriedElement extends ProvElement {
- protected IQueryable queryable;
+ protected IQueryable<?> queryable;
// This cache is used internally to facilitate child elements
// that want to eliminate duplicates from the parent hierarchy.
// This cache is *not* used as a general purpose child cache.
- private Collection cachedChildren;
+ private Collection<?> cachedChildren;
protected QueriedElement(Object parent) {
super(parent);
@@ -95,16 +96,16 @@ public abstract class QueriedElement extends ProvElement {
}
protected Object[] fetchChildren(Object o, IProgressMonitor monitor) {
- cachedChildren = Collections.EMPTY_LIST;
+ cachedChildren = CollectionUtils.emptyList();
if (getQueryProvider() == null)
return new Object[0];
ElementQueryDescriptor queryDescriptor = getQueryProvider().getQueryDescriptor(this);
if (queryDescriptor == null)
return new Object[0];
- Collection results = queryDescriptor.performQuery(monitor);
+ Collection<?> results = queryDescriptor.performQuery(monitor);
cachedChildren = Collections.unmodifiableCollection(results);
if (results.size() > 0) {
- Collection returnedChildren = new HashSet();
+ Collection<Object> returnedChildren = new HashSet<Object>();
returnedChildren.addAll(results);
Object[] siblings = getSiblings();
for (int i = 0; i < siblings.length; i++) {
@@ -115,11 +116,11 @@ public abstract class QueriedElement extends ProvElement {
return new Object[0];
}
- public void setQueryable(IQueryable queryable) {
+ public void setQueryable(IQueryable<?> queryable) {
this.queryable = queryable;
}
- public IQueryable getQueryable() {
+ public IQueryable<?> getQueryable() {
return queryable;
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/QueriedElementWrapper.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/QueriedElementWrapper.java
index 8e86302e8..f8180964d 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/QueriedElementWrapper.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/QueriedElementWrapper.java
@@ -31,13 +31,13 @@ import org.eclipse.osgi.util.NLS;
*/
public abstract class QueriedElementWrapper extends ElementWrapper {
- protected IQueryable queryable;
+ protected IQueryable<?> queryable;
protected Object parent;
protected String emptyExplanationString;
protected int emptyExplanationSeverity;
protected String emptyExplanationDescription;
- public QueriedElementWrapper(IQueryable queryable, Object parent) {
+ public QueriedElementWrapper(IQueryable<?> queryable, Object parent) {
this.queryable = queryable;
this.parent = parent;
}
@@ -55,7 +55,7 @@ public abstract class QueriedElementWrapper extends ElementWrapper {
return item;
}
- public Collection getElements(Collector collector) {
+ public Collection<?> getElements(Collector<?> collector) {
// Any previously stored explanations are not valid.
emptyExplanationString = null;
emptyExplanationSeverity = IStatus.INFO;
@@ -87,7 +87,7 @@ public abstract class QueriedElementWrapper extends ElementWrapper {
// It is empty, but the parent is an IU, so this could be a drilldown.
return Collections.EMPTY_LIST;
}
- Collection elements = super.getElements(collector);
+ Collection<?> elements = super.getElements(collector);
// We had elements but now they have been filtered out. Hopefully
// we can explain this.
if (elements.isEmpty()) {
@@ -100,8 +100,8 @@ public abstract class QueriedElementWrapper extends ElementWrapper {
return elements;
}
- Collection emptyExplanation(int severity, String explanationString, String explanationDescription) {
- ArrayList collection = new ArrayList(1);
+ Collection<?> emptyExplanation(int severity, String explanationString, String explanationDescription) {
+ ArrayList<Object> collection = new ArrayList<Object>(1);
collection.add(new EmptyElementExplanation(parent, severity, explanationString, explanationDescription));
return collection;
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/RollbackProfileElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/RollbackProfileElement.java
index 24216eceb..78b02cdda 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/RollbackProfileElement.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/RollbackProfileElement.java
@@ -51,6 +51,7 @@ public class RollbackProfileElement extends RemoteQueriedElement {
return DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.LONG).format(new Date(timestamp));
}
+ @SuppressWarnings("rawtypes")
public Object getAdapter(Class adapter) {
if (adapter == IProfile.class)
return getProfileSnapshot(new NullProgressMonitor());
@@ -89,7 +90,7 @@ public class RollbackProfileElement extends RemoteQueriedElement {
* (non-Javadoc)
* @see org.eclipse.equinox.internal.p2.ui.model.QueriedElement#getQueryable()
*/
- public IQueryable getQueryable() {
+ public IQueryable<?> getQueryable() {
return getProfileSnapshot(new NullProgressMonitor());
}
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/ArtifactRepositoryElementWrapper.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/ArtifactRepositoryElementWrapper.java
index c8a4931cd..10c8b33ec 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/ArtifactRepositoryElementWrapper.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/ArtifactRepositoryElementWrapper.java
@@ -24,7 +24,7 @@ import org.eclipse.equinox.p2.ui.ProvisioningUI;
*/
public class ArtifactRepositoryElementWrapper extends QueriedElementWrapper {
- public ArtifactRepositoryElementWrapper(IQueryable queryable, Object parent) {
+ public ArtifactRepositoryElementWrapper(IQueryable<URI> queryable, Object parent) {
super(queryable, parent);
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/AvailableIUWrapper.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/AvailableIUWrapper.java
index d7337dcfc..4504ccf66 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/AvailableIUWrapper.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/AvailableIUWrapper.java
@@ -36,7 +36,7 @@ public class AvailableIUWrapper extends QueriedElementWrapper {
private boolean hideInstalledIUs = false;
private boolean drillDownChild = false;
- public AvailableIUWrapper(IQueryable queryable, Object parent, boolean makeCategories, boolean makeDrillDownChild) {
+ public AvailableIUWrapper(IQueryable<?> queryable, Object parent, boolean makeCategories, boolean makeDrillDownChild) {
super(queryable, parent);
this.makeCategories = makeCategories;
this.drillDownChild = makeDrillDownChild;
@@ -62,7 +62,7 @@ public class AvailableIUWrapper extends QueriedElementWrapper {
InformationCache cache = null;
protected boolean shouldWrap(Object match) {
- IInstallableUnit iu = (IInstallableUnit) ProvUI.getAdapter(match, IInstallableUnit.class);
+ IInstallableUnit iu = ProvUI.getAdapter(match, IInstallableUnit.class);
cache = computeIUInformation(iu); // Cache the result
// if we are hiding, hide anything that is the same iu or older
@@ -83,11 +83,11 @@ public class AvailableIUWrapper extends QueriedElementWrapper {
boolean isUpdate = false;
boolean isInstalled = false;
if (profile != null && iu != null) {
- IQueryResult queryResult = profile.query(new InstallableUnitQuery(iu.getId()), null);
- Iterator iter = queryResult.iterator();
+ IQueryResult<IInstallableUnit> queryResult = profile.query(new InstallableUnitQuery(iu.getId()), null);
+ Iterator<IInstallableUnit> iter = queryResult.iterator();
// We are typically iterating over only one IU unless it's a non-singleton.
while (iter.hasNext()) {
- IInstallableUnit installed = (IInstallableUnit) iter.next();
+ IInstallableUnit installed = iter.next();
if (installed.getVersion().compareTo(iu.getVersion()) < 0)
isUpdate = true;
else {
@@ -101,7 +101,7 @@ public class AvailableIUWrapper extends QueriedElementWrapper {
}
protected Object wrap(Object item) {
- IInstallableUnit iu = (IInstallableUnit) ProvUI.getAdapter(item, IInstallableUnit.class);
+ IInstallableUnit iu = ProvUI.getAdapter(item, IInstallableUnit.class);
boolean isUpdate = false;
boolean isInstalled = false;
if (cache != null && cache.item == item) {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/CategoryElementWrapper.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/CategoryElementWrapper.java
index 4049b9a24..58d813bfd 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/CategoryElementWrapper.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/CategoryElementWrapper.java
@@ -29,25 +29,26 @@ import org.eclipse.equinox.p2.metadata.IRequirement;
public class CategoryElementWrapper extends QueriedElementWrapper {
// Used to track nested categories
- private Set referredIUs = new HashSet();
+ private Set<String> referredIUs = new HashSet<String>();
- public CategoryElementWrapper(IQueryable queryable, Object parent) {
+ public CategoryElementWrapper(IQueryable<?> queryable, Object parent) {
super(queryable, parent);
}
protected boolean shouldWrap(Object match) {
if (match instanceof IInstallableUnit) {
IInstallableUnit iu = (IInstallableUnit) match;
- IRequirement[] requirements = iu.getRequiredCapabilities();
- for (int i = 0; i < requirements.length; i++) {
- if (requirements[i] instanceof IRequiredCapability) {
- if (((IRequiredCapability) requirements[i]).getNamespace().equals(IInstallableUnit.NAMESPACE_IU_ID)) {
- referredIUs.add(((IRequiredCapability) requirements[i]).getName());
+ List<IRequirement> requirements = iu.getRequiredCapabilities();
+ for (int i = 0; i < requirements.size(); i++) {
+ IRequirement requirement = requirements.get(i);
+ if (requirement instanceof IRequiredCapability) {
+ if (((IRequiredCapability) requirement).getNamespace().equals(IInstallableUnit.NAMESPACE_IU_ID)) {
+ referredIUs.add(((IRequiredCapability) requirement).getName());
}
}
}
- Iterator iter = super.getCollection().iterator();
+ Iterator<?> iter = super.getCollection().iterator();
// Don't add the same category IU twice.
while (iter.hasNext()) {
CategoryElement element = (CategoryElement) iter.next();
@@ -62,10 +63,10 @@ public class CategoryElementWrapper extends QueriedElementWrapper {
return false;
}
- public Collection getElements(Collector collector) {
+ public Collection<?> getElements(Collector<?> collector) {
if (collector.isEmpty())
return super.getElements(collector);
- Collection results = super.getElements(collector);
+ Collection<?> results = super.getElements(collector);
cleanList();
return results;
}
@@ -80,7 +81,7 @@ public class CategoryElementWrapper extends QueriedElementWrapper {
}
private void removeNestedCategories() {
- CategoryElement[] categoryIUs = (CategoryElement[]) getCollection().toArray(new CategoryElement[getCollection().size()]);
+ CategoryElement[] categoryIUs = getCollection().toArray(new CategoryElement[getCollection().size()]);
// If any other element refers to a category element, remove it from the list
for (int i = 0; i < categoryIUs.length; i++) {
if (referredIUs.contains(categoryIUs[i].getIU().getId())) {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/InstalledIUElementWrapper.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/InstalledIUElementWrapper.java
index 8f3661e68..030f27b33 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/InstalledIUElementWrapper.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/InstalledIUElementWrapper.java
@@ -25,7 +25,7 @@ import org.eclipse.equinox.p2.metadata.IInstallableUnit;
*/
public class InstalledIUElementWrapper extends QueriedElementWrapper {
- public InstalledIUElementWrapper(IQueryable queryable, Object parent) {
+ public InstalledIUElementWrapper(IQueryable<?> queryable, Object parent) {
super(queryable, parent);
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/MetadataRepositoryElementWrapper.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/MetadataRepositoryElementWrapper.java
index a87b47f70..bd53cda97 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/MetadataRepositoryElementWrapper.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/MetadataRepositoryElementWrapper.java
@@ -25,7 +25,7 @@ import org.eclipse.equinox.p2.ui.ProvisioningUI;
*/
public class MetadataRepositoryElementWrapper extends QueriedElementWrapper {
- public MetadataRepositoryElementWrapper(IQueryable queryable, Object parent) {
+ public MetadataRepositoryElementWrapper(IQueryable<URI> queryable, Object parent) {
super(queryable, parent);
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/QueryableProfileRegistry.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/QueryableProfileRegistry.java
index b9ae9a8b4..dae21c143 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/QueryableProfileRegistry.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/QueryableProfileRegistry.java
@@ -24,7 +24,7 @@ import org.eclipse.equinox.p2.ui.ProvisioningUI;
/**
* An object that adds queryable support to the profile registry.
*/
-public class QueryableProfileRegistry implements IQueryable {
+public class QueryableProfileRegistry implements IQueryable<IProfile> {
private ProvisioningUI ui;
@@ -32,7 +32,7 @@ public class QueryableProfileRegistry implements IQueryable {
this.ui = ui;
}
- public IQueryResult query(IQuery query, IProgressMonitor monitor) {
+ public IQueryResult<IProfile> query(IQuery<IProfile> query, IProgressMonitor monitor) {
IProfile[] profiles = ui.getSession().getProfileRegistry().getProfiles();
SubMonitor sub = SubMonitor.convert(monitor, ProvUIMessages.QueryableProfileRegistry_QueryProfileProgress, profiles.length);
try {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/QueryableUpdates.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/QueryableUpdates.java
index 29874d348..6608b3344 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/QueryableUpdates.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/QueryableUpdates.java
@@ -26,7 +26,7 @@ import org.eclipse.equinox.p2.ui.ProvisioningUI;
/**
* An object that implements a query for available updates
*/
-public class QueryableUpdates implements IQueryable {
+public class QueryableUpdates implements IQueryable<IInstallableUnit> {
private IInstallableUnit[] iusToUpdate;
ProvisioningUI ui;
@@ -36,17 +36,17 @@ public class QueryableUpdates implements IQueryable {
this.iusToUpdate = iusToUpdate;
}
- public IQueryResult query(IQuery query, IProgressMonitor monitor) {
+ public IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor) {
if (monitor == null)
monitor = new NullProgressMonitor();
int totalWork = 2000;
monitor.beginTask(ProvUIMessages.QueryableUpdates_UpdateListProgress, totalWork);
IPlanner planner = ui.getSession().getPlanner();
try {
- ArrayList allUpdates = new ArrayList();
+ ArrayList<IInstallableUnit> allUpdates = new ArrayList<IInstallableUnit>();
for (int i = 0; i < iusToUpdate.length; i++) {
if (monitor.isCanceled())
- return Collector.EMPTY_COLLECTOR;
+ return Collector.emptyCollector();
IInstallableUnit[] updates = planner.updatesFor(iusToUpdate[i], new ProvisioningContext(), new SubProgressMonitor(monitor, totalWork / 2 / iusToUpdate.length));
for (int j = 0; j < updates.length; j++)
allUpdates.add(updates[j]);
@@ -54,7 +54,7 @@ public class QueryableUpdates implements IQueryable {
return query.perform(allUpdates.iterator());
} catch (OperationCanceledException e) {
// Nothing more to do, return result
- return Collector.EMPTY_COLLECTOR;
+ return Collector.emptyCollector();
} finally {
monitor.done();
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/DeferredQueryContentProvider.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/DeferredQueryContentProvider.java
index 4d47d9f45..338acc279 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/DeferredQueryContentProvider.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/DeferredQueryContentProvider.java
@@ -31,8 +31,8 @@ public class DeferredQueryContentProvider extends ProvElementContentProvider {
DeferredQueryTreeContentManager manager;
Object currentInput;
- HashMap alreadyQueried = new HashMap();
- HashSet queryCompleted = new HashSet();
+ HashMap<Object, Object> alreadyQueried = new HashMap<Object, Object>();
+ HashSet<Object> queryCompleted = new HashSet<Object>();
AbstractTreeViewer viewer = null;
ListenerList listeners = new ListenerList();
boolean synchronous = false;
@@ -72,8 +72,8 @@ public class DeferredQueryContentProvider extends ProvElementContentProvider {
});
} else
viewer = null;
- alreadyQueried = new HashMap();
- queryCompleted = new HashSet();
+ alreadyQueried = new HashMap<Object, Object>();
+ queryCompleted = new HashSet<Object>();
currentInput = newInput;
Object[] inputListeners = listeners.getListeners();
for (int i = 0; i < inputListeners.length; i++) {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/IUComparator.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/IUComparator.java
index 4ab3e9a4c..e742aeca9 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/IUComparator.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/IUComparator.java
@@ -42,8 +42,8 @@ public class IUComparator extends ViewerComparator {
}
public int compare(Viewer viewer, Object obj1, Object obj2) {
- IInstallableUnit iu1 = (IInstallableUnit) ProvUI.getAdapter(obj1, IInstallableUnit.class);
- IInstallableUnit iu2 = (IInstallableUnit) ProvUI.getAdapter(obj2, IInstallableUnit.class);
+ IInstallableUnit iu1 = ProvUI.getAdapter(obj1, IInstallableUnit.class);
+ IInstallableUnit iu2 = ProvUI.getAdapter(obj2, IInstallableUnit.class);
if (iu1 == null || iu2 == null)
// If these are not iu's use the super class comparator.
return super.compare(viewer, obj1, obj2);
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/IUDetailsLabelProvider.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/IUDetailsLabelProvider.java
index f26c04ebd..69d0bceef 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/IUDetailsLabelProvider.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/IUDetailsLabelProvider.java
@@ -11,6 +11,8 @@
package org.eclipse.equinox.internal.p2.ui.viewers;
+import org.eclipse.core.runtime.jobs.Job;
+
import java.text.NumberFormat;
import java.util.HashMap;
import java.util.Iterator;
@@ -44,7 +46,7 @@ public class IUDetailsLabelProvider extends ColumnLabelProvider implements ITabl
private IUColumnConfig[] columnConfig;
Shell shell;
- HashMap jobs = new HashMap();
+ HashMap<IIUElement, Job> jobs = new HashMap<IIUElement, Job>();
public IUDetailsLabelProvider() {
this(null, null, null);
@@ -78,7 +80,7 @@ public class IUDetailsLabelProvider extends ColumnLabelProvider implements ITabl
columnContent = columnConfig[columnIndex].getColumnType();
}
- IInstallableUnit iu = (IInstallableUnit) ProvUI.getAdapter(element, IInstallableUnit.class);
+ IInstallableUnit iu = ProvUI.getAdapter(element, IInstallableUnit.class);
if (iu == null) {
if (columnIndex == 0) {
if (element instanceof ProvElement)
@@ -210,7 +212,7 @@ public class IUDetailsLabelProvider extends ColumnLabelProvider implements ITabl
}
public String getToolTipText(Object element) {
- IInstallableUnit iu = (IInstallableUnit) ProvUI.getAdapter(element, IInstallableUnit.class);
+ IInstallableUnit iu = ProvUI.getAdapter(element, IInstallableUnit.class);
if (iu == null || toolTipProperty == null)
return null;
return iu.getProperty(toolTipProperty, null);
@@ -228,9 +230,9 @@ public class IUDetailsLabelProvider extends ColumnLabelProvider implements ITabl
public void dispose() {
super.dispose();
- Iterator iter = jobs.values().iterator();
+ Iterator<Job> iter = jobs.values().iterator();
while (iter.hasNext()) {
- Job job = (Job) iter.next();
+ Job job = iter.next();
job.cancel();
}
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/IUDragAdapter.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/IUDragAdapter.java
index 213319b58..57e163043 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/IUDragAdapter.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/IUDragAdapter.java
@@ -97,7 +97,7 @@ public class IUDragAdapter extends DragSourceAdapter {
}
private IInstallableUnit[] getSelectedIUs() {
- List ius = new ArrayList();
+ List<IInstallableUnit> ius = new ArrayList<IInstallableUnit>();
ISelection selection = selectionProvider.getSelection();
if (!(selection instanceof IStructuredSelection) || selection.isEmpty()) {
@@ -105,20 +105,20 @@ public class IUDragAdapter extends DragSourceAdapter {
}
IStructuredSelection structuredSelection = (IStructuredSelection) selection;
- Iterator iter = structuredSelection.iterator();
+ Iterator<?> iter = structuredSelection.iterator();
while (iter.hasNext()) {
- IInstallableUnit iu = (IInstallableUnit) ProvUI.getAdapter(iter.next(), IInstallableUnit.class);
+ IInstallableUnit iu = ProvUI.getAdapter(iter.next(), IInstallableUnit.class);
if (iu != null) {
ius.add(iu);
}
}
- return (IInstallableUnit[]) ius.toArray(new IInstallableUnit[ius.size()]);
+ return ius.toArray(new IInstallableUnit[ius.size()]);
}
private boolean areOnlyIUsSelected(IStructuredSelection selection) {
- Iterator iter = selection.iterator();
+ Iterator<?> iter = selection.iterator();
while (iter.hasNext()) {
- IInstallableUnit iu = (IInstallableUnit) ProvUI.getAdapter(iter.next(), IInstallableUnit.class);
+ IInstallableUnit iu = ProvUI.getAdapter(iter.next(), IInstallableUnit.class);
if (iu == null) {
return false;
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/InstallIUDropAdapter.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/InstallIUDropAdapter.java
index 7b286caed..bb09719e7 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/InstallIUDropAdapter.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/InstallIUDropAdapter.java
@@ -65,7 +65,7 @@ public class InstallIUDropAdapter extends ViewerDropAdapter {
* IU, return its parent profile id.
*/
private String getProfileTarget(Object mouseTarget) {
- IProfile profile = (IProfile) ProvUI.getAdapter(mouseTarget, IProfile.class);
+ IProfile profile = ProvUI.getAdapter(mouseTarget, IProfile.class);
if (profile != null) {
return profile.getProfileId();
}
@@ -197,20 +197,20 @@ public class InstallIUDropAdapter extends ViewerDropAdapter {
*/
private IInstallableUnit[] getSelectedIUs() {
ISelection selection = LocalSelectionTransfer.getTransfer().getSelection();
- List ius = new ArrayList();
+ List<IInstallableUnit> ius = new ArrayList<IInstallableUnit>();
if (!(selection instanceof IStructuredSelection) || selection.isEmpty()) {
return null;
}
IStructuredSelection structuredSelection = (IStructuredSelection) selection;
- Iterator iter = structuredSelection.iterator();
+ Iterator<?> iter = structuredSelection.iterator();
while (iter.hasNext()) {
- IInstallableUnit iu = (IInstallableUnit) ProvUI.getAdapter(iter.next(), IInstallableUnit.class);
+ IInstallableUnit iu = ProvUI.getAdapter(iter.next(), IInstallableUnit.class);
if (iu != null) {
ius.add(iu);
}
}
- return (IInstallableUnit[]) ius.toArray(new IInstallableUnit[ius.size()]);
+ return ius.toArray(new IInstallableUnit[ius.size()]);
}
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/ProvElementComparer.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/ProvElementComparer.java
index 25f2b984f..7eddb3b2c 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/ProvElementComparer.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/ProvElementComparer.java
@@ -56,21 +56,21 @@ public class ProvElementComparer implements IElementComparer {
}
private IInstallableUnit getIU(Object obj) {
- return (IInstallableUnit) ProvUI.getAdapter(obj, IInstallableUnit.class);
+ return ProvUI.getAdapter(obj, IInstallableUnit.class);
}
private String getProfileId(Object obj) {
if (obj instanceof ProfileElement)
return ((ProfileElement) obj).getLabel(obj);
- IProfile profile = (IProfile) ProvUI.getAdapter(obj, IProfile.class);
+ IProfile profile = ProvUI.getAdapter(obj, IProfile.class);
if (profile == null)
return null;
return profile.getProfileId();
}
private URI getRepositoryLocation(Object obj) {
- if (obj instanceof IRepositoryElement)
- return ((IRepositoryElement) obj).getLocation();
+ if (obj instanceof IRepositoryElement<?>)
+ return ((IRepositoryElement<?>) obj).getLocation();
return null;
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/ProvElementContentProvider.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/ProvElementContentProvider.java
index 30c3802de..5e0c4bd9b 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/ProvElementContentProvider.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/ProvElementContentProvider.java
@@ -55,7 +55,7 @@ public class ProvElementContentProvider implements ITreeContentProvider {
fetchJob = new Job(ProvUIMessages.ProvElementContentProvider_FetchJobTitle) {
protected IStatus run(IProgressMonitor monitor) {
IDeferredWorkbenchAdapter parent = (IDeferredWorkbenchAdapter) input;
- final ArrayList children = new ArrayList();
+ final ArrayList<Object> children = new ArrayList<Object>();
parent.fetchDeferredChildren(parent, new IElementCollector() {
public void add(Object element, IProgressMonitor mon) {
if (mon.isCanceled())
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/ProvElementLabelProvider.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/ProvElementLabelProvider.java
index 437676d0a..3cdd35afc 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/ProvElementLabelProvider.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/ProvElementLabelProvider.java
@@ -49,19 +49,19 @@ public class ProvElementLabelProvider extends LabelProvider implements ITableLab
IInstallableUnit iu = (IInstallableUnit) obj;
return iu.getId();
}
- if (obj instanceof IRepository) {
- String name = ((IRepository) obj).getName();
+ if (obj instanceof IRepository<?>) {
+ String name = ((IRepository<?>) obj).getName();
if (name != null && name.length() > 0) {
return name;
}
- return URIUtil.toUnencodedString(((IRepository) obj).getLocation());
+ return URIUtil.toUnencodedString(((IRepository<?>) obj).getLocation());
}
- if (obj instanceof IRepositoryElement) {
- String name = ((IRepositoryElement) obj).getName();
+ if (obj instanceof IRepositoryElement<?>) {
+ String name = ((IRepositoryElement<?>) obj).getName();
if (name != null && name.length() > 0) {
return name;
}
- return URIUtil.toUnencodedString(((IRepositoryElement) obj).getLocation());
+ return URIUtil.toUnencodedString(((IRepositoryElement<?>) obj).getLocation());
}
if (obj instanceof IArtifactKey) {
IArtifactKey key = (IArtifactKey) obj;
@@ -122,15 +122,15 @@ public class ProvElementLabelProvider extends LabelProvider implements ITableLab
if (((IIUElement) element).shouldShowVersion())
return ((IIUElement) element).getIU().getVersion().toString();
}
- IInstallableUnit iu = (IInstallableUnit) ProvUI.getAdapter(element, IInstallableUnit.class);
+ IInstallableUnit iu = ProvUI.getAdapter(element, IInstallableUnit.class);
if (iu != null) {
return iu.getVersion().toString();
}
- if (element instanceof IRepository) {
- return URIUtil.toUnencodedString(((IRepository) element).getLocation());
+ if (element instanceof IRepository<?>) {
+ return URIUtil.toUnencodedString(((IRepository<?>) element).getLocation());
}
- if (element instanceof IRepositoryElement) {
- return URIUtil.toUnencodedString(((IRepositoryElement) element).getLocation());
+ if (element instanceof IRepositoryElement<?>) {
+ return URIUtil.toUnencodedString(((IRepositoryElement<?>) element).getLocation());
}
if (element instanceof IArtifactKey) {
IArtifactKey key = (IArtifactKey) element;
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/RepositoryDetailsLabelProvider.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/RepositoryDetailsLabelProvider.java
index 46684b2b6..6247d7db2 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/RepositoryDetailsLabelProvider.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/RepositoryDetailsLabelProvider.java
@@ -58,25 +58,25 @@ public class RepositoryDetailsLabelProvider extends LabelProvider implements ITa
switch (columnIndex) {
case COL_NAME :
- if (element instanceof IRepositoryElement) {
- String name = ((IRepositoryElement) element).getName();
+ if (element instanceof IRepositoryElement<?>) {
+ String name = ((IRepositoryElement<?>) element).getName();
if (name != null) {
return name;
}
}
- if (element instanceof IRepository) {
- String name = ((IRepository) element).getName();
+ if (element instanceof IRepository<?>) {
+ String name = ((IRepository<?>) element).getName();
if (name != null) {
return name;
}
}
return ""; //$NON-NLS-1$
case COL_LOCATION :
- if (element instanceof IRepository) {
- return TextProcessor.process(URIUtil.toUnencodedString(((IRepository) element).getLocation()));
+ if (element instanceof IRepository<?>) {
+ return TextProcessor.process(URIUtil.toUnencodedString(((IRepository<?>) element).getLocation()));
}
- if (element instanceof IRepositoryElement) {
- return TextProcessor.process(URIUtil.toUnencodedString(((IRepositoryElement) element).getLocation()));
+ if (element instanceof IRepositoryElement<?>) {
+ return TextProcessor.process(URIUtil.toUnencodedString(((IRepositoryElement<?>) element).getLocation()));
}
break;
case COL_ENABLEMENT :
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/AcceptLicensesWizardPage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/AcceptLicensesWizardPage.java
index a47b46aa8..f61dccbec 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/AcceptLicensesWizardPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/AcceptLicensesWizardPage.java
@@ -69,8 +69,8 @@ public class AcceptLicensesWizardPage extends WizardPage {
return new Object[0];
if (licensesToIUs.containsKey(parentElement)) {
- List iusWithLicense = (List) licensesToIUs.get(parentElement);
- IInstallableUnit[] ius = (IInstallableUnit[]) iusWithLicense.toArray(new IInstallableUnit[iusWithLicense.size()]);
+ List<IInstallableUnit> iusWithLicense = licensesToIUs.get(parentElement);
+ IInstallableUnit[] ius = iusWithLicense.toArray(new IInstallableUnit[iusWithLicense.size()]);
IUWithLicenseParent[] children = new IUWithLicenseParent[ius.length];
for (int i = 0; i < ius.length; i++) {
children[i] = new IUWithLicenseParent((ILicense) parentElement, ius[i]);
@@ -140,7 +140,7 @@ public class AcceptLicensesWizardPage extends WizardPage {
Button declineButton;
SashForm sashForm;
private IInstallableUnit[] originalIUs;
- HashMap licensesToIUs; // License -> IU Name
+ HashMap<ILicense, List<IInstallableUnit>> licensesToIUs; // License -> IU Name
private LicenseManager manager;
IUColumnConfig nameColumn;
IUColumnConfig versionColumn;
@@ -177,12 +177,12 @@ public class AcceptLicensesWizardPage extends WizardPage {
*/
public void createControl(Composite parent) {
initializeDialogUnits(parent);
- ArrayList ius;
+ List<IInstallableUnit> ius;
if (licensesToIUs == null || licensesToIUs.size() == 0) {
Label label = new Label(parent, SWT.NONE);
setControl(label);
- } else if (licensesToIUs.size() == 1 && (ius = (ArrayList) (licensesToIUs.values().iterator().next())).size() == 1) {
- createLicenseContentSection(parent, (IInstallableUnit) ius.get(0));
+ } else if (licensesToIUs.size() == 1 && (ius = licensesToIUs.values().iterator().next()).size() == 1) {
+ createLicenseContentSection(parent, ius.get(0));
} else {
sashForm = new SashForm(parent, SWT.HORIZONTAL);
sashForm.setLayout(new GridLayout());
@@ -343,7 +343,7 @@ public class AcceptLicensesWizardPage extends WizardPage {
private void updateLicenses(IInstallableUnit[] theIUs, IProvisioningPlan plan) {
this.originalIUs = theIUs;
if (theIUs == null)
- licensesToIUs = new HashMap();
+ licensesToIUs = new HashMap<ILicense, List<IInstallableUnit>>();
else
findUnacceptedLicenses(theIUs, plan);
setDescription();
@@ -376,15 +376,15 @@ public class AcceptLicensesWizardPage extends WizardPage {
private void findUnacceptedLicenses(IInstallableUnit[] selectedIUs, IProvisioningPlan plan) {
IInstallableUnit[] iusToCheck = selectedIUs;
if (plan != null) {
- iusToCheck = (IInstallableUnit[]) plan.getAdditions().query(InstallableUnitQuery.ANY, null).toArray(IInstallableUnit.class);
+ iusToCheck = plan.getAdditions().query(InstallableUnitQuery.ANY, null).toArray(IInstallableUnit.class);
}
// See https://bugs.eclipse.org/bugs/show_bug.cgi?id=218532
// Current metadata generation can result with a feature group IU and the feature jar IU
// having the same name and license. We will weed out duplicates if the license and name are both
// the same.
- licensesToIUs = new HashMap();//map of License->ArrayList of IUs with that license
- HashMap namesSeen = new HashMap(); // map of License->HashSet of names with that license
+ licensesToIUs = new HashMap<ILicense, List<IInstallableUnit>>();//map of License->ArrayList of IUs with that license
+ HashMap<ILicense, HashSet<String>> namesSeen = new HashMap<ILicense, HashSet<String>>(); // map of License->HashSet of names with that license
for (int i = 0; i < iusToCheck.length; i++) {
IInstallableUnit iu = iusToCheck[i];
ILicense[] licenses = iu.getLicenses(null);
@@ -396,16 +396,16 @@ public class AcceptLicensesWizardPage extends WizardPage {
name = iu.getId();
// Have we already found this license?
if (licensesToIUs.containsKey(license)) {
- HashSet names = (HashSet) namesSeen.get(license);
+ HashSet<String> names = namesSeen.get(license);
if (!names.contains(name)) {
names.add(name);
- ((ArrayList) licensesToIUs.get(license)).add(iu);
+ ((ArrayList<IInstallableUnit>) licensesToIUs.get(license)).add(iu);
}
} else {
- ArrayList list = new ArrayList(1);
+ ArrayList<IInstallableUnit> list = new ArrayList<IInstallableUnit>(1);
list.add(iu);
licensesToIUs.put(license, list);
- HashSet names = new HashSet(1);
+ HashSet<String> names = new HashSet<String>(1);
names.add(name);
namesSeen.put(license, names);
}
@@ -417,7 +417,7 @@ public class AcceptLicensesWizardPage extends WizardPage {
private void rememberAcceptedLicenses() {
if (licensesToIUs == null || manager == null)
return;
- Iterator iter = licensesToIUs.keySet().iterator();
+ Iterator<ILicense> iter = licensesToIUs.keySet().iterator();
while (iter.hasNext()) {
License license = (License) iter.next();
manager.accept(license);
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/LoadMetadataRepositoryJob.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/LoadMetadataRepositoryJob.java
index 335dbe070..2322dd58e 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/LoadMetadataRepositoryJob.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/LoadMetadataRepositoryJob.java
@@ -11,6 +11,8 @@
package org.eclipse.equinox.p2.ui;
+import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
+
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
@@ -60,7 +62,7 @@ public class LoadMetadataRepositoryJob extends ProvisioningJob {
*/
public static final QualifiedName ACCUMULATE_LOAD_ERRORS = new QualifiedName(ProvUIActivator.PLUGIN_ID, "ACCUMULATE_LOAD_ERRORS"); //$NON-NLS-1$
- private List repoCache = new ArrayList();
+ private List<IMetadataRepository> repoCache = new ArrayList<IMetadataRepository>();
private RepositoryTracker tracker;
private MultiStatus accumulatedStatus;
private URI[] locations;
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/Policy.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/Policy.java
index 1e7e7ccae..bb2494c31 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/Policy.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/Policy.java
@@ -14,6 +14,7 @@ import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.equinox.internal.p2.ui.*;
import org.eclipse.equinox.p2.engine.query.UserVisibleRootQuery;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.query.GroupQuery;
import org.eclipse.equinox.p2.metadata.query.IQuery;
import org.eclipse.equinox.p2.operations.ProfileChangeOperation;
@@ -72,8 +73,8 @@ public class Policy {
*/
public static final int RESTART_POLICY_PROMPT_RESTART_OR_APPLY = 4;
- private IQuery visibleAvailableIUQuery = new GroupQuery();
- private IQuery visibleInstalledIUQuery = new UserVisibleRootQuery();
+ private IQuery<IInstallableUnit> visibleAvailableIUQuery = new GroupQuery();
+ private IQuery<IInstallableUnit> visibleInstalledIUQuery = new UserVisibleRootQuery();
private boolean groupByCategory = true;
private boolean allowDrilldown = true;
private boolean repositoriesVisible = true;
@@ -148,7 +149,7 @@ public class Policy {
*
* @return the query used to retrieve user visible available IUs
*/
- public IQuery getVisibleAvailableIUQuery() {
+ public IQuery<IInstallableUnit> getVisibleAvailableIUQuery() {
return visibleAvailableIUQuery;
}
@@ -158,7 +159,7 @@ public class Policy {
*
* @param query the query used to retrieve user visible available IUs
*/
- public void setVisibleAvailableIUQuery(IQuery query) {
+ public void setVisibleAvailableIUQuery(IQuery<IInstallableUnit> query) {
visibleAvailableIUQuery = query;
}
@@ -168,7 +169,7 @@ public class Policy {
*
* @return the query used to retrieve user visible installed IUs
*/
- public IQuery getVisibleInstalledIUQuery() {
+ public IQuery<IInstallableUnit> getVisibleInstalledIUQuery() {
return visibleInstalledIUQuery;
}
@@ -178,7 +179,7 @@ public class Policy {
*
* @param query the query used to retrieve user visible installed IUs
*/
- public void setVisibleInstalledIUQuery(IQuery query) {
+ public void setVisibleInstalledIUQuery(IQuery<IInstallableUnit> query) {
visibleInstalledIUQuery = query;
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RepositoryManipulationPage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RepositoryManipulationPage.java
index 411b2fbf4..06ffaa5f5 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RepositoryManipulationPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RepositoryManipulationPage.java
@@ -107,7 +107,7 @@ public class RepositoryManipulationPage extends PreferencePage implements IWorkb
Button addButton, removeButton, editButton, refreshButton, disableButton, exportButton;
class CachedMetadataRepositories extends MetadataRepositories {
- Hashtable cachedElements;
+ Hashtable<String, Object> cachedElements;
CachedMetadataRepositories() {
super(ui);
@@ -123,7 +123,7 @@ public class RepositoryManipulationPage extends PreferencePage implements IWorkb
super.fetchDeferredChildren(o, collector, monitor);
// now we know we have children
Object[] children = getChildren(o);
- cachedElements = new Hashtable(children.length);
+ cachedElements = new Hashtable<String, Object>(children.length);
for (int i = 0; i < children.length; i++) {
if (children[i] instanceof MetadataRepositoryElement)
cachedElements.put(URIUtil.toUnencodedString(((MetadataRepositoryElement) children[i]).getLocation()), children[i]);
@@ -509,17 +509,17 @@ public class RepositoryManipulationPage extends PreferencePage implements IWorkb
}
MetadataRepositoryElement[] getElements() {
- return (MetadataRepositoryElement[]) getInput().cachedElements.values().toArray(new MetadataRepositoryElement[getInput().cachedElements.size()]);
+ return getInput().cachedElements.values().toArray(new MetadataRepositoryElement[getInput().cachedElements.size()]);
}
MetadataRepositoryElement[] getSelectedElements() {
Object[] items = ((IStructuredSelection) repositoryViewer.getSelection()).toArray();
- ArrayList list = new ArrayList(items.length);
+ ArrayList<Object> list = new ArrayList<Object>(items.length);
for (int i = 0; i < items.length; i++) {
if (items[i] instanceof MetadataRepositoryElement)
list.add(items[i]);
}
- return (MetadataRepositoryElement[]) list.toArray(new MetadataRepositoryElement[list.size()]);
+ return list.toArray(new MetadataRepositoryElement[list.size()]);
}
void validateButtons() {
@@ -644,7 +644,7 @@ public class RepositoryManipulationPage extends PreferencePage implements IWorkb
public void run() {
MetadataRepositoryElement[] imported = UpdateManagerCompatibility.importSites(getShell());
if (imported.length > 0) {
- Hashtable repos = getInput().cachedElements;
+ Hashtable<String, Object> repos = getInput().cachedElements;
changed = true;
for (int i = 0; i < imported.length; i++)
repos.put(URIUtil.toUnencodedString(imported[i].getLocation()), imported[i]);
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RevertProfilePage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RevertProfilePage.java
index 48179373e..40d0ad4ea 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RevertProfilePage.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RevertProfilePage.java
@@ -283,7 +283,7 @@ public class RevertProfilePage extends InstallationPage implements ICopyable {
boolean computeDeleteEnablement() {
// delete is permitted if none of the selected elements are the current profile
boolean okToDelete = true;
- Iterator iter = ((IStructuredSelection) configsViewer.getSelection()).iterator();
+ Iterator<?> iter = ((IStructuredSelection) configsViewer.getSelection()).iterator();
while (iter.hasNext()) {
Object selected = iter.next();
// If it's not a recognized element or if it is the current profile, we can't delete. Stop iterating.
@@ -332,7 +332,7 @@ public class RevertProfilePage extends InstallationPage implements ICopyable {
RollbackProfileElement[] result = new RollbackProfileElement[2];
IStructuredSelection selection = ((IStructuredSelection) configsViewer.getSelection());
int i = 0;
- for (Iterator iterator = selection.toList().iterator(); iterator.hasNext();) {
+ for (Iterator<?> iterator = selection.toList().iterator(); iterator.hasNext();) {
Object selected = iterator.next();
if (selected != null && selected instanceof RollbackProfileElement) {
result[i++] = (RollbackProfileElement) selected;
@@ -441,7 +441,7 @@ public class RevertProfilePage extends InstallationPage implements ICopyable {
}
public Object[] getChildren() {
- Set children = new HashSet();
+ Set<ProvElementNode> children = new HashSet<ProvElementNode>();
if (pe instanceof RollbackProfileElement) {
Object[] c = ((RollbackProfileElement) pe).getChildren(null);
for (int i = 0; i < c.length; i++) {
@@ -534,7 +534,7 @@ public class RevertProfilePage extends InstallationPage implements ICopyable {
String title = selection.size() == 1 ? ProvUIMessages.RevertProfilePage_DeleteSingleConfigurationTitle : ProvUIMessages.RevertProfilePage_DeleteMultipleConfigurationsTitle;
String confirmMessage = selection.size() == 1 ? ProvUIMessages.RevertProfilePage_ConfirmDeleteSingleConfig : ProvUIMessages.RevertProfilePage_ConfirmDeleteMultipleConfigs;
if (MessageDialog.openConfirm(configsViewer.getControl().getShell(), title, confirmMessage)) {
- Iterator iter = selection.iterator();
+ Iterator<?> iter = selection.iterator();
while (iter.hasNext()) {
Object selected = iter.next();
// If it is a recognized element and it is not the current profile, then it can be deleted.
diff --git a/bundles/org.eclipse.equinox.p2.updatesite/.classpath b/bundles/org.eclipse.equinox.p2.updatesite/.classpath
index 2fbb7a23e..64c5e31b7 100644
--- a/bundles/org.eclipse.equinox.p2.updatesite/.classpath
+++ b/bundles/org.eclipse.equinox.p2.updatesite/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <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.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
diff --git a/bundles/org.eclipse.equinox.p2.updatesite/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.updatesite/.settings/org.eclipse.jdt.core.prefs
index 9e8b47d6e..9311951e5 100644
--- a/bundles/org.eclipse.equinox.p2.updatesite/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.equinox.p2.updatesite/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,4 @@
-#Sun Dec 06 23:05:13 EST 2009
+#Mon Dec 28 00:21:51 CET 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
org.eclipse.jdt.core.builder.duplicateResourceTask=warning
@@ -8,17 +8,17 @@ 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.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.compliance=1.5
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.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
org.eclipse.jdt.core.compiler.problem.deadCode=warning
@@ -27,7 +27,7 @@ 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.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
@@ -94,7 +94,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enab
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.compiler.source=1.5
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
diff --git a/bundles/org.eclipse.equinox.p2.updatesite/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.updatesite/META-INF/MANIFEST.MF
index c2ac536e3..733239bf9 100644
--- a/bundles/org.eclipse.equinox.p2.updatesite/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.updatesite/META-INF/MANIFEST.MF
@@ -48,7 +48,8 @@ Require-Bundle: org.eclipse.ecf.filetransfer,
org.eclipse.equinox.p2.metadata.repository;bundle-version="0.1.0",
org.eclipse.equinox.p2.artifact.repository;bundle-version="0.1.0",
org.eclipse.core.jobs;bundle-version="[3.2.0,4.0.0)"
-Bundle-RequiredExecutionEnvironment: J2SE-1.4,
+Bundle-RequiredExecutionEnvironment: J2SE-1.5,
+ J2SE-1.4,
CDC-1.1/Foundation-1.1
Export-Package: org.eclipse.equinox.internal.p2.updatesite;x-friends:="org.eclipse.pde.build",
org.eclipse.equinox.internal.p2.updatesite.artifact;x-internal:=true,
diff --git a/bundles/org.eclipse.equinox.p2.updatesite/build.properties b/bundles/org.eclipse.equinox.p2.updatesite/build.properties
index f6b01e53f..c5640282b 100644
--- a/bundles/org.eclipse.equinox.p2.updatesite/build.properties
+++ b/bundles/org.eclipse.equinox.p2.updatesite/build.properties
@@ -16,3 +16,5 @@ bin.includes = META-INF/,\
plugin.properties,\
about.html
src.includes = about.html
+javacTarget=jsr14
+javacSource=1.5
diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/DefaultSiteParser.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/DefaultSiteParser.java
index ac5e456ab..cdc70b705 100644
--- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/DefaultSiteParser.java
+++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/DefaultSiteParser.java
@@ -58,15 +58,15 @@ public class DefaultSiteParser extends DefaultHandler {
private boolean DESCRIPTION_SITE_ALREADY_SEEN = false;
// Current object stack (used to hold the current object we are
// populating in this plugin descriptor
- Stack objectStack = new Stack();
+ Stack<Object> objectStack = new Stack<Object>();
private SAXParser parser;
// Current State Information
- Stack stateStack = new Stack();
+ Stack<Integer> stateStack = new Stack<Integer>();
// List of string keys for translated strings
- private final List messageKeys = new ArrayList(4);
+ private final List<String> messageKeys = new ArrayList<String>(4);
private MultiStatus status;
private final URI siteLocation;
@@ -130,8 +130,8 @@ public class DefaultSiteParser extends DefaultHandler {
public DefaultSiteParser(URI siteLocation) {
super();
this.siteLocation = siteLocation;
- stateStack = new Stack();
- objectStack = new Stack();
+ stateStack = new Stack<Integer>();
+ objectStack = new Stack<Object>();
status = null;
DESCRIPTION_SITE_ALREADY_SEEN = false;
try {
@@ -155,7 +155,7 @@ public class DefaultSiteParser extends DefaultHandler {
public void characters(char[] ch, int start, int length) {
String text = new String(ch, start, length);
//only push if description
- int state = ((Integer) stateStack.peek()).intValue();
+ int state = stateStack.peek().intValue();
if (state == STATE_DESCRIPTION_SITE || state == STATE_DESCRIPTION_CATEGORY_DEF)
objectStack.push(text);
@@ -171,7 +171,7 @@ public class DefaultSiteParser extends DefaultHandler {
String text = null;
URLEntry info = null;
- int state = ((Integer) stateStack.peek()).intValue();
+ int state = stateStack.peek().intValue();
switch (state) {
case STATE_IGNORED_ELEMENT :
case STATE_ARCHIVE :
@@ -501,7 +501,7 @@ public class DefaultSiteParser extends DefaultHandler {
*/
public SiteModel parse(InputStream in) throws SAXException, IOException {
stateStack.push(new Integer(STATE_INITIAL));
- currentState = ((Integer) stateStack.peek()).intValue();
+ currentState = stateStack.peek().intValue();
parser.parse(new InputSource(in), this);
if (objectStack.isEmpty())
throw new SAXException(Messages.DefaultSiteParser_NoSiteTag);
@@ -511,7 +511,7 @@ public class DefaultSiteParser extends DefaultHandler {
return site;
}
String stack = ""; //$NON-NLS-1$
- Iterator iter = objectStack.iterator();
+ Iterator<Object> iter = objectStack.iterator();
while (iter.hasNext()) {
stack = stack + iter.next().toString() + "\r\n"; //$NON-NLS-1$
}
@@ -797,7 +797,7 @@ public class DefaultSiteParser extends DefaultHandler {
internalErrorUnknownTag(NLS.bind(Messages.DefaultSiteParser_UnknownStartState, (new String[] {getState(currentState)})));
break;
}
- int newState = ((Integer) stateStack.peek()).intValue();
+ int newState = stateStack.peek().intValue();
if (newState != STATE_IGNORED_ELEMENT)
currentState = newState;
diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/DigestParser.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/DigestParser.java
index af0e3ba73..9a0809483 100644
--- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/DigestParser.java
+++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/DigestParser.java
@@ -36,7 +36,7 @@ public class DigestParser extends DefaultHandler {
private final static SAXParserFactory parserFactory = SAXParserFactory.newInstance();
private SAXParser parser;
- private final List features = new ArrayList();
+ private final List<Feature> features = new ArrayList<Feature>();
private final FeatureManifestParser featureHandler = new FeatureManifestParser(false);
public DigestParser() {
@@ -82,7 +82,7 @@ public class DigestParser extends DefaultHandler {
return null;
is = new BufferedInputStream(jar.getInputStream(entry));
parser.parse(new InputSource(is), this);
- return (Feature[]) features.toArray(new Feature[features.size()]);
+ return features.toArray(new Feature[features.size()]);
} catch (IOException e) {
LogHelper.log(new Status(IStatus.ERROR, Activator.ID, NLS.bind(Messages.ErrorReadingDigest, location), e));
} catch (SAXException e) {
diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/LocalUpdateSiteAction.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/LocalUpdateSiteAction.java
index 6fd9d0e0b..04b9f66ba 100644
--- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/LocalUpdateSiteAction.java
+++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/LocalUpdateSiteAction.java
@@ -10,6 +10,8 @@
******************************************************************************/
package org.eclipse.equinox.internal.p2.updatesite;
+import org.eclipse.equinox.p2.publisher.IPublisherAction;
+
import java.io.File;
import java.util.ArrayList;
import org.eclipse.core.runtime.*;
@@ -71,12 +73,12 @@ public class LocalUpdateSiteAction implements IPublisherAction {
protected IPublisherAction[] createActions() {
createAdvice();
- ArrayList result = new ArrayList();
+ ArrayList<IPublisherAction> result = new ArrayList<IPublisherAction>();
// create an action that just publishes the raw bundles and features
IPublisherAction action = new MergeResultsAction(new IPublisherAction[] {createFeaturesAction(), createBundlesAction()}, IPublisherResult.MERGE_ALL_NON_ROOT);
result.add(action);
result.add(createSiteXMLAction());
- return (IPublisherAction[]) result.toArray(new IPublisherAction[result.size()]);
+ return result.toArray(new IPublisherAction[result.size()]);
}
private IPublisherAction createSiteXMLAction() {
diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/RemoteFeaturesAction.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/RemoteFeaturesAction.java
index 06867d750..be3087ec4 100644
--- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/RemoteFeaturesAction.java
+++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/RemoteFeaturesAction.java
@@ -48,7 +48,7 @@ public class RemoteFeaturesAction extends FeaturesAction {
}
protected void generateFeatureIUs(Feature[] featureList, IPublisherResult result) {
- Properties extraProperties = new Properties();
+ Map<String, String> extraProperties = new HashMap<String, String>();
extraProperties.put(IInstallableUnit.PROP_PARTIAL_IU, Boolean.TRUE.toString());
for (int i = 0; i < featureList.length; i++) {
Feature feature = featureList[i];
@@ -56,7 +56,7 @@ public class RemoteFeaturesAction extends FeaturesAction {
for (int j = 0; j < featureEntries.length; j++) {
FeatureEntry entry = featureEntries[j];
if (entry.isPlugin() && !entry.isRequires()) {
- Dictionary mockManifest = new Properties();
+ Dictionary<String, String> mockManifest = new Hashtable<String, String>();
mockManifest.put("Manifest-Version", "1.0"); //$NON-NLS-1$ //$NON-NLS-2$
mockManifest.put("Bundle-ManifestVersion", "2"); //$NON-NLS-1$ //$NON-NLS-2$
mockManifest.put("Bundle-SymbolicName", entry.getId()); //$NON-NLS-1$
@@ -69,7 +69,7 @@ public class RemoteFeaturesAction extends FeaturesAction {
}
}
IInstallableUnit featureIU = createFeatureJarIU(feature, new PublisherInfo());
- List childIUs = new ArrayList();
+ List<IInstallableUnit> childIUs = new ArrayList<IInstallableUnit>();
childIUs.add(featureIU);
IInstallableUnit groupIU = createGroupIU(feature, childIUs, new PublisherInfo());
result.addIU(featureIU, IPublisherResult.ROOT);
diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/RemoteUpdateSiteAction.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/RemoteUpdateSiteAction.java
index 428c06122..f7278e23e 100644
--- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/RemoteUpdateSiteAction.java
+++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/RemoteUpdateSiteAction.java
@@ -10,6 +10,8 @@
******************************************************************************/
package org.eclipse.equinox.internal.p2.updatesite;
+import org.eclipse.equinox.p2.publisher.IPublisherAction;
+
import java.util.ArrayList;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.core.helpers.Tracing;
@@ -55,10 +57,10 @@ public class RemoteUpdateSiteAction implements IPublisherAction {
}
protected IPublisherAction[] createActions() {
- ArrayList result = new ArrayList();
+ ArrayList<IPublisherAction> result = new ArrayList<IPublisherAction>();
result.add(new RemoteFeaturesAction(updateSite));
result.add(createSiteXMLAction());
- return (IPublisherAction[]) result.toArray(new IPublisherAction[result.size()]);
+ return result.toArray(new IPublisherAction[result.size()]);
}
private IPublisherAction createSiteXMLAction() {
diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteCategory.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteCategory.java
index 131016e6e..06ed2a961 100644
--- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteCategory.java
+++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteCategory.java
@@ -12,8 +12,7 @@ package org.eclipse.equinox.internal.p2.updatesite;
import java.net.MalformedURLException;
import java.net.URL;
-import java.util.Comparator;
-import java.util.Map;
+import java.util.*;
/**
* A category in an update site.
@@ -22,11 +21,11 @@ import java.util.Map;
*/
public class SiteCategory {
- private static Comparator comp;
+ private static Comparator<SiteCategory> comp;
private String description;
private String label;
private String name;
- private Map localizations;
+ private Map<Locale, Map<String, String>> localizations;
/**
* Returns a comparator for category models.
@@ -34,19 +33,16 @@ public class SiteCategory {
* @return comparator
* @since 2.0
*/
- public static Comparator getComparator() {
+ public static Comparator<SiteCategory> getComparator() {
if (comp == null) {
- comp = new Comparator() {
+ comp = new Comparator<SiteCategory>() {
/*
* @see Comparator#compare(Object,Object)
* Returns 0 if versions are equal.
* Returns -1 if object1 is after than object2.
* Returns +1 if object1 is before than object2.
*/
- public int compare(Object o1, Object o2) {
-
- SiteCategory cat1 = (SiteCategory) o1;
- SiteCategory cat2 = (SiteCategory) o2;
+ public int compare(SiteCategory cat1, SiteCategory cat2) {
if (cat1.equals(cat2))
return 0;
@@ -108,7 +104,7 @@ public class SiteCategory {
* @return a map from locale to property set
* @since 3.4
*/
- public Map getLocalizations() {
+ public Map<Locale, Map<String, String>> getLocalizations() {
return this.localizations;
}
@@ -181,7 +177,7 @@ public class SiteCategory {
* @param localizations as a map from locale to property set
* @since 3.4
*/
- public void setLocalizations(Map localizations) {
+ public void setLocalizations(Map<Locale, Map<String, String>> localizations) {
this.localizations = localizations;
}
diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteFeature.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteFeature.java
index 3ad51042a..0a70eba90 100644
--- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteFeature.java
+++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteFeature.java
@@ -26,7 +26,7 @@ public class SiteFeature {
private String arch;
// performance
private URL base;
- private List /* of String*/categoryNames;
+ private List<String> categoryNames;
private String featureId;
private String featureVersion;
private String label;
@@ -99,7 +99,7 @@ public class SiteFeature {
*/
public void addCategoryName(String categoryName) {
if (this.categoryNames == null)
- this.categoryNames = new ArrayList();
+ this.categoryNames = new ArrayList<String>();
if (!this.categoryNames.contains(categoryName))
this.categoryNames.add(categoryName);
}
@@ -180,7 +180,7 @@ public class SiteFeature {
if (categoryNames == null)
return new String[0];
- return (String[]) categoryNames.toArray(new String[0]);
+ return categoryNames.toArray(new String[0]);
}
/**
@@ -337,7 +337,7 @@ public class SiteFeature {
if (categoryNames == null)
this.categoryNames = null;
else
- this.categoryNames = new ArrayList(Arrays.asList(categoryNames));
+ this.categoryNames = new ArrayList<String>(Arrays.asList(categoryNames));
}
/**
diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteModel.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteModel.java
index d0bd69475..5ac5f3adc 100644
--- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteModel.java
+++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteModel.java
@@ -22,16 +22,16 @@ import org.eclipse.equinox.p2.publisher.eclipse.URLEntry;
*/
public class SiteModel {
- private List /*of ArchiveReferenceModel*/archiveReferences;
+ private List<URLEntry> archiveReferences;
/**
* Map of String (category id) -> SiteCategory
*/
- private Map categories;
+ private Map<String, SiteCategory> categories;
private URLEntry description;
/**
* Map of String (feature id) -> SiteFeature
*/
- private List features;
+ private List<SiteFeature> features;
private URI locationURI;
private String locationURIString;
private String mirrorsURIString;
@@ -39,8 +39,8 @@ public class SiteModel {
private String type;
private URLEntry[] associateSites;
private String digestURIString;
- private List messageKeys;
- private Map localizations;
+ private List<String> messageKeys;
+ private Map<Locale, Map<String, String>> localizations;
/**
* Creates an uninitialized site model object.
@@ -60,7 +60,7 @@ public class SiteModel {
*/
public void addArchive(URLEntry archiveReference) {
if (this.archiveReferences == null)
- this.archiveReferences = new ArrayList();
+ this.archiveReferences = new ArrayList<URLEntry>();
if (!this.archiveReferences.contains(archiveReference))
this.archiveReferences.add(archiveReference);
}
@@ -72,7 +72,7 @@ public class SiteModel {
*/
public void addCategory(SiteCategory category) {
if (categories == null)
- categories = new HashMap();
+ categories = new HashMap<String, SiteCategory>();
if (!categories.containsKey(category.getName())) {
categories.put(category.getName(), category);
if (localizations != null && !localizations.isEmpty())
@@ -87,7 +87,7 @@ public class SiteModel {
*/
public void addFeature(SiteFeature featureReference) {
if (this.features == null)
- this.features = new ArrayList();
+ this.features = new ArrayList<SiteFeature>();
this.features.add(featureReference);
}
@@ -103,7 +103,7 @@ public class SiteModel {
if (archiveReferences == null || archiveReferences.size() == 0)
return new URLEntry[0];
- return (URLEntry[]) archiveReferences.toArray(new URLEntry[0]);
+ return archiveReferences.toArray(new URLEntry[0]);
}
public URLEntry[] getAssociatedSites() {
@@ -119,7 +119,7 @@ public class SiteModel {
public SiteCategory[] getCategories() {
if (categories == null || categories.size() == 0)
return new SiteCategory[0];
- return (SiteCategory[]) categories.values().toArray(new SiteCategory[0]);
+ return categories.values().toArray(new SiteCategory[0]);
}
/**
@@ -127,7 +127,7 @@ public class SiteModel {
* @return the category with the given name, or <code>null</code>
*/
public SiteCategory getCategory(String name) {
- return (SiteCategory) (categories == null ? null : categories.get(name));
+ return (categories == null ? null : categories.get(name));
}
/**
@@ -147,7 +147,7 @@ public class SiteModel {
public SiteFeature[] getFeatures() {
if (features == null || features.size() == 0)
return new SiteFeature[0];
- return (SiteFeature[]) features.toArray(new SiteFeature[0]);
+ return features.toArray(new SiteFeature[0]);
}
/**
@@ -157,7 +157,7 @@ public class SiteModel {
* @return a map from locale to property set
* @since 3.4
*/
- public Map getLocalizations() {
+ public Map<Locale, Map<String, String>> getLocalizations() {
return this.localizations;
}
@@ -192,7 +192,7 @@ public class SiteModel {
* @return the list of keys for translatable strings; may be null
* @since 3.4
*/
- public List getMessageKeys() {
+ public List<String> getMessageKeys() {
return messageKeys;
}
@@ -236,13 +236,12 @@ public class SiteModel {
* @param localizations as a map from locale to property set
* @since 3.4
*/
- public void setLocalizations(Map localizations) {
+ public void setLocalizations(Map<Locale, Map<String, String>> localizations) {
this.localizations = localizations;
if (localizations != null && !localizations.isEmpty() && //
categories != null && !categories.isEmpty()) {
- for (Iterator catIter = categories.entrySet().iterator(); catIter.hasNext();) {
- Map.Entry entry = (Map.Entry) catIter.next();
- SiteCategory category = (SiteCategory) entry.getValue();
+ for (Iterator<SiteCategory> catIter = categories.values().iterator(); catIter.hasNext();) {
+ SiteCategory category = catIter.next();
category.setLocalizations(localizations);
}
}
@@ -264,7 +263,7 @@ public class SiteModel {
* @param keys for translatable strings
* @since 3.4
*/
- public void setMessageKeys(List keys) {
+ public void setMessageKeys(List<String> keys) {
this.messageKeys = keys;
}
diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteXMLAction.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteXMLAction.java
index 16defb5e1..9eff4b1fe 100644
--- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteXMLAction.java
+++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteXMLAction.java
@@ -14,8 +14,10 @@ import java.io.File;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.*;
+import java.util.Map.Entry;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
+import org.eclipse.equinox.internal.p2.metadata.IRequiredCapability;
import org.eclipse.equinox.internal.p2.metadata.LDAPQuery;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
import org.eclipse.equinox.internal.provisional.p2.metadata.*;
@@ -39,7 +41,7 @@ public class SiteXMLAction extends AbstractPublisherAction {
static final private String QUALIFIER = "qualifier"; //$NON-NLS-1$
protected UpdateSite updateSite;
private SiteCategory defaultCategory;
- private HashSet defaultCategorySet;
+ private HashSet<SiteCategory> defaultCategorySet;
protected URI location;
private String categoryQualifier = null;
@@ -74,7 +76,7 @@ public class SiteXMLAction extends AbstractPublisherAction {
defaultCategory.setDescription("Default category for otherwise uncategorized features"); //$NON-NLS-1$
defaultCategory.setLabel("Uncategorized"); //$NON-NLS-1$
defaultCategory.setName("Default"); //$NON-NLS-1$
- defaultCategorySet = new HashSet(1);
+ defaultCategorySet = new HashSet<SiteCategory>(1);
defaultCategorySet.add(defaultCategory);
}
@@ -93,24 +95,24 @@ public class SiteXMLAction extends AbstractPublisherAction {
}
private IStatus generateCategories(IPublisherInfo info, IPublisherResult results, IProgressMonitor monitor) {
- Map categoriesToFeatureIUs = new HashMap();
- Map featuresToCategories = getFeatureToCategoryMappings(info);
- for (Iterator i = featuresToCategories.keySet().iterator(); i.hasNext();) {
+ Map<SiteCategory, Set<IInstallableUnit>> categoriesToFeatureIUs = new HashMap<SiteCategory, Set<IInstallableUnit>>();
+ Map<SiteFeature, Set<SiteCategory>> featuresToCategories = getFeatureToCategoryMappings(info);
+ for (Iterator<SiteFeature> i = featuresToCategories.keySet().iterator(); i.hasNext();) {
if (monitor.isCanceled())
return Status.CANCEL_STATUS;
- SiteFeature feature = (SiteFeature) i.next();
+ SiteFeature feature = i.next();
IInstallableUnit iu = getFeatureIU(feature, info, results);
if (iu == null)
continue;
- Set categories = (Set) featuresToCategories.get(feature);
+ Set<SiteCategory> categories = featuresToCategories.get(feature);
// if there are no categories for this feature then add it to the default category.
if (categories == null || categories.isEmpty())
categories = defaultCategorySet;
- for (Iterator it = categories.iterator(); it.hasNext();) {
- SiteCategory category = (SiteCategory) it.next();
- Set featureIUs = (Set) categoriesToFeatureIUs.get(category);
+ for (Iterator<SiteCategory> it = categories.iterator(); it.hasNext();) {
+ SiteCategory category = it.next();
+ Set<IInstallableUnit> featureIUs = categoriesToFeatureIUs.get(category);
if (featureIUs == null) {
- featureIUs = new HashSet();
+ featureIUs = new HashSet<IInstallableUnit>();
categoriesToFeatureIUs.put(category, featureIUs);
}
featureIUs.add(iu);
@@ -124,9 +126,9 @@ public class SiteXMLAction extends AbstractPublisherAction {
String id = feature.getFeatureIdentifier() + ".feature.group"; //$NON-NLS-1$
String versionString = feature.getFeatureVersion();
Version version = versionString != null && versionString.length() > 0 ? Version.create(versionString) : Version.emptyVersion;
- IQuery query = null;
+ IQuery<IInstallableUnit> query = null;
if (version.equals(Version.emptyVersion)) {
- query = new PipedQuery(new IQuery[] {new InstallableUnitQuery(id), new LatestIUVersionQuery()});
+ query = new PipedQuery<IInstallableUnit>(new InstallableUnitQuery(id), new LatestIUVersionQuery<IInstallableUnit>());
} else {
String qualifier;
try {
@@ -136,31 +138,30 @@ public class SiteXMLAction extends AbstractPublisherAction {
}
if (qualifier != null && qualifier.endsWith(QUALIFIER)) {
final String v = versionString.substring(0, versionString.indexOf(QUALIFIER));
- IQuery qualifierQuery = new InstallableUnitQuery(id) {
+ IQuery<IInstallableUnit> qualifierQuery = new InstallableUnitQuery(id) {
private String qualifierVersion = v.endsWith(".") ? v.substring(0, v.length() - 1) : v; //$NON-NLS-1$
- public boolean isMatch(Object object) {
- if (super.isMatch(object)) {
- IInstallableUnit candidate = (IInstallableUnit) object;
+ public boolean isMatch(IInstallableUnit candidate) {
+ if (super.isMatch(candidate)) {
return candidate.getVersion().toString().startsWith(qualifierVersion);
}
return false;
}
};
- query = new PipedQuery(new IQuery[] {qualifierQuery, new LatestIUVersionQuery()});
+ query = new PipedQuery<IInstallableUnit>(qualifierQuery, new LatestIUVersionQuery<IInstallableUnit>());
} else {
- query = new LimitQuery(new InstallableUnitQuery(id, version), 1);
+ query = new LimitQuery<IInstallableUnit>(new InstallableUnitQuery(id, version), 1);
}
}
- IQueryResult queryResult = results.query(query, null);
+ IQueryResult<IInstallableUnit> queryResult = results.query(query, null);
if (queryResult.isEmpty())
queryResult = publisherInfo.getMetadataRepository().query(query, null);
if (queryResult.isEmpty() && publisherInfo.getContextMetadataRepository() != null)
queryResult = publisherInfo.getContextMetadataRepository().query(query, null);
if (!queryResult.isEmpty())
- return (IInstallableUnit) queryResult.iterator().next();
+ return queryResult.iterator().next();
return null;
}
@@ -169,8 +170,8 @@ public class SiteXMLAction extends AbstractPublisherAction {
* if available. Returns an empty map if there is not site.xml, or no categories.
* @return A map of SiteFeature -> Set<SiteCategory>.
*/
- protected Map getFeatureToCategoryMappings(IPublisherInfo info) {
- HashMap mappings = new HashMap();
+ protected Map<SiteFeature, Set<SiteCategory>> getFeatureToCategoryMappings(IPublisherInfo info) {
+ HashMap<SiteFeature, Set<SiteCategory>> mappings = new HashMap<SiteFeature, Set<SiteCategory>>();
if (updateSite == null)
return mappings;
SiteModel site = updateSite.getSite();
@@ -199,12 +200,12 @@ public class SiteXMLAction extends AbstractPublisherAction {
File siteFile = URIUtil.toFile(updateSite.getLocation());
if (siteFile != null && siteFile.exists()) {
File siteParent = siteFile.getParentFile();
- List messageKeys = site.getMessageKeys();
+ List<String> messageKeys = site.getMessageKeys();
if (siteParent.isDirectory()) {
- String[] keyStrings = (String[]) messageKeys.toArray(new String[messageKeys.size()]);
+ String[] keyStrings = messageKeys.toArray(new String[messageKeys.size()]);
site.setLocalizations(LocalizationHelper.getDirPropertyLocalizations(siteParent, "site", null, keyStrings)); //$NON-NLS-1$
} else if (siteFile.getName().endsWith(".jar")) { //$NON-NLS-1$
- String[] keyStrings = (String[]) messageKeys.toArray(new String[messageKeys.size()]);
+ String[] keyStrings = messageKeys.toArray(new String[messageKeys.size()]);
site.setLocalizations(LocalizationHelper.getJarPropertyLocalizations(siteParent, "site", null, keyStrings)); //$NON-NLS-1$
}
}
@@ -213,7 +214,7 @@ public class SiteXMLAction extends AbstractPublisherAction {
for (int i = 0; i < features.length; i++) {
//add a mapping for each category this feature belongs to
String[] categoryNames = features[i].getCategoryNames();
- Set categories = new HashSet();
+ Set<SiteCategory> categories = new HashSet<SiteCategory>();
mappings.put(features[i], categories);
for (int j = 0; j < categoryNames.length; j++) {
SiteCategory category = site.getCategory(categoryNames[j]);
@@ -251,10 +252,10 @@ public class SiteXMLAction extends AbstractPublisherAction {
* @param categoriesToFeatures Map of SiteCategory ->Set (Feature IUs in that category).
* @param result The generator result being built
*/
- protected void generateCategoryIUs(Map categoriesToFeatures, IPublisherResult result) {
- for (Iterator it = categoriesToFeatures.keySet().iterator(); it.hasNext();) {
- SiteCategory category = (SiteCategory) it.next();
- result.addIU(createCategoryIU(category, (Set) categoriesToFeatures.get(category), null), IPublisherResult.NON_ROOT);
+ protected void generateCategoryIUs(Map<SiteCategory, Set<IInstallableUnit>> categoriesToFeatures, IPublisherResult result) {
+ for (Iterator<SiteCategory> it = categoriesToFeatures.keySet().iterator(); it.hasNext();) {
+ SiteCategory category = it.next();
+ result.addIU(createCategoryIU(category, categoriesToFeatures.get(category), null), IPublisherResult.NON_ROOT);
}
}
@@ -265,7 +266,7 @@ public class SiteXMLAction extends AbstractPublisherAction {
* @param parentCategory The parent category, or <code>null</code>
* @return an IU representing the category
*/
- public IInstallableUnit createCategoryIU(SiteCategory category, Set featureIUs, IInstallableUnit parentCategory) {
+ public IInstallableUnit createCategoryIU(SiteCategory category, Set<IInstallableUnit> featureIUs, IInstallableUnit parentCategory) {
InstallableUnitDescription cat = new MetadataFactory.InstallableUnitDescription();
cat.setSingleton(true);
String categoryId = buildCategoryId(category.getName());
@@ -276,9 +277,9 @@ public class SiteXMLAction extends AbstractPublisherAction {
cat.setProperty(IInstallableUnit.PROP_NAME, label != null ? label : category.getName());
cat.setProperty(IInstallableUnit.PROP_DESCRIPTION, category.getDescription());
- ArrayList reqsConfigurationUnits = new ArrayList(featureIUs.size());
- for (Iterator iterator = featureIUs.iterator(); iterator.hasNext();) {
- IInstallableUnit iu = (IInstallableUnit) iterator.next();
+ ArrayList<IRequiredCapability> reqsConfigurationUnits = new ArrayList<IRequiredCapability>(featureIUs.size());
+ for (Iterator<IInstallableUnit> iterator = featureIUs.iterator(); iterator.hasNext();) {
+ IInstallableUnit iu = iterator.next();
VersionRange range = new VersionRange(iu.getVersion(), true, iu.getVersion(), true);
reqsConfigurationUnits.add(MetadataFactory.createRequiredCapability(IInstallableUnit.NAMESPACE_IU_ID, iu.getId(), range, iu.getFilter() == null ? null : ((LDAPQuery) iu.getFilter()).getFilter(), false, false));
}
@@ -286,27 +287,27 @@ public class SiteXMLAction extends AbstractPublisherAction {
if (parentCategory != null) {
reqsConfigurationUnits.add(MetadataFactory.createRequiredCapability(IInstallableUnit.NAMESPACE_IU_ID, parentCategory.getId(), VersionRange.emptyRange, parentCategory.getFilter() == null ? null : ((LDAPQuery) parentCategory.getFilter()).getFilter(), false, false));
}
- cat.setRequiredCapabilities((IRequirement[]) reqsConfigurationUnits.toArray(new IRequirement[reqsConfigurationUnits.size()]));
+ cat.setRequiredCapabilities(reqsConfigurationUnits.toArray(new IRequirement[reqsConfigurationUnits.size()]));
// Create set of provided capabilities
- ArrayList providedCapabilities = new ArrayList();
+ ArrayList<IProvidedCapability> providedCapabilities = new ArrayList<IProvidedCapability>();
providedCapabilities.add(PublisherHelper.createSelfCapability(categoryId, cat.getVersion()));
- Map localizations = category.getLocalizations();
+ Map<Locale, Map<String, String>> localizations = category.getLocalizations();
if (localizations != null) {
- for (Iterator iter = localizations.keySet().iterator(); iter.hasNext();) {
- Locale locale = (Locale) iter.next();
- Properties translatedStrings = (Properties) localizations.get(locale);
- Enumeration propertyKeys = translatedStrings.propertyNames();
- while (propertyKeys.hasMoreElements()) {
- String nextKey = (String) propertyKeys.nextElement();
- cat.setProperty(locale.toString() + '.' + nextKey, translatedStrings.getProperty(nextKey));
+ for (Iterator<Entry<Locale, Map<String, String>>> iter = localizations.entrySet().iterator(); iter.hasNext();) {
+ Entry<Locale, Map<String, String>> locEntry = iter.next();
+ Locale locale = locEntry.getKey();
+ Map<String, String> translatedStrings = locEntry.getValue();
+ for (Iterator<Entry<String, String>> transIter = translatedStrings.entrySet().iterator(); transIter.hasNext();) {
+ Entry<String, String> e = transIter.next();
+ cat.setProperty(locale.toString() + '.' + e.getKey(), e.getValue());
}
providedCapabilities.add(PublisherHelper.makeTranslationCapability(categoryId, locale));
}
}
- cat.setCapabilities((IProvidedCapability[]) providedCapabilities.toArray(new IProvidedCapability[providedCapabilities.size()]));
+ cat.setCapabilities(providedCapabilities.toArray(new IProvidedCapability[providedCapabilities.size()]));
cat.setArtifacts(new IArtifactKey[0]);
cat.setProperty(InstallableUnitDescription.PROP_TYPE_CATEGORY, "true"); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/UpdateSite.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/UpdateSite.java
index 461d38ce3..68981028f 100644
--- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/UpdateSite.java
+++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/UpdateSite.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.updatesite;
+import org.eclipse.equinox.p2.publisher.eclipse.Feature;
+
import java.io.*;
import java.net.*;
import java.util.HashMap;
@@ -50,9 +52,9 @@ public class UpdateSite {
* Some variables for caching.
*/
// map of String (URI.toString()) to UpdateSite
- private static Map siteCache = new HashMap();
+ private static Map<String, UpdateSite> siteCache = new HashMap<String, UpdateSite>();
// map of String (featureID_featureVersion) to Feature
- private Map featureCache = new HashMap();
+ private Map<String, Feature> featureCache = new HashMap<String, Feature>();
/*
* Return a URI based on the given URI, which points to a site.xml file.
@@ -81,7 +83,7 @@ public class UpdateSite {
public static synchronized UpdateSite loadCategoryFile(URI location, IProgressMonitor monitor) throws ProvisionException {
if (location == null)
return null;
- UpdateSite result = (UpdateSite) siteCache.get(location.toString());
+ UpdateSite result = siteCache.get(location.toString());
if (result != null)
return result;
InputStream input = null;
@@ -119,7 +121,7 @@ public class UpdateSite {
public static synchronized UpdateSite load(URI location, IProgressMonitor monitor) throws ProvisionException {
if (location == null)
return null;
- UpdateSite result = (UpdateSite) siteCache.get(location.toString());
+ UpdateSite result = siteCache.get(location.toString());
if (result != null)
return result;
InputStream input = null;
@@ -436,7 +438,7 @@ public class UpdateSite {
*/
public synchronized Feature[] loadFeatures(IProgressMonitor monitor) throws ProvisionException {
if (!featureCache.isEmpty())
- return (Feature[]) featureCache.values().toArray(new Feature[featureCache.size()]);
+ return featureCache.values().toArray(new Feature[featureCache.size()]);
Feature[] result = loadFeaturesFromDigest(monitor);
return result == null ? loadFeaturesFromSite(monitor) : result;
}
@@ -477,7 +479,7 @@ public class UpdateSite {
Feature[] features = new DigestParser().parse(digestFile, digestURI);
if (features == null)
return null;
- Map tmpFeatureCache = new HashMap(features.length);
+ Map<String, Feature> tmpFeatureCache = new HashMap<String, Feature>(features.length);
for (int i = 0; i < features.length; i++) {
String key = features[i].getId() + VERSION_SEPARATOR + features[i].getVersion();
tmpFeatureCache.put(key, features[i]);
@@ -518,7 +520,7 @@ public class UpdateSite {
private Feature[] loadFeaturesFromSite(IProgressMonitor monitor) throws ProvisionException {
SiteFeature[] siteFeatures = site.getFeatures();
FeatureParser featureParser = new FeatureParser();
- Map tmpFeatureCache = new HashMap(siteFeatures.length);
+ Map<String, Feature> tmpFeatureCache = new HashMap<String, Feature>(siteFeatures.length);
for (int i = 0; i < siteFeatures.length; i++) {
if (monitor.isCanceled()) {
@@ -546,13 +548,13 @@ public class UpdateSite {
}
}
featureCache = tmpFeatureCache;
- return (Feature[]) featureCache.values().toArray(new Feature[featureCache.size()]);
+ return featureCache.values().toArray(new Feature[featureCache.size()]);
}
/*
* Load the features that are included by the given feature.
*/
- private void loadIncludedFeatures(Feature feature, FeatureParser featureParser, Map features, IProgressMonitor monitor) throws ProvisionException {
+ private void loadIncludedFeatures(Feature feature, FeatureParser featureParser, Map<String, Feature> features, IProgressMonitor monitor) throws ProvisionException {
FeatureEntry[] featureEntries = feature.getEntries();
for (int i = 0; i < featureEntries.length; i++) {
if (monitor.isCanceled())
diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/artifact/UpdateSiteArtifactRepository.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/artifact/UpdateSiteArtifactRepository.java
index eb48caa6d..0a949e51a 100644
--- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/artifact/UpdateSiteArtifactRepository.java
+++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/artifact/UpdateSiteArtifactRepository.java
@@ -10,16 +10,16 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.updatesite.artifact;
-import org.eclipse.equinox.p2.metadata.query.IQueryResult;
-
import java.io.OutputStream;
import java.net.URI;
import java.util.Map;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
+import org.eclipse.equinox.internal.provisional.p2.metadata.query.IQueryable;
import org.eclipse.equinox.p2.metadata.IArtifactKey;
import org.eclipse.equinox.p2.metadata.query.IQuery;
+import org.eclipse.equinox.p2.metadata.query.IQueryResult;
import org.eclipse.equinox.p2.repository.artifact.*;
public class UpdateSiteArtifactRepository implements IArtifactRepository {
@@ -96,7 +96,7 @@ public class UpdateSiteArtifactRepository implements IArtifactRepository {
return delegate.getName();
}
- public Map getProperties() {
+ public Map<String, String> getProperties() {
return delegate.getProperties();
}
@@ -132,6 +132,7 @@ public class UpdateSiteArtifactRepository implements IArtifactRepository {
throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$
}
+ @SuppressWarnings("rawtypes")
public Object getAdapter(Class adapter) {
return delegate.getAdapter(adapter);
}
@@ -140,7 +141,11 @@ public class UpdateSiteArtifactRepository implements IArtifactRepository {
return delegate.createArtifactDescriptor(key);
}
- public IQueryResult query(IQuery query, IProgressMonitor monitor) {
+ public IQueryable<IArtifactDescriptor> descriptorQueryable() {
+ return delegate.descriptorQueryable();
+ }
+
+ public IQueryResult<IArtifactKey> query(IQuery<IArtifactKey> query, IProgressMonitor monitor) {
return delegate.query(query, monitor);
}
}
diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/artifact/UpdateSiteArtifactRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/artifact/UpdateSiteArtifactRepositoryFactory.java
index 38064996d..6c0a882d8 100644
--- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/artifact/UpdateSiteArtifactRepositoryFactory.java
+++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/artifact/UpdateSiteArtifactRepositoryFactory.java
@@ -34,7 +34,7 @@ public class UpdateSiteArtifactRepositoryFactory extends ArtifactRepositoryFacto
/* (non-Javadoc)
* @see org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.ArtifactRepositoryFactory#create(java.net.URL, java.lang.String, java.lang.String, java.util.Map)
*/
- public IArtifactRepository create(URI location, String name, String type, Map properties) {
+ public IArtifactRepository create(URI location, String name, String type, Map<String, String> properties) {
return null;
}
@@ -85,7 +85,7 @@ public class UpdateSiteArtifactRepositoryFactory extends ArtifactRepositoryFacto
public void initializeRepository(IArtifactRepository repository, URI location, IProgressMonitor monitor) throws ProvisionException {
UpdateSite updateSite = UpdateSite.load(location, monitor);
- String savedChecksum = (String) repository.getProperties().get(PROP_SITE_CHECKSUM);
+ String savedChecksum = repository.getProperties().get(PROP_SITE_CHECKSUM);
if (savedChecksum != null && savedChecksum.equals(updateSite.getChecksum()))
return;
@@ -101,7 +101,7 @@ public class UpdateSiteArtifactRepositoryFactory extends ArtifactRepositoryFacto
private void generateArtifactDescriptors(UpdateSite updateSite, IArtifactRepository repository, IProgressMonitor monitor) throws ProvisionException {
final String PACK_EXT = ".pack.gz"; //$NON-NLS-1$
Feature[] features = updateSite.loadFeatures(monitor);
- Set allSiteArtifacts = new HashSet();
+ Set<IArtifactDescriptor> allSiteArtifacts = new HashSet<IArtifactDescriptor>();
boolean packSupported = updateSite.getSite().isPack200Supported();
for (int i = 0; i < features.length; i++) {
Feature feature = features[i];
@@ -147,7 +147,7 @@ public class UpdateSiteArtifactRepositoryFactory extends ArtifactRepositoryFacto
}
}
- IArtifactDescriptor[] descriptors = (IArtifactDescriptor[]) allSiteArtifacts.toArray(new IArtifactDescriptor[allSiteArtifacts.size()]);
+ IArtifactDescriptor[] descriptors = allSiteArtifacts.toArray(new IArtifactDescriptor[allSiteArtifacts.size()]);
repository.addDescriptors(descriptors);
}
}
diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepository.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepository.java
index 4b6786e1f..48c82038b 100644
--- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepository.java
+++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepository.java
@@ -10,13 +10,12 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.updatesite.metadata;
-import org.eclipse.equinox.p2.metadata.query.IQueryResult;
-
import java.net.URI;
import java.util.Map;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.query.IQuery;
+import org.eclipse.equinox.p2.metadata.query.IQueryResult;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
public class UpdateSiteMetadataRepository implements IMetadataRepository {
@@ -60,7 +59,7 @@ public class UpdateSiteMetadataRepository implements IMetadataRepository {
return delegate.getName();
}
- public Map getProperties() {
+ public Map<String, String> getProperties() {
return delegate.getProperties();
}
@@ -96,11 +95,12 @@ public class UpdateSiteMetadataRepository implements IMetadataRepository {
throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$
}
+ @SuppressWarnings("rawtypes")
public Object getAdapter(Class adapter) {
return delegate.getAdapter(adapter);
}
- public IQueryResult query(IQuery query, IProgressMonitor monitor) {
+ public IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor) {
return delegate.query(query, monitor);
}
} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepositoryFactory.java
index f1f2f4e01..cbdbdcaa0 100644
--- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepositoryFactory.java
+++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepositoryFactory.java
@@ -42,7 +42,7 @@ public class UpdateSiteMetadataRepositoryFactory extends MetadataRepositoryFacto
/* (non-Javadoc)
* @see org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository.MetadataRepositoryFactory#create(java.net.URL, java.lang.String, java.lang.String, java.util.Map)
*/
- public IMetadataRepository create(URI location, String name, String type, Map properties) {
+ public IMetadataRepository create(URI location, String name, String type, Map<String, String> properties) {
return null;
}
@@ -103,7 +103,7 @@ public class UpdateSiteMetadataRepositoryFactory extends MetadataRepositoryFacto
public void initializeRepository(IMetadataRepository repository, URI location, IProgressMonitor monitor) throws ProvisionException {
UpdateSite updateSite = UpdateSite.load(location, monitor);
- String savedChecksum = (String) repository.getProperties().get(PROP_SITE_CHECKSUM);
+ String savedChecksum = repository.getProperties().get(PROP_SITE_CHECKSUM);
if (savedChecksum != null && savedChecksum.equals(updateSite.getChecksum()))
return;
repository.setProperty(PROP_SITE_CHECKSUM, updateSite.getChecksum());

Back to the top