diff options
author | Markus Knauer | 2007-10-19 15:46:48 +0000 |
---|---|---|
committer | Markus Knauer | 2007-10-19 15:46:48 +0000 |
commit | d43514de9b872baf26b03874d884410f4a07cc11 (patch) | |
tree | 30f07684735e9323568c7545c2bb56b6b4b370cb /plugins | |
parent | 0b0666736c432614d1314e6c6a9082fadc676246 (diff) | |
download | org.eclipse.epp.packages-d43514de9b872baf26b03874d884410f4a07cc11.tar.gz org.eclipse.epp.packages-d43514de9b872baf26b03874d884410f4a07cc11.tar.xz org.eclipse.epp.packages-d43514de9b872baf26b03874d884410f4a07cc11.zip |
automatic version number selection ('latest')
Diffstat (limited to 'plugins')
15 files changed, 312 insertions, 74 deletions
diff --git a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/PackagingApplication.java b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/PackagingApplication.java index 1ac19709..69320ace 100644 --- a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/PackagingApplication.java +++ b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/PackagingApplication.java @@ -10,9 +10,10 @@ *******************************************************************************/ package org.eclipse.epp.packaging.core; -import java.util.Iterator; import java.util.Map; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.epp.packaging.core.configuration.ArgumentParser; import org.eclipse.epp.packaging.core.configuration.ICommands; import org.eclipse.epp.packaging.core.configuration.IPackagerConfiguration; @@ -26,12 +27,28 @@ import org.eclipse.equinox.app.IApplicationContext; public class PackagingApplication implements IApplication { public Object start( final IApplicationContext context ) throws Exception { - Map arguments = context.getArguments(); + Map<?, ?> arguments = context.getArguments(); String[] args = ( String[] )arguments.get( IApplicationContext.APPLICATION_ARGS ); ICommands commands = ArgumentParser.parse( args ); - ConfigurationParser configurationParser = new ConfigurationParser( commands.getConfigurationFile() ); - IPackagerConfiguration configuration = configurationParser.parseConfiguration(); - new EclipsePackagingExecutor( commands, configuration ).execute(); + ConfigurationParser configurationParser + = new ConfigurationParser( commands.getConfigurationFile() ); + IPackagerConfiguration configuration + = configurationParser.parseConfiguration(); + IStatus checkFeaturesResult + = configuration.checkFeatures( new NullProgressMonitor() ); + + IStatus[] status = checkFeaturesResult.getChildren(); + for( IStatus singleStatus : status ) { + System.out.println( singleStatus.getMessage() ); + } + + if( checkFeaturesResult.getSeverity() == IStatus.OK + || checkFeaturesResult.getSeverity() == IStatus.INFO + || checkFeaturesResult.getSeverity() == IStatus.WARNING ) { + EclipsePackagingExecutor packagingExecutor + = new EclipsePackagingExecutor( commands, configuration ); + packagingExecutor.execute(); + } return EXIT_OK; } diff --git a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/configuration/ArgumentParser.java b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/configuration/ArgumentParser.java index ce8bc251..c3b26669 100644 --- a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/configuration/ArgumentParser.java +++ b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/configuration/ArgumentParser.java @@ -16,20 +16,20 @@ package org.eclipse.epp.packaging.core.configuration; public class ArgumentParser { /** + * @param args the argument vector as a String array + * @return an initialised <code>ICommand</code> object with the parsed + * command line options * @throws IllegalArgumentException if arguments is no array of strings. */ - public static ICommands parse( final Object arguments ) { - String[] strings; - try { - strings = ( String[] )arguments; - } catch( ClassCastException exception ) { - throw new IllegalArgumentException( "Arguments must be an array of String.", exception ); //$NON-NLS-1$ + public static ICommands parse( final String[] args ) { + if( args == null || args.length == 0 ) { + throw new IllegalArgumentException( "Argument must contain at least one value." ); //$NON-NLS-1$ } Commands command = new Commands(); - command.setConfigurationFile( strings[ 0 ] ); - if( strings.length > 1 ) { - String[] tasks = new String[ strings.length - 1 ]; - System.arraycopy( strings, 1, tasks, 0, tasks.length ); + command.setConfigurationFile( args[ 0 ] ); + if( args.length > 1 ) { + String[] tasks = new String[ args.length - 1 ]; + System.arraycopy( args, 1, tasks, 0, tasks.length ); command.setTasks( tasks ); } return command; diff --git a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/configuration/FeatureVersionRepository.java b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/configuration/FeatureVersionRepository.java new file mode 100644 index 00000000..7101907b --- /dev/null +++ b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/configuration/FeatureVersionRepository.java @@ -0,0 +1,102 @@ +/******************************************************************************* + * Copyright (c) 2007 Innoopract Informationssysteme GmbH + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Innoopract - initial API and implementation + *******************************************************************************/ +package org.eclipse.epp.packaging.core.configuration; + +import java.util.HashMap; +import java.util.Map; +import java.util.SortedSet; +import java.util.TreeSet; + +import org.eclipse.core.runtime.PluginVersionIdentifier; +import org.eclipse.update.core.VersionedIdentifier; +import org.osgi.framework.Version; + + +/** + * + */ +public class FeatureVersionRepository { + + private Map<String, VersionList> features = new HashMap<String, VersionList>(); + + public void addVersionIdentifier( final VersionedIdentifier versionedIdentifier ) { + String identifier = versionedIdentifier.getIdentifier(); + PluginVersionIdentifier version = versionedIdentifier.getVersion(); + if( !this.features.containsKey( identifier ) ) { + this.features.put( identifier, new VersionList() ); + } + VersionList versionList = this.features.get( identifier ); + versionList.addVersion( version ); + } + + /** + * Searches for the highest version number of a given feature or bundle, + * identified by the identifier string. + * + * @param identifier of the feature + * @return the highest available version number or <code>null</code> if the + * identifier is not found. + */ + public PluginVersionIdentifier getHighestVersion( final String identifier ) { + PluginVersionIdentifier result = null; + VersionList versionList = this.features.get( identifier ); + if( versionList != null ) { + result = versionList.getHighestVersion(); + } + return result; + } + + /** + * Checks if a given identifier is already in the list of available features. + * + * @param identifier String with the feature identifier. + * @return <code>true</code> if the identifier is found in the list of + * available features, <code>false</code> otherwise. + */ + public boolean containsIdentifier( final String identifier ) { + return this.features.containsKey( identifier ); + } + + + /** + * This class provides a modifiable list of + * <code>PluginVersionIdentifier</code> and returns the highest possible + * version number. Internally it uses the OSGi <code>Version</code> + * implementation because of its <code>Comparable</code> interface. + */ + class VersionList { + + private SortedSet<Version> versions = new TreeSet<Version>(); + + /** + * Adds a new version to the list of available versions if the version is + * not yet included in the list. + * + * @param versionIdentifier the version that is to be added to the list + */ + void addVersion( final PluginVersionIdentifier versionIdentifier ) { + Version version = new Version( versionIdentifier.getMajorComponent(), + versionIdentifier.getMinorComponent(), + versionIdentifier.getServiceComponent(), + versionIdentifier.getQualifierComponent() ); + if( !this.versions.contains( version ) ) { + this.versions.add( version ); + } + } + + /** + * @return the highest version number in the list + */ + PluginVersionIdentifier getHighestVersion() { + return new PluginVersionIdentifier( this.versions.last().toString() ); + } + } +} diff --git a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/configuration/IPackagerConfiguration.java b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/configuration/IPackagerConfiguration.java index 178eb698..387d5413 100644 --- a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/configuration/IPackagerConfiguration.java +++ b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/configuration/IPackagerConfiguration.java @@ -12,6 +12,10 @@ package org.eclipse.epp.packaging.core.configuration; import java.io.File; import java.net.URL; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; import org.eclipse.update.core.VersionedIdentifier; /** @@ -40,4 +44,6 @@ public interface IPackagerConfiguration { public String getEclipseProductId(); public String getInitialPerspectiveId(); + + public IStatus checkFeatures( IProgressMonitor monitor ) throws CoreException; }
\ No newline at end of file diff --git a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/configuration/PackagerConfiguration.java b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/configuration/PackagerConfiguration.java index e10dc5e1..13534f55 100644 --- a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/configuration/PackagerConfiguration.java +++ b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/configuration/PackagerConfiguration.java @@ -15,6 +15,17 @@ import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.List; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.MultiStatus; +import org.eclipse.core.runtime.PluginVersionIdentifier; +import org.eclipse.core.runtime.Status; +import org.eclipse.epp.packaging.core.logging.MessageLogger; +import org.eclipse.update.core.ISite; +import org.eclipse.update.core.ISiteFeatureReference; +import org.eclipse.update.core.SiteManager; import org.eclipse.update.core.VersionedIdentifier; /** @@ -23,11 +34,13 @@ import org.eclipse.update.core.VersionedIdentifier; */ public class PackagerConfiguration implements IModifiablePackagerConfiguration { + private static final String PLUGIN_ID = "org.eclipse.epp.packaging.core"; //$NON-NLS-1$ + private static final String ECLIPSE_PLATTFORM = "eclipse-platform-"; //$NON-NLS-1$ private final List<URL> updateSites = new ArrayList<URL>(); - private final List<VersionedIdentifier> requiredFeatures = new ArrayList<VersionedIdentifier>(); private final List<Platform> targetPlatforms = new ArrayList<Platform>(); + private List<VersionedIdentifier> requiredFeatures = new ArrayList<VersionedIdentifier>(); private File packagerConfigurationFolder; private File baseFolder; private File extensionSite; @@ -90,7 +103,7 @@ public class PackagerConfiguration implements IModifiablePackagerConfiguration { } public IPlatform[] getTargetPlatforms() { - return this.targetPlatforms.toArray( new IPlatform[ targetPlatforms.size() ] ); + return this.targetPlatforms.toArray( new IPlatform[ this.targetPlatforms.size() ] ); } public String getRootFileBaseName() { @@ -132,4 +145,61 @@ public class PackagerConfiguration implements IModifiablePackagerConfiguration { public String getInitialPerspectiveId() { return this.initialPerspectiveId; } + + /** + * Creates a list of available feature versions from all given update sites. + * Required features with no version number (0.0.0) are replaced with the + * highest available version number. + * + * TODO mknauer enable logging, progress monitor, check availability of feature + */ + public IStatus checkFeatures( final IProgressMonitor monitor ) + throws CoreException + { + MultiStatus result = new MultiStatus( PLUGIN_ID, IStatus.OK, null, null ); + FeatureVersionRepository availableFeatures = new FeatureVersionRepository(); + List<VersionedIdentifier> newRequiredFeatures = new ArrayList<VersionedIdentifier>(); + createFeatureRepository( monitor, availableFeatures ); + for( VersionedIdentifier featureIdentifier : this.requiredFeatures ) { + PluginVersionIdentifier version = featureIdentifier.getVersion(); + String identifier = featureIdentifier.getIdentifier(); + if( new PluginVersionIdentifier( 0, 0, 0 ).equals( version ) + && availableFeatures.containsIdentifier( identifier ) ) + { + String newVersion + = availableFeatures.getHighestVersion( identifier ).toString(); + String message = "Replacing feature version of " //$NON-NLS-1$ + + identifier + + " with version " //$NON-NLS-1$ + + newVersion; + result.add( new Status( IStatus.INFO, PLUGIN_ID, message ) ); + VersionedIdentifier newVersionId = new VersionedIdentifier( identifier, + newVersion ); + newRequiredFeatures.add( newVersionId ); + } else { + newRequiredFeatures.add( featureIdentifier ); + } + } + this.requiredFeatures = newRequiredFeatures; + return result; + } + + + // internal methods + /////////////////// + + + private void createFeatureRepository( final IProgressMonitor monitor, + final FeatureVersionRepository availableFeatures ) + throws CoreException + { + for( URL url : this.updateSites ) { + ISite site = SiteManager.getSite( url, monitor ); + ISiteFeatureReference[] featureReferences = site.getFeatureReferences(); + for( ISiteFeatureReference featureReference : featureReferences ) { + VersionedIdentifier versionedIdentifier = featureReference.getVersionedIdentifier(); + availableFeatures.addVersionIdentifier( versionedIdentifier ); + } + } + } }
\ No newline at end of file diff --git a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/configuration/xml/ConfigurationParser.java b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/configuration/xml/ConfigurationParser.java index 38f2ae4d..f9963fa7 100644 --- a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/configuration/xml/ConfigurationParser.java +++ b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/configuration/xml/ConfigurationParser.java @@ -19,6 +19,7 @@ import javax.xml.parsers.ParserConfigurationException; import org.eclipse.epp.packaging.core.configuration.IPackagerConfiguration; import org.eclipse.epp.packaging.core.configuration.PackagerConfiguration; import org.eclipse.epp.packaging.core.configuration.Platform; +import org.eclipse.update.core.VersionedIdentifier; import org.xml.sax.SAXException; /** @@ -26,6 +27,8 @@ import org.xml.sax.SAXException; */ public class ConfigurationParser { + private static final String LATEST = "latest"; //$NON-NLS-1$ + private static final String ATTRIB_ARCH = "arch"; //$NON-NLS-1$ private static final String ATTRIB_ECLIPSE_INI_PATH = "path"; //$NON-NLS-1$ private static final String ATTRIB_ECLIPSE_PRODUCT_ID = "eclipseProductId"; //$NON-NLS-1$ @@ -109,6 +112,7 @@ public class ConfigurationParser { return configuration; } + /** Loads and sets the extension site to use. */ private void parseExtensionSite( final PackagerConfiguration configuration, final IXmlElement parent ) @@ -166,14 +170,23 @@ public class ConfigurationParser { configuration.setRcpVersion( rcpVersion ); } - /** Loads and sets the required features. */ + /** + * Loads and sets the required features. + */ private void parseRequiredFeatures( final PackagerConfiguration configuration, final IXmlElement parent ) { IXmlElement element = parent.getElement( TAG_REQUIRED_FEATURES ); for( IXmlElement featureElement : getElements( element, TAG_FEATURE ) ) { + String version = featureElement.getAttributeValue( ATTRIB_VERSION ); + if( version != null ) { + version = version.trim(); + if( version.length() == 0 || LATEST.equalsIgnoreCase( version ) ) { + version = null; + } + } configuration.addRequiredFeature( featureElement.getAttributeValue( ATTRIB_ID ), - featureElement.getAttributeValue( ATTRIB_VERSION ) ); + version ); } } diff --git a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/download/ExtensionSiteManager.java b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/download/ExtensionSiteManager.java index 62f536f6..e3b3e1fd 100644 --- a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/download/ExtensionSiteManager.java +++ b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/download/ExtensionSiteManager.java @@ -36,18 +36,18 @@ public class ExtensionSiteManager { public void installFeatures( final IUpdateSiteManager manager ) throws IOException, CoreException { - File localSiteFolder = configuration.getExtensionSite(); - MessageLogger.getInstance() - .log( "ExtensionSiteManager.SiteCreated", localSiteFolder ); //$NON-NLS-1$ + File localSiteFolder = this.configuration.getExtensionSite(); + MessageLogger.getInstance().log( "ExtensionSiteManager.SiteCreated", //$NON-NLS-1$ + localSiteFolder ); IConfiguredSite site = SiteCreator.createInstallationSite( localSiteFolder ); - for( IPlatform platform : configuration.getTargetPlatforms() ) { - MessageLogger.getInstance() - .logBeginProcess( "ExtensionSiteManager.InstallPlatform", //$NON-NLS-1$ - platform ); + for( IPlatform platform : this.configuration.getTargetPlatforms() ) { + MessageLogger.getInstance().logBeginProcess( "ExtensionSiteManager.InstallPlatform", //$NON-NLS-1$ + platform ); platform.configureSite(); for( IFeature feature : manager.getFeatures() ) { - MessageLogger.getInstance() - .logBeginProcess( "ExtensionSiteManager.Installing", feature.getVersionedIdentifier().getIdentifier() ); //$NON-NLS-1$ + String identifier = feature.getVersionedIdentifier().getIdentifier(); + MessageLogger.getInstance().logBeginProcess( "ExtensionSiteManager.Installing", //$NON-NLS-1$ + identifier ); site.install( feature, null, new NullProgressMonitor() ); MessageLogger.getInstance().logEndProcess(); } diff --git a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/download/FeatureRetrievingSearchCollector.java b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/download/FeatureRetrievingSearchCollector.java index 19331916..4556fc9b 100644 --- a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/download/FeatureRetrievingSearchCollector.java +++ b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/download/FeatureRetrievingSearchCollector.java @@ -17,22 +17,24 @@ import org.eclipse.update.core.IFeature; import org.eclipse.update.core.VersionedIdentifier; import org.eclipse.update.search.IUpdateSearchResultCollector; -/** An UpdateSearchResultCollector returning a feature.*/ +/** + * An UpdateSearchResultCollector returning a feature. + */ public class FeatureRetrievingSearchCollector implements IUpdateSearchResultCollector { - private final List<IFeature> result = new ArrayList<IFeature>(); + private final List<IFeature> features = new ArrayList<IFeature>(); private final List<VersionedIdentifier> identifiers = new ArrayList<VersionedIdentifier>(); public void accept( final IFeature match ) { - if( !identifiers.contains( match.getVersionedIdentifier() ) ) { - result.add( match ); - identifiers.add( match.getVersionedIdentifier() ); + if( !this.identifiers.contains( match.getVersionedIdentifier() ) ) { + this.features.add( match ); + this.identifiers.add( match.getVersionedIdentifier() ); } } public IFeature[] getFeatures() { - return result.toArray( new IFeature[ result.size() ] ); + return this.features.toArray( new IFeature[ this.features.size() ] ); } } diff --git a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/download/FeatureSearcher.java b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/download/FeatureSearcher.java index a9be780a..a50453d2 100644 --- a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/download/FeatureSearcher.java +++ b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/download/FeatureSearcher.java @@ -20,7 +20,10 @@ import org.eclipse.update.search.IUpdateSearchResultCollector; import org.eclipse.update.search.UpdateSearchRequest; import org.eclipse.update.search.UpdateSearchScope; -/**Handles and executes the search for a set of features over a number of update sites.*/ +/** + * Handles and executes the search for a set of features over a number of update + * sites. + */ public class FeatureSearcher { private final UpdateSearchScope scope = new UpdateSearchScope(); @@ -30,20 +33,23 @@ public class FeatureSearcher { final URL[] listedSites ) { for( VersionedIdentifier identifier : listedFeatures ) { - category.addFeatureToSearch( identifier ); + this.category.addFeatureToSearch( identifier ); } for( URL siteUrl : listedSites ) { - scope.addSearchSite( "", siteUrl, null ); //$NON-NLS-1$ + this.scope.addSearchSite( "", siteUrl, null ); //$NON-NLS-1$ } } - /**Run the search. - * @param collector the collector storing the search results.*/ + /** + * Run the search. + * + * @param collector the collector storing the search results. + */ public void run( final IUpdateSearchResultCollector collector ) throws OperationCanceledException, CoreException { - UpdateSearchRequest searchRequest = new UpdateSearchRequest( category, - scope ); + UpdateSearchRequest searchRequest + = new UpdateSearchRequest( this.category, this.scope ); searchRequest.performSearch( collector, new NullProgressMonitor() ); } }
\ No newline at end of file diff --git a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/download/FeatureVerifyingSearchCollector.java b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/download/FeatureVerifyingSearchCollector.java index 24283378..57bb752b 100644 --- a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/download/FeatureVerifyingSearchCollector.java +++ b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/download/FeatureVerifyingSearchCollector.java @@ -18,7 +18,10 @@ import org.eclipse.update.core.IFeature; import org.eclipse.update.core.VersionedIdentifier; import org.eclipse.update.search.IUpdateSearchResultCollector; -/**UpdateSearchResultCollector comparing features found with a base set of features to find.*/ +/** + * UpdateSearchResultCollector comparing features found with a base set of + * features to find. + */ public class FeatureVerifyingSearchCollector implements IUpdateSearchResultCollector { @@ -27,20 +30,24 @@ public class FeatureVerifyingSearchCollector public FeatureVerifyingSearchCollector( final VersionedIdentifier[] listedFeatures ) { - Collections.addAll( featuresToFind, listedFeatures ); + Collections.addAll( this.featuresToFind, listedFeatures ); } public void accept( final IFeature feature ) { - featuresToFind.remove( feature.getVersionedIdentifier() ); + this.featuresToFind.remove( feature.getVersionedIdentifier() ); } - /**@return true if all the configured features are found, false otherwise.*/ + /** + * @return true if all the configured features are found, false otherwise. + */ public boolean allFeaturesFound() { - return featuresToFind.isEmpty(); + return this.featuresToFind.isEmpty(); } - /**Returns the list of missing features*/ + /** + * @return the list of missing features + */ public VersionedIdentifier[] getMissingFeatures() { - return featuresToFind.toArray( new VersionedIdentifier[ featuresToFind.size() ] ); + return this.featuresToFind.toArray( new VersionedIdentifier[ this.featuresToFind.size() ] ); } }
\ No newline at end of file diff --git a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/download/IUpdateSiteManager.java b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/download/IUpdateSiteManager.java index 90fa68aa..3213ba1f 100644 --- a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/download/IUpdateSiteManager.java +++ b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/download/IUpdateSiteManager.java @@ -28,7 +28,8 @@ public interface IUpdateSiteManager { public boolean areFeaturesPresent( VersionedIdentifier[] identifiers ) throws CoreException; - /** Returns the IFeatures for the configured feature references + /** + * Returns the IFeatures for the configured feature references */ public IFeature[] getFeatures() throws CoreException; }
\ No newline at end of file diff --git a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/download/PackagerSearchCategory.java b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/download/PackagerSearchCategory.java index b874fd27..eb9332a0 100644 --- a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/download/PackagerSearchCategory.java +++ b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/download/PackagerSearchCategory.java @@ -14,28 +14,32 @@ import org.eclipse.update.core.VersionedIdentifier; import org.eclipse.update.search.IUpdateSearchCategory; import org.eclipse.update.search.IUpdateSearchQuery; -/**An UpdateSearchCategory looking for feature identifiers*/ +/** + * An UpdateSearchCategory looking for feature identifiers + */ public class PackagerSearchCategory implements IUpdateSearchCategory { private final PackagerSearchQuery query = new PackagerSearchQuery(); private String id; public String getId() { - return id; + return this.id; } - /**Adds a feature to search for.*/ + /** + * Adds a feature to search for. + */ public void addFeatureToSearch( final VersionedIdentifier identifier ) { - query.addFeatureIdentifier( identifier ); + this.query.addFeatureIdentifier( identifier ); } public IUpdateSearchQuery[] getQueries() { return new IUpdateSearchQuery[]{ - query + this.query }; } public void setId( final String id ) { this.id = id; } -} +}
\ No newline at end of file diff --git a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/download/PackagerSearchQuery.java b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/download/PackagerSearchQuery.java index e369c144..bd5942bf 100644 --- a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/download/PackagerSearchQuery.java +++ b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/download/PackagerSearchQuery.java @@ -24,7 +24,9 @@ import org.eclipse.update.search.IUpdateSearchFilter; import org.eclipse.update.search.IUpdateSearchQuery; import org.eclipse.update.search.IUpdateSearchResultCollector; -/**Search query looking for occurences of configured features.*/ +/** + * Search query looking for occurrences of configured features. + */ public class PackagerSearchQuery implements IUpdateSearchQuery { private final List<VersionedIdentifier> identifiers = new ArrayList<VersionedIdentifier>(); @@ -42,17 +44,19 @@ public class PackagerSearchQuery implements IUpdateSearchQuery { ISiteFeatureReference[] featureReferences = site.getFeatureReferences(); for( ISiteFeatureReference reference : featureReferences ) { try { - if( identifiers.contains( reference.getVersionedIdentifier() ) ) { + if( this.identifiers.contains( reference.getVersionedIdentifier() ) ) { collector.accept( reference.getFeature( new NullProgressMonitor() ) ); } - } catch( CoreException e ) { + } catch( CoreException ce ) { // The search is over, and there is nothing we could do about it. } } } - /**Add a feature to look for.*/ + /** + * Add a feature to look for. + */ public void addFeatureIdentifier( final VersionedIdentifier identifier ) { - identifiers.add( identifier ); + this.identifiers.add( identifier ); } }
\ No newline at end of file diff --git a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/download/SiteCreator.java b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/download/SiteCreator.java index 2e76310d..af8f7313 100644 --- a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/download/SiteCreator.java +++ b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/download/SiteCreator.java @@ -17,6 +17,7 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.epp.packaging.core.io.FileUtils; import org.eclipse.update.configuration.IConfiguredSite; import org.eclipse.update.configuration.IInstallConfiguration; +import org.eclipse.update.configuration.ILocalSite; import org.eclipse.update.core.SiteManager; /** @@ -24,7 +25,10 @@ import org.eclipse.update.core.SiteManager; */ public class SiteCreator { - /** Adds a new extension site to the system and configures it to be updatable. */ + /** + * Adds a new extension site to the system and configures it to be able to + * update. + */ public static IConfiguredSite createInstallationSite( final File folder ) throws IOException, CoreException { @@ -39,12 +43,14 @@ public class SiteCreator { return site; } - /** Removes an extension site from the system, deleting its content. */ + /** + * Removes an extension site from the system, deleting its content. + */ public static void removeInstallationSite( final String siteString ) throws CoreException, MalformedURLException { - IInstallConfiguration configuration = SiteManager.getLocalSite() - .getCurrentConfiguration(); + ILocalSite localSite = SiteManager.getLocalSite(); + IInstallConfiguration configuration = localSite.getCurrentConfiguration(); IConfiguredSite[] sites = configuration.getConfiguredSites(); File file = new File( siteString ); String fileUrl = file.toURL().toExternalForm() + "eclipse/";//$NON-NLS-1$ diff --git a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/download/UpdateSiteManager.java b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/download/UpdateSiteManager.java index 0433e409..050bf139 100644 --- a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/download/UpdateSiteManager.java +++ b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/download/UpdateSiteManager.java @@ -31,24 +31,22 @@ public class UpdateSiteManager implements IUpdateSiteManager { public UpdateSiteManager( final IPackagerConfiguration configuration ) { this.listedSites = configuration.getUpdateSites(); this.listedFeatures = configuration.getRequiredFeatures(); - MessageLogger.getInstance() - .log( "UpdateSiteManager.ListedSitesCount", listedSites.length ); //$NON-NLS-1$ + MessageLogger.getInstance().log( "UpdateSiteManager.ListedSitesCount", //$NON-NLS-1$ + Integer.valueOf( this.listedSites.length ) ); } public boolean areFeaturesPresent( final VersionedIdentifier[] identifiers ) throws CoreException { - MessageLogger.getInstance() - .logBeginProcess( "UpdateSiteManager.FeatureLookup" ); //$NON-NLS-1$ - FeatureVerifyingSearchCollector collector = new FeatureVerifyingSearchCollector( listedFeatures ); + MessageLogger.getInstance().logBeginProcess( "UpdateSiteManager.FeatureLookup" ); //$NON-NLS-1$ + FeatureVerifyingSearchCollector collector + = new FeatureVerifyingSearchCollector( this.listedFeatures ); search( collector ); boolean result = collector.allFeaturesFound(); if( result ) { - MessageLogger.getInstance() - .logEndProcess( "UpdateSiteManager.FeaturesPresent" ); //$NON-NLS-1$ + MessageLogger.getInstance().logEndProcess( "UpdateSiteManager.FeaturesPresent" ); //$NON-NLS-1$ } else { - MessageLogger.getInstance() - .logEndProcess( "UpdateSiteManager.FeaturesMissing" ); //$NON-NLS-1$ + MessageLogger.getInstance().logEndProcess( "UpdateSiteManager.FeaturesMissing" ); //$NON-NLS-1$ for( VersionedIdentifier feature : collector.getMissingFeatures() ) { MessageLogger.getInstance().log( feature.toString() ); } @@ -65,6 +63,8 @@ public class UpdateSiteManager implements IUpdateSiteManager { private void search( final IUpdateSearchResultCollector collector ) throws CoreException { - new FeatureSearcher( listedFeatures, listedSites ).run( collector ); + FeatureSearcher featureSearcher = new FeatureSearcher( this.listedFeatures, + this.listedSites ); + featureSearcher.run( collector ); } }
\ No newline at end of file |