merge core
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/configuration/IConfiguredSite.java b/update/org.eclipse.update.core/src/org/eclipse/update/configuration/IConfiguredSite.java
index 2da9eef..4382086 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/configuration/IConfiguredSite.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/configuration/IConfiguredSite.java
@@ -218,7 +218,7 @@
* on the underlying site.
*
* @see ISite#getFeatureReferences()
- * @return an array of feature references, or an empty array.
+ * @return an array of site feature references, or an empty array.
* @since 2.0
* <p>
* <b>Note:</b> This method is part of an interim API that is still under development and expected to
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/core/BaseFeatureFactory.java b/update/org.eclipse.update.core/src/org/eclipse/update/core/BaseFeatureFactory.java
index 336a0ae..5deda8d 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/core/BaseFeatureFactory.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/core/BaseFeatureFactory.java
@@ -5,21 +5,11 @@
*/
import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
+import java.net.*;
+import java.util.*;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.update.core.model.FeatureModel;
-import org.eclipse.update.core.model.FeatureModelFactory;
-import org.eclipse.update.core.model.ImportModel;
-import org.eclipse.update.core.model.InstallHandlerEntryModel;
-import org.eclipse.update.core.model.NonPluginEntryModel;
-import org.eclipse.update.core.model.PluginEntryModel;
-import org.eclipse.update.core.model.URLEntryModel;
+import org.eclipse.update.core.model.*;
import org.eclipse.update.internal.core.UpdateManagerPlugin;
import org.eclipse.update.internal.core.UpdateManagerUtils;
@@ -91,6 +81,17 @@
}
/**
+ * Create a concrete implementation of included feature reference model.
+ *
+ * @see IncludedFeatureReference
+ * @return feature model
+ * @since 2.1
+ */
+ public IncludedFeatureReferenceModel createIncludedFeatureReferenceModel() {
+ return new IncludedFeatureReference();
+ }
+
+ /**
* Create a concrete implementation of install handler model.
*
* @see InstallHandlerEntry
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/core/BaseSiteFactory.java b/update/org.eclipse.update.core/src/org/eclipse/update/core/BaseSiteFactory.java
index 9ef49ae..080614b 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/core/BaseSiteFactory.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/core/BaseSiteFactory.java
@@ -86,8 +86,8 @@
* @return feature reference model
* @since 2.0
*/
- public FeatureReferenceModel createFeatureReferenceModel() {
- return new FeatureReference();
+ public SiteFeatureReferenceModel createFeatureReferenceModel() {
+ return new SiteFeatureReference();
}
/**
@@ -133,52 +133,8 @@
* @return InputStream
*/
protected InputStream openStream(URL resolvedURL) throws IOException {
- URLConnection connection = openConnection(resolvedURL);
- return connection.getInputStream();
- }
-
- /**
- * Opens a connection to a URL.
- * Manages time out
- *
- * @param resolvedURL
- * @return URLConnection
- */
- protected URLConnection openConnection(final URL resolvedURL) throws IOException {
-
- /* int time = 100000;
- connection = null;
- exception = null;
-
- Thread thread = new Thread(new Runnable() {
- public void run() {
- try {
- connection = resolvedURL.openConnection();
- } catch (IOException e){
- exception = e;
- }
- }
- });
-
- long start = new Date().getTime();
- boolean timeout = false;
- while (connection==null && !timeout){
- try {
- Thread.currentThread().sleep(2000);
- } catch(InterruptedException e) {
- }
- if(exception!=null) throw exception;
- if (new Date().getTime()-start>time) timeout=true;
- }
-
-
- if (timeout) {
- thread.stop(); // better solution ?
- throw new IOException("Unable to obtain connection to:"+resolvedURL.toExternalForm());
- }
- return connection;*/
-
- return resolvedURL.openConnection();
+ Response response = UpdateManagerPlugin.getPlugin().get(resolvedURL);
+ return response.getInputStream();
}
}
\ No newline at end of file
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/core/ContentReference.java b/update/org.eclipse.update.core/src/org/eclipse/update/core/ContentReference.java
index 561614a..2acac58 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/core/ContentReference.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/core/ContentReference.java
@@ -6,7 +6,6 @@
import java.io.*;
import java.net.URL;
-import java.net.URLConnection;
import org.eclipse.update.internal.core.*;
@@ -43,7 +42,7 @@
private String id;
private URL url; // reference is either URL reference *OR*
private File file; // local file reference
- private URLConnection connection;
+ private Response response;
private int permission;
/*
@@ -112,12 +111,12 @@
if (file != null)
return new FileInputStream(file);
else if (url != null) {
- if (connection == null) {
+ if (response == null) {
URL resolvedURL = URLEncoder.encode(url);
- connection = resolvedURL.openConnection();
- UpdateManagerUtils.checkConnectionResult(connection);
+ response = UpdateManagerPlugin.getPlugin().get(resolvedURL);
+ UpdateManagerUtils.checkConnectionResult(response,resolvedURL);
}
- return connection.getInputStream();
+ return response.getInputStream();
} else
throw new IOException(Policy.bind("ContentReference.UnableToCreateInputStream", this.toString())); //$NON-NLS-1$
}
@@ -132,16 +131,17 @@
if (file != null)
return file.length();
else if (url != null) {
- if (connection == null) {
+ if (response == null) {
+ URL resolvedURL = null;
try {
- URL resolvedURL = URLEncoder.encode(url);
- connection = resolvedURL.openConnection();
+ resolvedURL = URLEncoder.encode(url);
+ response = UpdateManagerPlugin.getPlugin().get(resolvedURL);
} catch (IOException e) {
return ContentReference.UNKNOWN_SIZE;
}
- UpdateManagerUtils.checkConnectionResult(connection);
+ UpdateManagerUtils.checkConnectionResult(response,resolvedURL);
}
- long size = connection.getContentLength();
+ long size = response.getContentLength();
return size == -1 ? ContentReference.UNKNOWN_SIZE : size;
} else
return ContentReference.UNKNOWN_SIZE;
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/core/Feature.java b/update/org.eclipse.update.core/src/org/eclipse/update/core/Feature.java
index 0f6f318..b839b0a 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/core/Feature.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/core/Feature.java
@@ -432,14 +432,37 @@
* @see IFeature#getPluginEntries()
* @since 2.0
*/
- public IPluginEntry[] getPluginEntries() {
+ public IPluginEntry[] getRawPluginEntries() {
PluginEntryModel[] result = getPluginEntryModels();
if (result.length == 0)
return new IPluginEntry[0];
- else
- return (IPluginEntry[]) result;
+ else
+ return (IPluginEntry[])result;
}
+ /*
+ * Method filter.
+ * @param result
+ * @return IPluginEntry[]
+ */
+ private IPluginEntry[] filterPluginEntry(IPluginEntry[] all) {
+ List list = new ArrayList();
+ if (all!=null){
+ for (int i = 0; i < all.length; i++) {
+ if (UpdateManagerUtils.isValidEnvironment(all[i]))
+ list.add((IPluginEntry)all[i]);
+ }
+ }
+
+ IPluginEntry[] result = new IPluginEntry[list.size()];
+ if (!list.isEmpty()){
+ list.toArray(result);
+ }
+
+ return result;
+ }
+
+
/**
* Returns the count of referenced plug-in entries.
*
@@ -447,7 +470,7 @@
* @since 2.0
*/
public int getPluginEntryCount() {
- return getPluginEntryModels().length;
+ return getPluginEntries().length;
}
/**
@@ -456,7 +479,7 @@
* @see IFeature#getNonPluginEntries()
* @since 2.0
*/
- public INonPluginEntry[] getNonPluginEntries() {
+ public INonPluginEntry[] getRawNonPluginEntries() {
NonPluginEntryModel[] result = getNonPluginEntryModels();
if (result.length == 0)
return new INonPluginEntry[0];
@@ -480,14 +503,14 @@
* @return an erray of feature references, or an empty array.
* @since 2.0
*/
- public IFeatureReference[] getIncludedFeatureReferences() throws CoreException {
+ public IIncludedFeatureReference[] getRawIncludedFeatureReferences() throws CoreException {
if (includedFeatureReferences == null)
initializeIncludedReferences();
if (includedFeatureReferences.size() == 0)
return new IncludedFeatureReference[0];
- return (IFeatureReference[]) includedFeatureReferences.toArray(arrayTypeFor(includedFeatureReferences));
+ return (IIncludedFeatureReference[]) includedFeatureReferences.toArray(arrayTypeFor(includedFeatureReferences));
}
/**
* Returns the download size of the feature, if it can be determined.
@@ -653,31 +676,53 @@
private void initializeIncludedReferences() throws CoreException {
includedFeatureReferences = new ArrayList();
- // key = versionedIdentifer, value = IncludeFeatureOptions
- Map nestedFeatures = getFeatureIncludeMap();
- if (nestedFeatures.isEmpty())
+ IIncludedFeatureReference[] nestedFeatures = getFeatureIncluded();
+ if (nestedFeatures.length==0)
return;
ISite site = getSite();
if (site == null)
return;
- Iterator nestedVersionedIdentifier = nestedFeatures.keySet().iterator();
- while (nestedVersionedIdentifier.hasNext()) {
- VersionedIdentifier identifier = (VersionedIdentifier) nestedVersionedIdentifier.next();
- IncludedFeatureReference options = (IncludedFeatureReference) nestedFeatures.get(identifier);
- IFeatureReference newRef = getPerfectIncludeFeature(site, identifier, options);
+ for (int i = 0; i < nestedFeatures.length; i++) {
+ IIncludedFeatureReference include = nestedFeatures[i];
+ IIncludedFeatureReference newRef = getPerfectIncludeFeature(site, include);
includedFeatureReferences.add(newRef);
}
}
+ /**
+ * Method filterFeatures.
+ * @param list
+ * @return List
+ */
+ private IIncludedFeatureReference[] filterFeatures(IIncludedFeatureReference[] allIncluded) {
+ List list = new ArrayList();
+ if (allIncluded!=null){
+ for (int i = 0; i < allIncluded.length; i++) {
+ IIncludedFeatureReference included = allIncluded[i];
+ if (included.matchesPlatform())
+ list.add(included);
+ }
+ }
+
+ IIncludedFeatureReference[] result = new IIncludedFeatureReference[list.size()];
+ if (!list.isEmpty()){
+ list.toArray(result);
+ }
+
+ return result;
+ }
+
+
/*
*
*/
- private IFeatureReference getPerfectIncludeFeature(ISite site, VersionedIdentifier identifier, IncludedFeatureReference options) throws CoreException {
+ private IIncludedFeatureReference getPerfectIncludeFeature(ISite site, IIncludedFeatureReference include) throws CoreException {
// [20367] no site, cannot initialize nested references
- IFeatureReference[] refs = site.getFeatureReferences();
+ ISiteFeatureReference[] refs = site.getFeatureReferences();
+ VersionedIdentifier identifier = include.getVersionedIdentifier();
// too long to compute if not a file system
// other solution would be to parse feature.xml
@@ -695,9 +740,12 @@
};
if (identifier.equals(id)) {
- // included featureReferences may also be a Map then
- FeatureReference newRef = new FeatureReference(refs[ref]);
- newRef.setOptions(options);
+ // found a ISiteFeatureReference that matches our IIncludedFeatureReference
+ IncludedFeatureReference newRef = new IncludedFeatureReference(refs[ref]);
+ newRef.isOptional(include.isOptional());
+ newRef.setName(include.getName());
+ newRef.setMatchingRule(include.getMatch());
+ newRef.setSearchLocation(include.getSearchLocation());
return newRef;
}
}
@@ -707,8 +755,7 @@
// instanciate by mapping it based on the site.xml
// in future we may ask for a factory to create the feature ref
- FeatureReference newRef = new FeatureReference();
- newRef.setOptions(options);
+ IncludedFeatureReference newRef = new IncludedFeatureReference(include);
newRef.setSite(getSite());
IFeatureReference parentRef = getSite().getFeatureReference(this);
if (parentRef instanceof FeatureReference) {
@@ -819,7 +866,7 @@
*/
private IFeatureReference featureAlreadyInstalled(ISite targetSite) {
- IFeatureReference[] references = targetSite.getFeatureReferences();
+ ISiteFeatureReference[] references = targetSite.getFeatureReferences();
IFeatureReference currentReference = null;
for (int i = 0; i < references.length; i++) {
currentReference = references[i];
@@ -869,4 +916,48 @@
UpdateManagerPlugin.warn("", e);
}
}
+ /**
+ * @see org.eclipse.update.core.IFeature#getRawIncludedFeatureReferences()
+ */
+ public IIncludedFeatureReference[] getIncludedFeatureReferences() throws CoreException {
+ return filterFeatures(getRawIncludedFeatureReferences());
+ }
+
+ /**
+ * @see org.eclipse.update.core.IFeature#getRawNonPluginEntries()
+ */
+ public INonPluginEntry[] getNonPluginEntries() {
+ return filterNonPluginEntry(getRawNonPluginEntries());
+ }
+
+ /**
+ * Method filterPluginEntry.
+ * @param iNonPluginEntrys
+ * @return INonPluginEntry[]
+ */
+ private INonPluginEntry[] filterNonPluginEntry(INonPluginEntry[] all) {
+ List list = new ArrayList();
+ if (all!=null){
+ for (int i = 0; i < all.length; i++) {
+ if (UpdateManagerUtils.isValidEnvironment(all[i]))
+ list.add((INonPluginEntry)all[i]);
+ }
+ }
+
+ INonPluginEntry[] result = new INonPluginEntry[list.size()];
+ if (!list.isEmpty()){
+ list.toArray(result);
+ }
+
+ return result;
+ }
+
+
+ /**
+ * @see org.eclipse.update.core.IFeature#getRawPluginEntries()
+ */
+ public IPluginEntry[] getPluginEntries() {
+ return filterPluginEntry(getRawPluginEntries());
+ }
+
}
\ No newline at end of file
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/core/FeatureReference.java b/update/org.eclipse.update.core/src/org/eclipse/update/core/FeatureReference.java
index 9fe1dcb..c5f1d47 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/core/FeatureReference.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/core/FeatureReference.java
@@ -6,11 +6,9 @@
import java.net.MalformedURLException;
import java.net.URL;
-import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.runtime.*;
-import org.eclipse.update.configuration.IConfiguredSite;
import org.eclipse.update.core.model.FeatureReferenceModel;
import org.eclipse.update.core.model.SiteModel;
import org.eclipse.update.internal.core.*;
@@ -26,10 +24,9 @@
*/
public class FeatureReference extends FeatureReferenceModel implements IFeatureReference {
- private IFeature feature; // best match
private List categories;
private VersionedIdentifier versionId;
-
+
/**
* Feature reference default constructor
*/
@@ -42,8 +39,7 @@
* @param ref the reference to copy
*/
public FeatureReference(IFeatureReference ref) {
- super((FeatureReferenceModel)ref);
- setSite(ref.getSite());
+ super((FeatureReferenceModel) ref);
try {
setURL(ref.getURL());
} catch (CoreException e) {
@@ -52,11 +48,29 @@
}
/**
+ * Constructor FeatureReference.
+ * @param ref the reference to copy
+ */
+ public FeatureReference(FeatureReferenceModel ref) {
+ super(ref);
+ try {
+ setURL(ref.getURL());
+ } catch (CoreException e) {
+ UpdateManagerPlugin.warn("", e);
+ }
+ }
+
+ /**
* Returns the feature this reference points to based on match and resolution
* @return the feature on the Site
*/
public IFeature getFeature() throws CoreException {
- return getFeature(false,null);
+ String type = getType();
+ if (type == null || type.equals("")) { //$NON-NLS-1$
+ // ask the Site for the default type
+ type = getSite().getDefaultPackagedFeatureType();
+ }
+ return getSite().createFeature(type, this.getURL());
}
/**
@@ -68,48 +82,7 @@
public ISite getSite() {
return (ISite) getSiteModel();
}
-
- /**
- * Returns an array of categories the referenced feature belong to.
- *
- * @see IFeatureReference#getCategories()
- * @since 2.0
- */
- public ICategory[] getCategories() {
-
- if (categories == null) {
- categories = new ArrayList();
- String[] categoriesAsString = getCategoryNames();
- for (int i = 0; i < categoriesAsString.length; i++) {
- ICategory siteCat = getSite().getCategory(categoriesAsString[i]);
- if (siteCat != null)
- categories.add(siteCat);
- else {
- String siteURL = getSite().getURL() != null ? getSite().getURL().toExternalForm() : null;
- UpdateManagerPlugin.warn("Category " + categoriesAsString[i] + " not found in Site:" + siteURL);
- }
- }
- }
-
- ICategory[] result = new ICategory[0];
-
- if (!(categories == null || categories.isEmpty())) {
- result = new ICategory[categories.size()];
- categories.toArray(result);
- }
- return result;
- }
-
- /**
- * Adds a category to the referenced feature.
- *
- * @see IFeatureReference#addCategory(ICategory)
- * @since 2.0
- */
- public void addCategory(ICategory category) {
- this.addCategoryName(category.getName());
- }
-
+
/**
* Sets the feature reference URL.
* This is typically performed as part of the feature reference creation
@@ -146,10 +119,9 @@
* Returns the feature identifier.
*
* @see IFeatureReference#getVersionedIdentifier()
- * @exception CoreException
* @since 2.0
*/
- public VersionedIdentifier getVersionedIdentifier() throws CoreException {
+ public VersionedIdentifier getVersionedIdentifier() {
if (versionId != null)
return versionId;
@@ -166,175 +138,14 @@
}
// we need the exact match or we may have an infinite loop
- return getFeature(true,null).getVersionedIdentifier();
- }
- /**
- * @see org.eclipse.update.core.IFeatureReference#getName()
- */
- public String getName() {
- if (getOptions() == null) {
- try {
- return getFeature().toString();
- } catch (CoreException e) {
- UpdateManagerPlugin.warn("", e);
- }
+ versionId = new VersionedIdentifier(getURL().toExternalForm(),null);
+ try {
+ versionId = getFeature().getVersionedIdentifier();
+ } catch (CoreException e){
+ UpdateManagerPlugin.warn("",e);
}
- return getOptions().getName();
+ return versionId;
}
-
- /**
- * @see org.eclipse.update.core.IFeatureReference#isOptional()
- */
- public boolean isOptional() {
- if (getOptions() == null)
- return false;
- return getOptions().isOptional();
- }
-
- /**
- * @see org.eclipse.update.core.IFeatureReference#getMatch()
- */
- public int getMatch() {
- if (getOptions() == null)
- return IImport.RULE_PERFECT;
- return getOptions().getMatch();
- }
-
- /**
- * @see org.eclipse.update.core.IFeatureReference#getSearchLocation()
- */
- public int getSearchLocation() {
- if (getOptions() == null)
- return IUpdateConstants.SEARCH_ROOT;
- return getOptions().getSearchLocation();
- }
-
- /*
- * Method getBestMatch.
- * @param enabledFeatures
- * @param identifier
- * @param options
- * @return Object
- */
- private IFeatureReference getBestMatch(IConfiguredSite configuredSite) throws CoreException {
- FeatureReference newRef = null;
-
- if (configuredSite==null) return this;
- IFeatureReference[] enabledFeatures = configuredSite.getConfiguredFeatures();
-
- // find the best feature based on match from enabled features
- for (int ref = 0; ref < enabledFeatures.length; ref++) {
- if (enabledFeatures[ref] != null) {
- VersionedIdentifier id = null;
- try {
- id = enabledFeatures[ref].getVersionedIdentifier();
- } catch (CoreException e) {
- UpdateManagerPlugin.warn(null, e);
- };
- if (matches(getVersionedIdentifier(), id, getOptions())) {
- if (newRef == null || id.getVersion().isGreaterThan(newRef.getVersionedIdentifier().getVersion())) {
- newRef = new FeatureReference(enabledFeatures[ref]);
- newRef.setOptions(getOptions());
- }
- }
- }
- }
-
- if (newRef != null)
- return newRef;
- else
- return this;
- }
-
- /**
- * Method isDisabled.
- * @return boolean
- */
- private boolean isDisabled() {
- /*IConfiguredSite cSite = getSite().getConfiguredSite();
- if (cSite==null) return false;
- IFeatureReference[] configured = cSite.getConfiguredFeatures();
- for (int i = 0; i < configured.length; i++) {
- if (this.equals(configured[i])) return false;
- }
- return true;*/
- // FIXME
- return false;
- }
-
- /**
- * Method matches.
- * @param identifier
- * @param id
- * @param options
- * @return boolean
- */
- private boolean matches(VersionedIdentifier baseIdentifier, VersionedIdentifier id, IncludedFeatureReference options) {
- if (baseIdentifier == null || id == null)
- return false;
- if (!id.getIdentifier().equals(baseIdentifier.getIdentifier()))
- return false;
- int match = IImport.RULE_PERFECT;
- if (options != null) {
- match = options.getMatch();
- }
-
- switch (match) {
- case IImport.RULE_PERFECT :
- return id.getVersion().isPerfect(baseIdentifier.getVersion());
- case IImport.RULE_COMPATIBLE :
- return id.getVersion().isCompatibleWith(baseIdentifier.getVersion());
- case IImport.RULE_EQUIVALENT :
- return id.getVersion().isEquivalentTo(baseIdentifier.getVersion());
- case IImport.RULE_GREATER_OR_EQUAL :
- return id.getVersion().isGreaterOrEqualTo(baseIdentifier.getVersion());
- }
- UpdateManagerPlugin.warn("Unknown matching rule:" + match);
- return false;
- }
-
- /**
- * Method retrieveEnabledFeatures.
- * @param site
- */
- private IFeatureReference[] retrieveEnabledFeatures(ISite site) {
- IConfiguredSite configuredSite = site.getCurrentConfiguredSite();
- if (configuredSite == null)
- return new IFeatureReference[0];
- return configuredSite.getConfiguredFeatures();
- }
- /**
- * @see org.eclipse.update.core.IFeatureReference#getFeature(boolean)
- */
- public IFeature getFeature(boolean perfectMatch,IConfiguredSite configuredSite) throws CoreException {
-
- if (configuredSite==null)
- configuredSite = getSite().getCurrentConfiguredSite();
-
- // if perfect match is asked or if the feature is disabled
- // we return the exact match
- if (perfectMatch || getMatch() == IImport.RULE_PERFECT || isDisabled()) {
- return getFeature(this);
- } else {
- if (feature == null) {
- // find best match
- IFeatureReference bestMatch = getBestMatch(configuredSite);
- feature = getFeature(bestMatch);
- }
- return feature;
- }
- }
-
- /*
- *
- */
- private IFeature getFeature(IFeatureReference ref) throws CoreException {
- String type = getType();
- if (type == null || type.equals("")) { //$NON-NLS-1$
- // ask the Site for the default type
- type = getSite().getDefaultPackagedFeatureType();
- }
- return getSite().createFeature(type, ref.getURL());
- }
-
+
+
}
\ No newline at end of file
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/core/IFeature.java b/update/org.eclipse.update.core/src/org/eclipse/update/core/IFeature.java
index fdab14d..3007e84 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/core/IFeature.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/core/IFeature.java
@@ -29,7 +29,7 @@
* @see org.eclipse.update.core.Feature
* @since 2.0
*/
-public interface IFeature extends IAdaptable {
+public interface IFeature extends IAdaptable, IPlatformEnvironment {
/**
* Indicates a 'happy' feature
@@ -195,70 +195,6 @@
public IURLEntry getLicense();
/**
- * Returns optional operating system specification.
- * A comma-separated list of os designators defined by the platform.
- * Indicates this feature should only be installed on one of the specified
- * os systems. If this attribute is not specified, the feature can be
- * installed on all systems (portable implementation).
- *
- * This information is used as a hint by the installation and update
- * support (user can force installation of feature regardless of this setting).
- *
- * @see org.eclipse.core.boot.BootLoader
- * @return the operating system specification, or <code>null</code>.
- * @since 2.0
- */
- public String getOS();
-
- /**
- * Returns optional windowing system specification.
- * A comma-separated list of ws designators defined by the platform.
- * Indicates this feature should only be installed on one of the specified
- * ws systems. If this attribute is not specified, the feature can be
- * installed on all systems (portable implementation).
- *
- * This information is used as a hint by the installation and update
- * support (user can force installation of feature regardless of this setting).
- *
- * @see org.eclipse.core.boot.BootLoader
- * @return the windowing system specification, or <code>null</code>.
- * @since 2.0
- */
- public String getWS();
-
- /**
- * Returns optional system architecture specification.
- * A comma-separated list of arch designators defined by the platform.
- * Indicates this feature should only be installed on one of the specified
- * systems. If this attribute is not specified, the feature can be
- * installed on all systems (portable implementation).
- *
- * This information is used as a hint by the installation and update
- * support (user can force installation of feature regardless of this setting).
- *
- * @see org.eclipse.core.boot.BootLoader
- * @return system architecture specification, or <code>null</code>.
- * @since 2.0
- */
- public String getArch();
-
- /**
- * Returns optional locale specification.
- * A comma-separated list of locale designators defined by Java.
- * Indicates this feature should only be installed on a system running
- * with a compatible locale (using Java locale-matching rules).
- * If this attribute is not specified, the feature can be installed
- * on all systems (language-neutral implementation).
- *
- * This information is used as a hint by the installation and update
- * support (user can force installation of feature regardless of this setting).
- *
- * @return the locale specification, or <code>null</code>.
- * @since 2.0
- */
- public String getNL();
-
- /**
* Return optional image for the feature.
*
* @return the URL pointing to the image, , or <code>null</code>.
@@ -314,14 +250,27 @@
/**
* Returns an array of feature references included by this feature
+ * filtered by the operating system, windowing system and architecture system
+ * set in <code>Sitemanager</code>
*
* @return an erray of feature references, or an empty array.
* @since 2.0
*/
- public IFeatureReference[] getIncludedFeatureReferences() throws CoreException;
+ public IIncludedFeatureReference[] getIncludedFeatureReferences() throws CoreException;
+
+ /**
+ * Returns an array of feature references included by this feature
+ * No filtering occurs
+ *
+ * @return an erray of feature references, or an empty array.
+ * @since 2.0
+ */
+ public IIncludedFeatureReference[] getRawIncludedFeatureReferences() throws CoreException;
/**
* Returns an array of plug-in entries referenced by this feature
+ * filtered by the operating system, windowing system and architecture system
+ * set in <code>Sitemanager</code>
*
* @return an erray of plug-in entries, or an empty array.
* @since 2.0
@@ -329,6 +278,15 @@
public IPluginEntry[] getPluginEntries();
/**
+ * Returns an array of plug-in entries referenced by this feature
+ * No filtering occurs
+ *
+ * @return an erray of plug-in entries, or an empty array.
+ * @since 2.0
+ */
+ public IPluginEntry[] getRawPluginEntries();
+
+ /**
* Returns the count of referenced plug-in entries.
*
* @return plug-in entry count
@@ -338,6 +296,8 @@
/**
* Returns an array of non-plug-in entries referenced by this feature
+ * filtered by the operating system, windowing system and architecture system
+ * set in <code>Sitemanager</code>
*
* @return an erray of non-plug-in entries, or an empty array.
* @since 2.0
@@ -345,6 +305,15 @@
public INonPluginEntry[] getNonPluginEntries();
/**
+ * Returns an array of non-plug-in entries referenced by this feature
+ * No filtering occurs
+ *
+ * @return an erray of non-plug-in entries, or an empty array.
+ * @since 2.0
+ */
+ public INonPluginEntry[] getRawNonPluginEntries();
+
+ /**
* Returns the count of referenced non-plug-in entries.
*
* @return non-plug-in entry count
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/core/IFeatureReference.java b/update/org.eclipse.update.core/src/org/eclipse/update/core/IFeatureReference.java
index 0375b57..305e688 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/core/IFeatureReference.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/core/IFeatureReference.java
@@ -8,10 +8,10 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.update.configuration.IConfiguredSite;
+
/**
* Feature reference.
- * A reference to a feature on a particular update site.
+ * A reference to a feature.
* <p>
* Clients may implement this interface. However, in most cases clients should
* directly instantiate or subclass the provided implementation of this
@@ -39,14 +39,6 @@
public ISite getSite();
/**
- * Returns an array of categories the referenced feature belong to.
- *
- * @return an array of categories, or an empty array
- * @since 2.0
- */
- public ICategory[] getCategories();
-
- /**
* Returns the referenced feature.
* This is a factory method that creates the full feature object.
*
@@ -56,23 +48,6 @@
public IFeature getFeature() throws CoreException;
/**
- * Returns the referenced feature.
- * This is a factory method that creates the full feature object.
- *
- * @param perfectMatch <code>true</code> if the perfect match feature feature should be returned
- * <code>false</code> if the best match feature should be returned.
- * @param configuredSite the configured site to search for the Feature. If
- * the configured site is <code>null</code> the search will be done in the current configured site.
- * @return the referenced feature
- * @since 2.0.2
- * <b>Note:</b> This method is part of an interim API that is still under development and expected to
- * change significantly before reaching stability. It is being made available at this early stage to solicit feedback
- * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
- * (repeatedly) as the API evolves.
- */
- public IFeature getFeature(boolean perfectMatch,IConfiguredSite configuredSite) throws CoreException;
-
- /**
* Returns the feature identifier.
*
* @return the feature identifier.
@@ -82,14 +57,6 @@
public VersionedIdentifier getVersionedIdentifier() throws CoreException;
/**
- * Adds a category to the referenced feature.
- *
- * @param category new category
- * @since 2.0
- */
- public void addCategory(ICategory category);
-
- /**
* Sets the feature reference URL.
* This is typically performed as part of the feature reference creation
* operation. Once set, the url should not be reset.
@@ -109,50 +76,4 @@
*/
public void setSite(ISite site);
- /**
- * Returns <code>true</code> if the feature is optional, <code>false</code> otherwise.
- *
- * @return boolean
- * @since 2.0.1
- */
- public boolean isOptional();
-
- /**
- * Returns the name of the feature reference.
- *
- * @return feature reference name
- * @since 2.0.1
- */
- public String getName();
-
-
- /**
- * Returns the matching rule for this included feature.
- * The rule will determine the ability of the included feature to move version
- * without causing the overall feature to appear broken.
- *
- * The default is <code>RULE_PERFECT</code>
- *
- * @see IUpdateConstants#RULE_PERFECT
- * @see IUpdateConstants#RULE_EQUIVALENT
- * @see IUpdateConstants#RULE_COMPATIBLE
- * @see IUpdateConstants#RULE_GREATER_OR_EQUAL
- * @return int representation of feature matching rule.
- * @since 2.0.2
- */
- public int getMatch();
-
- /**
- * Returns the search location for this included feature.
- * The location will be used to search updates for this feature.
- *
- * The default is <code>SEARCH_ROOT</code>
- *
- * @see IFeatureReference#SEARCH_ROOT
- * @see IFeatureReference#SEARCH_SELF
- * @return int representation of feature searching rule.
- * @since 2.0.2
- */
-
- public int getSearchLocation();
}
\ No newline at end of file
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/core/IIncludedFeatureReference.java b/update/org.eclipse.update.core/src/org/eclipse/update/core/IIncludedFeatureReference.java
index e998dda..27d2eaa 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/core/IIncludedFeatureReference.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/core/IIncludedFeatureReference.java
@@ -1,4 +1,9 @@
package org.eclipse.update.core;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.update.configuration.IConfiguredSite;
+
/*
* (c) Copyright IBM Corp. 2000, 2002.
* All Rights Reserved.
@@ -7,7 +12,7 @@
/**
* Included Feature reference.
- * A reference to a included feature on a particular update site.
+ * A reference to a included feature.
* <p>
* Clients may implement this interface. However, in most cases clients should
* directly instantiate or subclass the provided implementation of this
@@ -16,7 +21,34 @@
* @see org.eclipse.update.core.FeatureReference
* @since 2.0.1
*/
-public interface IIncludedFeatureReference extends IFeatureReference {
+public interface IIncludedFeatureReference extends IFeatureReference, IPlatformEnvironment, IAdaptable {
+
+ /**
+ * Returns the referenced feature.
+ * This is a factory method that creates the full feature object.
+ * equivalent to getFeature(false,null);
+ *
+ * @return the referenced feature
+ * @since 2.0
+ */
+ public IFeature getFeature() throws CoreException;
+
+ /**
+ * Returns the referenced feature.
+ * This is a factory method that creates the full feature object.
+ *
+ * @param perfectMatch <code>true</code> if the perfect match feature feature should be returned
+ * <code>false</code> if the best match feature should be returned.
+ * @param configuredSite the configured site to search for the Feature. If
+ * the configured site is <code>null</code> the search will be done in the current configured site.
+ * @return the referenced feature
+ * @since 2.0.2
+ * <b>Note:</b> This method is part of an interim API that is still under development and expected to
+ * change significantly before reaching stability. It is being made available at this early stage to solicit feedback
+ * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
+ * (repeatedly) as the API evolves.
+ */
+ public IFeature getFeature(boolean perfectMatch,IConfiguredSite configuredSite) throws CoreException;
/**
* Returns <code>true</code> if the feature is optional, <code>false</code> otherwise.
@@ -64,4 +96,16 @@
public int getSearchLocation();
+
+ /**
+ * Returns <code>true</code> if the feature references can be run on the platform specified by the
+ * <code>Sitemanager</code>.
+ * returns <code>false</code> if either the operating system, the windowing system or the architecture system
+ * is not <code>null</code> and does not match the one specified in <code>SiteManager</code>
+ *
+ * @return <code>true</code> if the included feature operating system, windowing system and srchitecture system
+ * match the one specified in <code>SiteManager</code>
+ */
+ public boolean matchesPlatform();
+
}
\ No newline at end of file
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/core/INonPluginEntry.java b/update/org.eclipse.update.core/src/org/eclipse/update/core/INonPluginEntry.java
index 712bf39..ab025e0 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/core/INonPluginEntry.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/core/INonPluginEntry.java
@@ -24,7 +24,7 @@
* @see org.eclipse.update.core.FeatureContentProvider
* @since 2.0
*/
-public interface INonPluginEntry extends IAdaptable {
+public interface INonPluginEntry extends IPlatformEnvironment, IAdaptable {
/**
* Returns the identifier of this data entry.
@@ -53,69 +53,4 @@
* @since 2.0
*/
public long getInstallSize();
-
- /**
- * Returns optional operating system specification.
- * A comma-separated list of os designators defined by the platform.
- * Indicates this entry should only be installed on one of the specified
- * os systems. If this attribute is not specified, the entry can be
- * installed on all systems (portable implementation).
- *
- * This information is used as a hint by the installation and update
- * support.
- *
- * @see org.eclipse.core.boot.BootLoader
- * @return the operating system specification, or <code>null</code>.
- * @since 2.0
- */
- public String getOS();
-
- /**
- * Returns optional system architecture specification.
- * A comma-separated list of arch designators defined by the platform.
- * Indicates this entry should only be installed on one of the specified
- * systems. If this attribute is not specified, the entry can be
- * installed on all systems (portable implementation).
- *
- * This information is used as a hint by the installation and update
- * support.
- *
- * @see org.eclipse.core.boot.BootLoader
- * @return system architecture specification, or <code>null</code>.
- * @since 2.0
- */
- public String getWS();
-
- /**
- * Returns optional system architecture specification.
- * A comma-separated list of arch designators defined by the platform.
- * Indicates this entry should only be installed on one of the specified
- * systems. If this attribute is not specified, the entry can be
- * installed on all systems (portable implementation).
- *
- * This information is used as a hint by the installation and update
- * support.
- *
- * @see org.eclipse.core.boot.BootLoader
- * @return system architecture specification, or <code>null</code>.
- * @since 2.0
- */
- public String getArch();
-
- /**
- * Returns optional locale specification.
- * A comma-separated list of locale designators defined by Java.
- * Indicates this entry should only be installed on a system running
- * with a compatible locale (using Java locale-matching rules).
- * If this attribute is not specified, the entry can be installed
- * on all systems (language-neutral implementation).
- *
- * This information is used as a hint by the installation and update
- * support.
- *
- * @return the locale specification, or <code>null</code>.
- * @since 2.0
- */
- public String getNL();
-
}
\ No newline at end of file
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/core/IPlatformEnvironment.java b/update/org.eclipse.update.core/src/org/eclipse/update/core/IPlatformEnvironment.java
new file mode 100644
index 0000000..c59212c
--- /dev/null
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/core/IPlatformEnvironment.java
@@ -0,0 +1,93 @@
+package org.eclipse.update.core;
+/*
+ * (c) Copyright IBM Corp. 2000, 2002.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.runtime.IAdaptable;
+
+/**
+ * Plug-in entry defines a packaging reference from a feature to a plug-in.
+ * It indicates that the referenced plug-in is to be considered as
+ * part of the feature. Note, that this does not necessarily indicate
+ * that the plug-in files are packaged together with any other
+ * feature files. The actual packaging details are determined by the
+ * feature content provider for the feature.
+ * <p>
+ * Clients may implement this interface. However, in most cases clients should
+ * directly instantiate or subclass the provided implementation of this
+ * interface.
+ * </p>
+ * @see org.eclipse.update.core.PluginEntry
+ * @see org.eclipse.update.core.FeatureContentProvider
+ * @since 2.0
+ */
+public interface IPlatformEnvironment extends IAdaptable {
+
+
+ /**
+ * Returns optional operating system specification.
+ * A comma-separated list of os designators defined by the platform.
+ * Indicates this entry should only be installed on one of the specified
+ * os systems. If this attribute is not specified, the entry can be
+ * installed on all systems (portable implementation).
+ *
+ * This information is used as a hint by the installation and update
+ * support.
+ *
+ * @see org.eclipse.core.boot.BootLoader
+ * @return the operating system specification, or <code>null</code>.
+ * @since 2.0
+ */
+ public String getOS();
+
+ /**
+ * Returns optional system architecture specification.
+ * A comma-separated list of arch designators defined by the platform.
+ * Indicates this entry should only be installed on one of the specified
+ * systems. If this attribute is not specified, the entry can be
+ * installed on all systems (portable implementation).
+ *
+ * This information is used as a hint by the installation and update
+ * support.
+ *
+ * @see org.eclipse.core.boot.BootLoader
+ * @return system architecture specification, or <code>null</code>.
+ * @since 2.0
+ */
+ public String getWS();
+
+ /**
+ * Returns optional system architecture specification.
+ * A comma-separated list of arch designators defined by the platform.
+ * Indicates this entry should only be installed on one of the specified
+ * systems. If this attribute is not specified, the entry can be
+ * installed on all systems (portable implementation).
+ *
+ * This information is used as a hint by the installation and update
+ * support.
+ *
+ * @see org.eclipse.core.boot.BootLoader
+ * @return system architecture specification, or <code>null</code>.
+ * @since 2.0
+ */
+ public String getOSArch();
+
+ /**
+ * Returns optional locale specification.
+ * A comma-separated list of locale designators defined by Java.
+ * Indicates this entry should only be installed on a system running
+ * with a compatible locale (using Java locale-matching rules).
+ * If this attribute is not specified, the entry can be installed
+ * on all systems (language-neutral implementation).
+ *
+ * This information is used as a hint by the installation and update
+ * support.
+ *
+ * @return the locale specification, or <code>null</code>.
+ * @since 2.0
+ */
+ public String getNL();
+
+
+}
\ No newline at end of file
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/core/IPluginEntry.java b/update/org.eclipse.update.core/src/org/eclipse/update/core/IPluginEntry.java
index 113b356..8c24582 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/core/IPluginEntry.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/core/IPluginEntry.java
@@ -22,7 +22,7 @@
* @see org.eclipse.update.core.FeatureContentProvider
* @since 2.0
*/
-public interface IPluginEntry extends IAdaptable {
+public interface IPluginEntry extends IPlatformEnvironment,IAdaptable {
/**
* Returns the identifier of this plugin entry
@@ -61,70 +61,6 @@
*/
public long getInstallSize();
- /**
- * Returns optional operating system specification.
- * A comma-separated list of os designators defined by the platform.
- * Indicates this entry should only be installed on one of the specified
- * os systems. If this attribute is not specified, the entry can be
- * installed on all systems (portable implementation).
- *
- * This information is used as a hint by the installation and update
- * support.
- *
- * @see org.eclipse.core.boot.BootLoader
- * @return the operating system specification, or <code>null</code>.
- * @since 2.0
- */
- public String getOS();
-
- /**
- * Returns optional system architecture specification.
- * A comma-separated list of arch designators defined by the platform.
- * Indicates this entry should only be installed on one of the specified
- * systems. If this attribute is not specified, the entry can be
- * installed on all systems (portable implementation).
- *
- * This information is used as a hint by the installation and update
- * support.
- *
- * @see org.eclipse.core.boot.BootLoader
- * @return system architecture specification, or <code>null</code>.
- * @since 2.0
- */
- public String getWS();
-
- /**
- * Returns optional system architecture specification.
- * A comma-separated list of arch designators defined by the platform.
- * Indicates this entry should only be installed on one of the specified
- * systems. If this attribute is not specified, the entry can be
- * installed on all systems (portable implementation).
- *
- * This information is used as a hint by the installation and update
- * support.
- *
- * @see org.eclipse.core.boot.BootLoader
- * @return system architecture specification, or <code>null</code>.
- * @since 2.0
- */
- public String getArch();
-
- /**
- * Returns optional locale specification.
- * A comma-separated list of locale designators defined by Java.
- * Indicates this entry should only be installed on a system running
- * with a compatible locale (using Java locale-matching rules).
- * If this attribute is not specified, the entry can be installed
- * on all systems (language-neutral implementation).
- *
- * This information is used as a hint by the installation and update
- * support.
- *
- * @return the locale specification, or <code>null</code>.
- * @since 2.0
- */
- public String getNL();
-
/**
* Sets the identifier of this plugin entry.
* This is typically performed as part of the plug-in entry creation
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/core/ISite.java b/update/org.eclipse.update.core/src/org/eclipse/update/core/ISite.java
index 8681f21..3fc7c25 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/core/ISite.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/core/ISite.java
@@ -102,7 +102,7 @@
* @return an array of feature references, or an empty array.
* @since 2.0
*/
- public IFeatureReference[] getFeatureReferences();
+ public ISiteFeatureReference[] getFeatureReferences();
/**
* Returns a reference to the specified feature if
@@ -111,8 +111,9 @@
* @param feature feature
* @return feature reference, or <code>null</code> if this feature
* cannot be located on this site.
+ * @since 2.0
*/
- public IFeatureReference getFeatureReference(IFeature feature);
+ public ISiteFeatureReference getFeatureReference(IFeature feature);
/**
* Returns an array of plug-in and non-plug-in archives located
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/core/ISiteFeatureReference.java b/update/org.eclipse.update.core/src/org/eclipse/update/core/ISiteFeatureReference.java
new file mode 100644
index 0000000..0bbd4b7
--- /dev/null
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/core/ISiteFeatureReference.java
@@ -0,0 +1,38 @@
+package org.eclipse.update.core;
+/*
+ * (c) Copyright IBM Corp. 2000, 2002.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.runtime.IAdaptable;
+
+/**
+ * Site Feature reference.
+ * A reference to a feature on a particular update site.
+ * <p>
+ * Clients may implement this interface. However, in most cases clients should
+ * directly instantiate or subclass the provided implementation of this
+ * interface.
+ * </p>
+ * @see org.eclipse.update.core.FeatureReference
+ * @since 2.0
+ */
+public interface ISiteFeatureReference extends IFeatureReference, IAdaptable {
+
+ /**
+ * Returns an array of categories the referenced feature belong to.
+ *
+ * @return an array of categories, or an empty array
+ * @since 2.0
+ */
+ public ICategory[] getCategories();
+
+ /**
+ * Adds a category to the referenced feature.
+ *
+ * @param category new category
+ * @since 2.0
+ */
+ public void addCategory(ICategory category);
+
+}
\ No newline at end of file
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/core/IncludedFeatureReference.java b/update/org.eclipse.update.core/src/org/eclipse/update/core/IncludedFeatureReference.java
index 9c4ae71..b4ad893 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/core/IncludedFeatureReference.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/core/IncludedFeatureReference.java
@@ -1,4 +1,10 @@
package org.eclipse.update.core;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.update.configuration.IConfiguredSite;
+import org.eclipse.update.core.model.IncludedFeatureReferenceModel;
+import org.eclipse.update.internal.core.UpdateManagerPlugin;
+
/*
* (c) Copyright IBM Corp. 2000, 2002.
* All Rights Reserved.
@@ -13,29 +19,17 @@
* @see org.eclipse.update.core.VersionedIdentifier
* @since 2.0.1
*/
-public class IncludedFeatureReference extends FeatureReference implements IIncludedFeatureReference {
- private boolean isOptional;
- private String name;
+public class IncludedFeatureReference extends IncludedFeatureReferenceModel implements IIncludedFeatureReference {
- // since 2.0.2
- private int matchingRule;
- private int searchLocation;
+ private IFeature feature;
/**
- * Construct a feature options from a string and a boolean
- * The string is the representation of the name.
- * The boolean is the representation of the optionality of the nested feature.
+ * Construct a included feature reference
*
- * @param name string representation of the feature
- * @param isOptional <code>true</code> if the feature is optional, <code>false</code> otherwise.
- * @deprecated use other constructor
- * @since 2.0.1
+ * @since 2.1
*/
- public IncludedFeatureReference(String name, boolean isOptional) {
- this.isOptional = isOptional;
- this.name = name;
- this.matchingRule = IImport.RULE_PERFECT;
- this.searchLocation=IUpdateConstants.SEARCH_ROOT;
+ public IncludedFeatureReference() {
+ super();
}
@@ -48,64 +42,164 @@
* @param searchLocation the location to search for this feature's updates.
* @since 2.0.2
*/
- public IncludedFeatureReference(String name, boolean isOptional, int matchingRule, int searchLocation) {
- this.isOptional = isOptional;
- this.name = name;
- this.matchingRule = matchingRule;
- this.searchLocation=searchLocation;
+ public IncludedFeatureReference(IIncludedFeatureReference includedFeatureRef) {
+ super((IncludedFeatureReferenceModel)includedFeatureRef);
}
/**
- * Returns the isOptional
- *
- * @return isOptional
- * @since 2.0.1
+ * Constructor IncludedFeatureReference.
+ * @param iFeatureReference
*/
- public boolean isOptional() {
- return isOptional;
+ public IncludedFeatureReference(IFeatureReference featureReference) {
+ super(featureReference);
}
- /**
- * Returns a string representation of the feature identifier.
- *
- * @return string representation of feature identifier or <code>null</code>.
- * @since 2.0.1
- */
- public String getName() {
- return name;
- }
/**
- * Returns the matching rule for this included feature.
- * The rule will determine the ability of the included feature to move version
- * without causing the overall feature to appear broken.
- *
- * The default is <code>MATCH_PERFECT</code>
- *
- * @see IImport#RULE_PERFECT
- * @see IImport#RULE_EQUIVALENT
- * @see IImport#RULE_COMPATIBLE
- * @see IImport#RULE_GREATER_OR_EQUAL
- * @return int representation of feature matching rule.
- * @since 2.0.2
+ * Method matches.
+ * @param identifier
+ * @param id
+ * @param options
+ * @return boolean
+ */
+ private boolean matches(VersionedIdentifier baseIdentifier, VersionedIdentifier id) {
+ if (baseIdentifier == null || id == null)
+ return false;
+ if (!id.getIdentifier().equals(baseIdentifier.getIdentifier()))
+ return false;
+
+ switch (getMatch()) {
+ case IImport.RULE_PERFECT :
+ return id.getVersion().isPerfect(baseIdentifier.getVersion());
+ case IImport.RULE_COMPATIBLE :
+ return id.getVersion().isCompatibleWith(baseIdentifier.getVersion());
+ case IImport.RULE_EQUIVALENT :
+ return id.getVersion().isEquivalentTo(baseIdentifier.getVersion());
+ case IImport.RULE_GREATER_OR_EQUAL :
+ return id.getVersion().isGreaterOrEqualTo(baseIdentifier.getVersion());
+ }
+ UpdateManagerPlugin.warn("Unknown matching rule:" + getMatch());
+ return false;
+ }
+
+
+ /*
+ * Method retrieveEnabledFeatures.
+ * @param site
*/
- public int getMatch(){
- return matchingRule;
+ private IFeatureReference[] retrieveEnabledFeatures(ISite site) {
+ IConfiguredSite configuredSite = site.getCurrentConfiguredSite();
+ if (configuredSite == null)
+ return new IFeatureReference[0];
+ return configuredSite.getConfiguredFeatures();
+ }
+
+ /*
+ * Method isDisabled.
+ * @return boolean
+ */
+ private boolean isDisabled() {
+ /*IConfiguredSite cSite = getSite().getConfiguredSite();
+ if (cSite==null) return false;
+ IFeatureReference[] configured = cSite.getConfiguredFeatures();
+ for (int i = 0; i < configured.length; i++) {
+ if (this.equals(configured[i])) return false;
+ }
+ return true;*/
+ // FIXME
+ return false;
}
/**
- * Returns the search location for this included feature.
- * The location will be used to search updates for this feature.
- *
- * The default is <code>SEARCH_ROOT</code>
- *
- * @see IFeatureReference#SEARCH_ROOT
- * @see IFeatureReference#SEARCH_SELF
- * @return int representation of feature searching rule.
- * @since 2.0.2
+ * @see org.eclipse.update.core.IFeatureReference#getFeature(boolean)
*/
+ public IFeature getFeature(boolean perfectMatch,IConfiguredSite configuredSite) throws CoreException {
- public int getSearchLocation(){
- return searchLocation;
+ if (configuredSite==null)
+ configuredSite = getSite().getCurrentConfiguredSite();
+
+ // if perfect match is asked or if the feature is disabled
+ // we return the exact match
+ if (perfectMatch || getMatch() == IImport.RULE_PERFECT || isDisabled()) {
+ return getFeature(this);
+ } else {
+ if (feature == null) {
+ // find best match
+ IFeatureReference bestMatch = getBestMatch(configuredSite);
+ feature = getFeature(bestMatch);
+ }
+ return feature;
+ }
}
+
+ /*
+ *
+ */
+ private IFeature getFeature(IFeatureReference ref) throws CoreException {
+ String type = getType();
+ if (type == null || type.equals("")) { //$NON-NLS-1$
+ // ask the Site for the default type
+ type = getSite().getDefaultPackagedFeatureType();
+ }
+ return getSite().createFeature(type, ref.getURL());
+ }
+
+ /*
+ * Method getBestMatch.
+ * @param enabledFeatures
+ * @param identifier
+ * @param options
+ * @return Object
+ */
+ private IIncludedFeatureReference getBestMatch(IConfiguredSite configuredSite) throws CoreException {
+ IncludedFeatureReference newRef = null;
+
+ if (configuredSite==null) return this;
+ IFeatureReference[] enabledFeatures = configuredSite.getConfiguredFeatures();
+
+ // find the best feature based on match from enabled features
+ for (int ref = 0; ref < enabledFeatures.length; ref++) {
+ if (enabledFeatures[ref] != null) {
+ VersionedIdentifier id = null;
+ try {
+ id = enabledFeatures[ref].getVersionedIdentifier();
+ } catch (CoreException e) {
+ UpdateManagerPlugin.warn(null, e);
+ };
+ if (matches(getVersionedIdentifier(), id)) {
+ if (newRef == null || id.getVersion().isGreaterThan(newRef.getVersionedIdentifier().getVersion())) {
+ newRef = new IncludedFeatureReference(enabledFeatures[ref]);
+ newRef.setMatchingRule(getMatch());
+ newRef.isOptional(isOptional());
+ newRef.setName(getName());
+ }
+ }
+ }
+ }
+
+ if (newRef != null)
+ return newRef;
+ else
+ return this;
+ }
+ /**
+ * @see org.eclipse.update.core.IFeatureReference#getFeature()
+ */
+ public IFeature getFeature() throws CoreException {
+ return getFeature(false,null);
+ }
+
+ /**
+ * @see org.eclipse.update.core.IIncludedFeatureReference#matchesPlatform()
+ */
+ public boolean matchesPlatform() {
+ if (getWS()!=null && !SiteManager.getWS().equalsIgnoreCase(getWS()))
+ return false;
+ if (getOS() != null && !SiteManager.getOS().equalsIgnoreCase(getOS()))
+ return false;
+ if (getOSArch()!= null && !SiteManager.getOSArch().equalsIgnoreCase(getOSArch()))
+ return false;
+ return true;
+ }
+
}
\ No newline at end of file
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/core/Site.java b/update/org.eclipse.update.core/src/org/eclipse/update/core/Site.java
index 11b361f..59a8c9e 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/core/Site.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/core/Site.java
@@ -168,12 +168,12 @@
* @see ISite#getFeatureReferences()
* @since 2.0
*/
- public IFeatureReference[] getFeatureReferences() {
+ public ISiteFeatureReference[] getFeatureReferences() {
FeatureReferenceModel[] result = getFeatureReferenceModels();
if (result.length == 0)
- return new IFeatureReference[0];
+ return new ISiteFeatureReference[0];
else
- return (IFeatureReference[]) result;
+ return (ISiteFeatureReference[]) result;
}
/**
@@ -182,15 +182,15 @@
* @see ISite#getFeatureReference(IFeature)
* @since 2.0
*/
- public IFeatureReference getFeatureReference(IFeature feature) {
+ public ISiteFeatureReference getFeatureReference(IFeature feature) {
if (feature == null) {
UpdateManagerPlugin.warn("Site:getFeatureReference: The feature is null");
return null;
}
- IFeatureReference[] references = getFeatureReferences();
- IFeatureReference currentReference = null;
+ ISiteFeatureReference[] references = getFeatureReferences();
+ ISiteFeatureReference currentReference = null;
for (int i = 0; i < references.length; i++) {
currentReference = references[i];
if (UpdateManagerUtils.sameURL(feature.getURL(), currentReference.getURL()))
@@ -280,7 +280,7 @@
if (entries != null) {
// get all the other plugins from all the other features
Set allPluginID = new HashSet();
- IFeatureReference[] features = getFeatureReferences();
+ ISiteFeatureReference[] features = getFeatureReferences();
if (features != null) {
for (int indexFeatures = 0; indexFeatures < features.length; indexFeatures++) {
IFeature featureToCompare = null;
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/core/SiteFeatureReference.java b/update/org.eclipse.update.core/src/org/eclipse/update/core/SiteFeatureReference.java
new file mode 100644
index 0000000..a78a015
--- /dev/null
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/core/SiteFeatureReference.java
@@ -0,0 +1,82 @@
+package org.eclipse.update.core;
+/*
+ * (c) Copyright IBM Corp. 2000, 2002.
+ * All Rights Reserved.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.update.internal.core.UpdateManagerPlugin;
+
+/**
+ * Convenience implementation of a feature reference.
+ * <p>
+ * This class may be instantiated or subclassed by clients.
+ * </p>
+ * @see org.eclipse.update.core.IFeatureReference
+ * @see org.eclipse.update.core.model.FeatureReferenceModel
+ * @since 2.0
+ */
+public class SiteFeatureReference extends SiteFeatureReferenceModel implements ISiteFeatureReference {
+
+ private List categories;
+ private VersionedIdentifier versionId;
+
+ /**
+ * Feature reference default constructor
+ */
+ public SiteFeatureReference() {
+ super();
+ }
+
+ /**
+ * Constructor FeatureReference.
+ * @param ref the reference to copy
+ */
+ public SiteFeatureReference(ISiteFeatureReference ref) {
+ super(ref);
+ }
+
+ /**
+ * Returns an array of categories the referenced feature belong to.
+ *
+ * @see IFeatureReference#getCategories()
+ * @since 2.0
+ */
+ public ICategory[] getCategories() {
+
+ if (categories == null) {
+ categories = new ArrayList();
+ String[] categoriesAsString = getCategoryNames();
+ for (int i = 0; i < categoriesAsString.length; i++) {
+ ICategory siteCat = getSite().getCategory(categoriesAsString[i]);
+ if (siteCat != null)
+ categories.add(siteCat);
+ else {
+ String siteURL = getSite().getURL() != null ? getSite().getURL().toExternalForm() : null;
+ UpdateManagerPlugin.warn("Category " + categoriesAsString[i] + " not found in Site:" + siteURL);
+ }
+ }
+ }
+
+ ICategory[] result = new ICategory[0];
+
+ if (!(categories == null || categories.isEmpty())) {
+ result = new ICategory[categories.size()];
+ categories.toArray(result);
+ }
+ return result;
+ }
+
+ /**
+ * Adds a category to the referenced feature.
+ *
+ * @see IFeatureReference#addCategory(ICategory)
+ * @since 2.0
+ */
+ public void addCategory(ICategory category) {
+ this.addCategoryName(category.getName());
+ }
+
+}
\ No newline at end of file
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/core/SiteFeatureReferenceModel.java b/update/org.eclipse.update.core/src/org/eclipse/update/core/SiteFeatureReferenceModel.java
new file mode 100644
index 0000000..4a6cb81
--- /dev/null
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/core/SiteFeatureReferenceModel.java
@@ -0,0 +1,98 @@
+package org.eclipse.update.core;
+
+import java.util.*;
+
+/**
+ * @author celek
+ *
+ * To change this generated comment edit the template variable "typecomment":
+ * Window>Preferences>Java>Templates.
+ * To enable and disable the creation of type comments go to
+ * Window>Preferences>Java>Code Generation.
+ */
+public class SiteFeatureReferenceModel extends FeatureReference {
+
+ private List /* of String*/
+ categoryNames;
+
+ // [2.0.1]
+ private IncludedFeatureReference options;
+
+ /**
+ * Creates an uninitialized feature reference model object.
+ *
+ * @since 2.0
+ */
+ public SiteFeatureReferenceModel() {
+ super();
+ }
+
+ /**
+ * Constructor FeatureReferenceModel.
+ * @param ref
+ */
+ public SiteFeatureReferenceModel(ISiteFeatureReference ref) {
+ super(ref);
+ if (ref instanceof SiteFeatureReferenceModel) {
+ SiteFeatureReferenceModel refModel = (SiteFeatureReferenceModel) ref;
+ setCategoryNames(refModel.getCategoryNames());
+ }
+ }
+
+
+ /**
+ * Returns the names of categories the referenced feature belongs to.
+ *
+ * @return an array of names, or an empty array.
+ * @since 2.0
+ */
+ public String[] getCategoryNames() {
+ if (categoryNames == null)
+ return new String[0];
+
+ return (String[]) categoryNames.toArray(new String[0]);
+ }
+
+ /**
+ * Sets the names of categories this feature belongs to.
+ * Throws a runtime exception if this object is marked read-only.
+ *
+ * @param categoryNames an array of category names
+ * @since 2.0
+ */
+ public void setCategoryNames(String[] categoryNames) {
+ assertIsWriteable();
+ if (categoryNames == null)
+ this.categoryNames = null;
+ else
+ this.categoryNames = new ArrayList(Arrays.asList(categoryNames));
+ }
+
+ /**
+ * Adds the name of a category this feature belongs to.
+ * Throws a runtime exception if this object is marked read-only.
+ *
+ * @param categoryName category name
+ * @since 2.0
+ */
+ public void addCategoryName(String categoryName) {
+ assertIsWriteable();
+ if (this.categoryNames == null)
+ this.categoryNames = new ArrayList();
+ if (!this.categoryNames.contains(categoryName))
+ this.categoryNames.add(categoryName);
+ }
+
+ /**
+ * Removes the name of a categorys this feature belongs to.
+ * Throws a runtime exception if this object is marked read-only.
+ *
+ * @param categoryName category name
+ * @since 2.0
+ */
+ public void removeCategoryName(String categoryName) {
+ assertIsWriteable();
+ if (this.categoryNames != null)
+ this.categoryNames.remove(categoryName);
+ }
+}
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/core/SiteManager.java b/update/org.eclipse.update.core/src/org/eclipse/update/core/SiteManager.java
index fda9d7d..8963d9e 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/core/SiteManager.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/core/SiteManager.java
@@ -6,6 +6,7 @@
import java.net.URL;
+import org.eclipse.core.boot.BootLoader;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.update.configuration.ILocalSite;
import org.eclipse.update.internal.core.InternalSiteManager;
@@ -22,6 +23,10 @@
* @since 2.0
*/
public class SiteManager {
+
+ private static String os;
+ private static String ws;
+ private static String arch;
private SiteManager() {
}
@@ -82,4 +87,67 @@
public static void handleNewChanges() throws CoreException{
InternalSiteManager.handleNewChanges();
}
+ /**
+ * Returns the string name of the system architecture
+ *
+ * @see BootLoader#ARCH_LIST
+ * @return String
+ * @since 2.1
+ */
+ public static String getOSArch(){
+ if (arch==null)
+ arch = BootLoader.getOSArch();
+ return arch;
+ }
+
+ /**
+ * Returns the string name of the opearting system
+ *
+ * @see BootLoader#OS_LIST
+ * @return String
+ * @since 2.1
+ */
+ public static String getOS(){
+ if (os==null)
+ os = BootLoader.getOS();
+ return os;
+ }
+
+ /**
+ * Returns the string name of the windowing system
+ *
+ * @see BootLoader#WS_LIST
+ * @return String
+ * @since 2.1
+ */
+ public static String getWS() {
+ if (ws==null)
+ ws = BootLoader.getWS();
+ return ws;
+ }
+
+ /**
+ * Sets the arch.
+ * @param arch The arch to set
+ */
+ public static void setOSArch(String arch) {
+ SiteManager.arch = arch;
+ }
+
+ /**
+ * Sets the os.
+ * @param os The os to set
+ */
+ public static void setOS(String os) {
+ SiteManager.os = os;
+ }
+
+ /**
+ * Sets the ws.
+ * @param ws The ws to set
+ */
+ public static void setWS(String ws) {
+ SiteManager.ws = ws;
+ }
+
}
\ No newline at end of file
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/core/Utilities.java b/update/org.eclipse.update.core/src/org/eclipse/update/core/Utilities.java
index b339c5d..4deb651 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/core/Utilities.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/core/Utilities.java
@@ -196,7 +196,8 @@
completeString.append(s);
if (e != null) {
completeString.append(" [");
- completeString.append(e.toString());
+ String msg = e.getLocalizedMessage();
+ completeString.append(msg!=null?msg:e.toString());
completeString.append("]");
}
status = new Status(IStatus.ERROR, id, code, completeString.toString(), e);
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/core/model/ContentEntryModel.java b/update/org.eclipse.update.core/src/org/eclipse/update/core/model/ContentEntryModel.java
index 94191ec..d4fc7f0 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/core/model/ContentEntryModel.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/core/model/ContentEntryModel.java
@@ -1,4 +1,5 @@
package org.eclipse.update.core.model;
+
/*
* (c) Copyright IBM Corp. 2000, 2002.
* All Rights Reserved.
@@ -92,7 +93,7 @@
* @return the system architecture specification or <code>null</code>.
* @since 2.0
*/
- public String getArch() {
+ public String getOSArch() {
return arch;
}
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/core/model/DefaultFeatureParser.java b/update/org.eclipse.update.core/src/org/eclipse/update/core/model/DefaultFeatureParser.java
index 8ec15e4..a03f747 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/core/model/DefaultFeatureParser.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/core/model/DefaultFeatureParser.java
@@ -271,15 +271,11 @@
case STATE_INCLUDES :
stateStack.pop();
- if (objectStack.peek() instanceof VersionedIdentifier) {
- VersionedIdentifier identifier = (VersionedIdentifier) objectStack.pop();
- IncludedFeatureReference options = null;
- if (objectStack.peek() instanceof IncludedFeatureReference){
- options = ((IncludedFeatureReference)objectStack.pop());
- }
+ if (objectStack.peek() instanceof IncludedFeatureReferenceModel) {
+ IncludedFeatureReferenceModel includedFeatureRefModel = ((IncludedFeatureReferenceModel)objectStack.pop());
if (objectStack.peek() instanceof FeatureModel) {
featureModel = (FeatureModel) objectStack.peek();
- featureModel.addIncludesFeatureIdentifier(identifier,options);
+ featureModel.addIncludedFeatureReferenceModel(includedFeatureRefModel);
}
}
break;
@@ -1056,16 +1052,23 @@
//$NON-NLS-1$
}
+ IncludedFeatureReferenceModel includedFeature = factory.createIncludedFeatureReferenceModel();
+ includedFeature.setFeatureIdentifier(id);
+ includedFeature.setFeatureVersion(ver);
+
// name
String name = attributes.getValue("name");
+ includedFeature.setName(name);
// optional
String optional = attributes.getValue("optional");
boolean isOptional = "true".equalsIgnoreCase(optional);
+ includedFeature.isOptional(isOptional);
// match
String ruleName = attributes.getValue("match");
int rule = UpdateManagerUtils.getMatchingRule(ruleName);
+ includedFeature.setMatchingRule(rule);
// search location
String locationName = attributes.getValue("search_location");
@@ -1074,10 +1077,19 @@
searchLocation = IUpdateConstants.SEARCH_ROOT & IUpdateConstants.SEARCH_SELF;
if("root".equalsIgnoreCase(locationName))
searchLocation = IUpdateConstants.SEARCH_ROOT;
+ includedFeature.setSearchLocation(searchLocation);
+ // os arch ws
+ String os = attributes.getValue("os");
+ includedFeature.setOS(os);
- objectStack.push(new IncludedFeatureReference(name,isOptional,rule, searchLocation));
- objectStack.push(new VersionedIdentifier(id,ver));
+ String ws = attributes.getValue("ws");
+ includedFeature.setWS(ws);
+
+ String arch = attributes.getValue("arch");
+ includedFeature.setArch(arch);
+
+ objectStack.push(includedFeature);
if (UpdateManagerPlugin.DEBUG && UpdateManagerPlugin.DEBUG_SHOW_PARSING) {
debug("End process Includes tag: id:" //$NON-NLS-1$
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/core/model/DefaultSiteParser.java b/update/org.eclipse.update.core/src/org/eclipse/update/core/model/DefaultSiteParser.java
index 4c2b914..fd8e5ac 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/core/model/DefaultSiteParser.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/core/model/DefaultSiteParser.java
@@ -10,6 +10,7 @@
import org.apache.xerces.parsers.SAXParser;
import org.eclipse.core.runtime.*;
+import org.eclipse.update.core.SiteFeatureReferenceModel;
import org.eclipse.update.internal.core.Policy;
import org.eclipse.update.internal.core.UpdateManagerPlugin;
import org.xml.sax.*;
@@ -537,7 +538,7 @@
* process feature info
*/
private void processFeature(Attributes attributes) {
- FeatureReferenceModel feature = factory.createFeatureReferenceModel();
+ SiteFeatureReferenceModel feature = factory.createFeatureReferenceModel();
String urlInfo = attributes.getValue("url"); //$NON-NLS-1$
if (urlInfo == null || urlInfo.trim().equals("")) //$NON-NLS-1$
internalError(
@@ -612,7 +613,7 @@
*/
private void processCategory(Attributes attributes) {
String category = attributes.getValue("name"); //$NON-NLS-1$
- FeatureReferenceModel feature = (FeatureReferenceModel) objectStack.peek();
+ SiteFeatureReferenceModel feature = (SiteFeatureReferenceModel) objectStack.peek();
feature.addCategoryName(category);
if (UpdateManagerPlugin.DEBUG && UpdateManagerPlugin.DEBUG_SHOW_PARSING)
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/core/model/FeatureModel.java b/update/org.eclipse.update.core/src/org/eclipse/update/core/model/FeatureModel.java
index c7a3106..107edf7 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/core/model/FeatureModel.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/core/model/FeatureModel.java
@@ -8,7 +8,7 @@
import java.net.URL;
import java.util.*;
-import org.eclipse.update.core.IncludedFeatureReference;
+import org.eclipse.update.core.IIncludedFeatureReference;
import org.eclipse.update.core.VersionedIdentifier;
/**
@@ -49,7 +49,7 @@
imports;
private List /*of PluginEntryModel*/
pluginEntries;
- private Map /*of VersionedIdentifier, IncludedFeatureOptions */
+ private List /*of IncludedFeatureReferenceModel */
featureIncludes;
private List /*of NonPluginEntryModel*/
nonPluginEntries;
@@ -202,7 +202,7 @@
* @return the system architecture specification string, or <code>null</code>.
* @since 2.0
*/
- public String getArch() {
+ public String getOSArch() {
return arch;
}
@@ -353,29 +353,28 @@
return new VersionedIdentifier[0];
//
- Set featureIncluded = featureIncludes.keySet();
- Iterator iter = featureIncluded.iterator();
- VersionedIdentifier[] versionIncluded = new VersionedIdentifier[featureIncluded.size()];
+ Iterator iter = featureIncludes.iterator();
+ VersionedIdentifier[] versionIncluded = new VersionedIdentifier[featureIncludes.size()];
int index = 0;
- while (iter.hasNext()) {
- versionIncluded[index]=(VersionedIdentifier) iter.next();
+ while (iter.hasNext()) {
+ IncludedFeatureReferenceModel model = (IncludedFeatureReferenceModel)iter.next();
+ versionIncluded[index]=model.getVersionedIdentifier();
index++;
}
return versionIncluded;
}
/**
- * Returns a map of feature versioned identifier referenced by this feature.
- * The key is an <code>IFeatureIdentifier</code> representing the nested feature.
- * The value is a <code>Boolean</code>. The valuse is <code>true</code> if the nested feature is optional, otherwise <code>false</code>.
- *
- * @return a Map of feature versioned identifier and Boolean, or an empty Map.
+ * Returns an array of included feature reference model referenced by this feature.
+ *
+ * @return an array of included feature reference model, or an empty array.
* @since 2.0
*/
- public Map getFeatureIncludeMap() {
+ public IIncludedFeatureReference[] getFeatureIncluded() {
if (featureIncludes == null)
- return new HashMap();
- return featureIncludes;
+ return new IIncludedFeatureReference[0];
+ return (IIncludedFeatureReference[]) featureIncludes.toArray(
+ arrayTypeFor(featureIncludes));
}
/**
@@ -710,16 +709,6 @@
if (!this.pluginEntries.contains(pluginEntry))
this.pluginEntries.add(pluginEntry);
}
- /**
- * Adds a feature identifier.
- * Throws a runtime exception if this object is marked read-only.
- *
- * @param identifier feature identifer
- * @since 2.0
- */
- public void addIncludesFeatureIdentifier(VersionedIdentifier identifier){
- addIncludesFeatureIdentifier(identifier,null);
- }
/**
* Adds a feature identifier.
@@ -727,15 +716,14 @@
*
* @param identifier feature identifer
* @param options the options associated with the nested feature
- * @since 2.0
+ * @since 2.1
*/
- public void addIncludesFeatureIdentifier(VersionedIdentifier identifier,IncludedFeatureReference options){
+ public void addIncludedFeatureReferenceModel(IncludedFeatureReferenceModel include){
assertIsWriteable();
- if (identifier==null) return;
- if (this.featureIncludes == null)
- this.featureIncludes = new HashMap();
- if (!this.featureIncludes.containsKey(identifier))
- this.featureIncludes.put(identifier,options);
+ if (this.featureIncludes==null)
+ this.featureIncludes = new ArrayList();
+ if (!this.featureIncludes.contains(include))
+ this.featureIncludes.add(include);
}
/**
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/core/model/FeatureModelFactory.java b/update/org.eclipse.update.core/src/org/eclipse/update/core/model/FeatureModelFactory.java
index fffb30e..3b8e584 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/core/model/FeatureModelFactory.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/core/model/FeatureModelFactory.java
@@ -10,8 +10,8 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.update.core.Utilities;
-import org.xml.sax.SAXException;
import org.eclipse.update.internal.core.Policy;
+import org.xml.sax.SAXException;
/**
* Default feature model factory.
@@ -76,6 +76,18 @@
}
/**
+ * Create a default included feature reference model.
+ *
+ * @see IncludedFeatureReferenceModel
+ * @return feature model
+ * @since 2.1
+ */
+ public IncludedFeatureReferenceModel createIncludedFeatureReferenceModel() {
+ return new IncludedFeatureReferenceModel();
+ }
+
+
+ /**
* Create a default install handler model.
*
* @see InstallHandlerEntryModel
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/core/model/FeatureReferenceModel.java b/update/org.eclipse.update.core/src/org/eclipse/update/core/model/FeatureReferenceModel.java
index 78466c6..52d13b4 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/core/model/FeatureReferenceModel.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/core/model/FeatureReferenceModel.java
@@ -6,9 +6,8 @@
import java.net.MalformedURLException;
import java.net.URL;
-import java.util.*;
+import java.util.ResourceBundle;
-import org.eclipse.update.core.IncludedFeatureReference;
import org.eclipse.update.internal.core.UpdateManagerUtils;
/**
@@ -29,11 +28,6 @@
private String featureId;
private String featureVersion;
private SiteModel site;
- private List /* of String*/
- categoryNames;
-
- // [2.0.1]
- private IncludedFeatureReference options;
/**
* Creates an uninitialized feature reference model object.
@@ -52,7 +46,7 @@
setFeatureIdentifier(ref.getFeatureIdentifier());
setFeatureVersion(ref.getFeatureVersion());
setType(ref.getType());
- setCategoryNames(ref.getCategoryNames());
+ setSiteModel(ref.getSiteModel());
}
/**
@@ -120,19 +114,6 @@
}
/**
- * Returns the names of categories the referenced feature belongs to.
- *
- * @return an array of names, or an empty array.
- * @since 2.0
- */
- public String[] getCategoryNames() {
- if (categoryNames == null)
- return new String[0];
-
- return (String[]) categoryNames.toArray(new String[0]);
- }
-
- /**
* Returns the feature identifier as a string
*
* @see org.eclipse.update.core.IFeatureReference#getVersionedIdentifier()
@@ -216,48 +197,6 @@
}
/**
- * Sets the names of categories this feature belongs to.
- * Throws a runtime exception if this object is marked read-only.
- *
- * @param categoryNames an array of category names
- * @since 2.0
- */
- public void setCategoryNames(String[] categoryNames) {
- assertIsWriteable();
- if (categoryNames == null)
- this.categoryNames = null;
- else
- this.categoryNames = new ArrayList(Arrays.asList(categoryNames));
- }
-
- /**
- * Adds the name of a category this feature belongs to.
- * Throws a runtime exception if this object is marked read-only.
- *
- * @param categoryName category name
- * @since 2.0
- */
- public void addCategoryName(String categoryName) {
- assertIsWriteable();
- if (this.categoryNames == null)
- this.categoryNames = new ArrayList();
- if (!this.categoryNames.contains(categoryName))
- this.categoryNames.add(categoryName);
- }
- /**
- * Removes the name of a categorys this feature belongs to.
- * Throws a runtime exception if this object is marked read-only.
- *
- * @param categoryName category name
- * @since 2.0
- */
- public void removeCategoryName(String categoryName) {
- assertIsWriteable();
- if (this.categoryNames != null)
- this.categoryNames.remove(categoryName);
- }
-
- /**
* Resolve the model object.
* Any URL strings in the model are resolved relative to the
* base URL argument. Any translatable strings in the model that are
@@ -286,20 +225,4 @@
return buffer.toString();
}
- /**
- * Returns the options.
- * @return IncludedFeatureOptions
- */
- public IncludedFeatureReference getOptions() {
- return options;
- }
-
- /**
- * Sets the options.
- * @param options The options to set
- */
- public void setOptions(IncludedFeatureReference options) {
- this.options = options;
- }
-
}
\ No newline at end of file
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/core/model/IncludedFeatureReferenceModel.java b/update/org.eclipse.update.core/src/org/eclipse/update/core/model/IncludedFeatureReferenceModel.java
new file mode 100644
index 0000000..4b0a766
--- /dev/null
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/core/model/IncludedFeatureReferenceModel.java
@@ -0,0 +1,231 @@
+package org.eclipse.update.core.model;
+
+import org.eclipse.update.core.*;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2002.
+ * All Rights Reserved.
+ */
+
+/**
+ * Included Feature reference model object.
+ * <p>
+ * This class may be instantiated or subclassed by clients. However, in most
+ * cases clients should instead instantiate or subclass the provided
+ * concrete implementation of this model.
+ * </p>
+ * @see org.eclipse.update.core.IncludedFeatureReference
+ * @since 2.1
+ */
+public class IncludedFeatureReferenceModel extends FeatureReference {
+
+ // since 2.0.2
+ private boolean isOptional;
+ private String name;
+ private int matchingRule;
+ private int searchLocation;
+
+ // since 2.1
+ private String os;
+ private String ws;
+ private String arch;
+ private String nl;
+
+ /**
+ * Construct a included feature reference
+ *
+ * @since 2.1
+ */
+ public IncludedFeatureReferenceModel() {
+ super();
+ isOptional(false);
+ setMatchingRule(IImport.RULE_PERFECT);
+ setSearchLocation(IUpdateConstants.SEARCH_ROOT);
+ }
+
+
+
+ /**
+ * Construct a included feature reference model
+ *
+ * @param includedFeatureRef the included reference model to copy
+ * @since 2.1
+ */
+ public IncludedFeatureReferenceModel(IncludedFeatureReferenceModel includedFeatureRef) {
+ super((FeatureReferenceModel)includedFeatureRef);
+ isOptional(includedFeatureRef.isOptional());
+ setName(includedFeatureRef.getName());
+ setMatchingRule(includedFeatureRef.getMatch());
+ setSearchLocation(includedFeatureRef.getSearchLocation());
+ }
+
+ /**
+ * Constructor IncludedFeatureReferenceModel.
+ * @param featureReference
+ */
+ public IncludedFeatureReferenceModel(IFeatureReference featureReference) {
+ super((FeatureReferenceModel)featureReference);
+ isOptional(false);
+ setMatchingRule(IImport.RULE_PERFECT);
+ setSearchLocation(IUpdateConstants.SEARCH_ROOT);
+ }
+
+
+ /**
+ * Returns the matching rule for this included feature.
+ * The rule will determine the ability of the included feature to move version
+ * without causing the overall feature to appear broken.
+ *
+ * The default is <code>MATCH_PERFECT</code>
+ *
+ * @see IImport#RULE_PERFECT
+ * @see IImport#RULE_EQUIVALENT
+ * @see IImport#RULE_COMPATIBLE
+ * @see IImport#RULE_GREATER_OR_EQUAL
+ * @return int representation of feature matching rule.
+ * @since 2.0.2
+ */
+ public int getMatch(){
+ return matchingRule;
+ }
+
+
+ /**
+ * Returns a string representation of the feature identifier.
+ *
+ * @return string representation of feature identifier or <code>null</code>.
+ * @since 2.0.1
+ */
+ public String getName() {
+ return name;
+ }
+
+
+ /**
+ * Returns the search location for this included feature.
+ * The location will be used to search updates for this feature.
+ *
+ * The default is <code>SEARCH_ROOT</code>
+ *
+ * @see IFeatureReference#SEARCH_ROOT
+ * @see IFeatureReference#SEARCH_SELF
+ * @return int representation of feature searching rule.
+ * @since 2.0.2
+ */
+
+ public int getSearchLocation(){
+ return searchLocation;
+ }
+
+
+
+ /**
+ * Returns the isOptional
+ *
+ * @return isOptional
+ * @since 2.0.1
+ */
+ public boolean isOptional() {
+ return isOptional;
+ }
+
+
+
+
+ /**
+ * Sets the isOptional.
+ * @param isOptional The isOptional to set
+ */
+ public void isOptional(boolean isOptional) {
+ this.isOptional = isOptional;
+ }
+
+ /**
+ * Sets the matchingRule.
+ * @param matchingRule The matchingRule to set
+ */
+ public void setMatchingRule(int matchingRule) {
+ this.matchingRule = matchingRule;
+ }
+
+ /**
+ * Sets the name.
+ * @param name The name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Sets the searchLocation.
+ * @param searchLocation The searchLocation to set
+ */
+ public void setSearchLocation(int searchLocation) {
+ this.searchLocation = searchLocation;
+ }
+
+ /**
+ * Returns the arch.
+ * @return String
+ */
+ public String getOSArch() {
+ return arch;
+ }
+
+ /**
+ * Returns the os.
+ * @return String
+ */
+ public String getOS() {
+ return os;
+ }
+
+ /**
+ * Returns the ws.
+ * @return String
+ */
+ public String getWS() {
+ return ws;
+ }
+
+ /**
+ * Sets the arch.
+ * @param arch The arch to set
+ */
+ public void setArch(String arch) {
+ this.arch = arch;
+ }
+
+ /**
+ * Sets the os.
+ * @param os The os to set
+ */
+ public void setOS(String os) {
+ this.os = os;
+ }
+
+ /**
+ * Sets the ws.
+ * @param ws The ws to set
+ */
+ public void setWS(String ws) {
+ this.ws = ws;
+ }
+
+ /**
+ * Returns the nl.
+ * @return String
+ */
+ public String getNL() {
+ return nl;
+ }
+
+ /**
+ * Sets the nl.
+ * @param nl The nl to set
+ */
+ public void setNL(String nl) {
+ this.nl = nl;
+ }
+
+}
\ No newline at end of file
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/core/model/PluginEntryModel.java b/update/org.eclipse.update.core/src/org/eclipse/update/core/model/PluginEntryModel.java
index 04a364d..eac5ab3 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/core/model/PluginEntryModel.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/core/model/PluginEntryModel.java
@@ -1,4 +1,5 @@
package org.eclipse.update.core.model;
+
/*
* (c) Copyright IBM Corp. 2000, 2002.
* All Rights Reserved.
@@ -19,7 +20,7 @@
private String pluginId;
private String pluginVersion;
private boolean isFragment = false;
-
+
/**
* Creates a uninitialized plug-in entry model object.
*
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/core/model/SiteModel.java b/update/org.eclipse.update.core/src/org/eclipse/update/core/model/SiteModel.java
index dba7aff..865f1a2 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/core/model/SiteModel.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/core/model/SiteModel.java
@@ -8,6 +8,7 @@
import java.net.URL;
import java.util.*;
+import org.eclipse.update.core.SiteFeatureReferenceModel;
import org.eclipse.update.internal.model.ConfiguredSiteModel;
/**
@@ -69,11 +70,11 @@
* @return an array of feature reference models, or an empty array.
* @since 2.0
*/
- public FeatureReferenceModel[] getFeatureReferenceModels() {
+ public SiteFeatureReferenceModel[] getFeatureReferenceModels() {
if (featureReferences == null)
- return new FeatureReferenceModel[0];
+ return new SiteFeatureReferenceModel[0];
- return (FeatureReferenceModel[]) featureReferences.toArray(
+ return (SiteFeatureReferenceModel[]) featureReferences.toArray(
arrayTypeFor(featureReferences));
}
@@ -216,7 +217,7 @@
* @param featureReference feature reference model
* @since 2.0
*/
- public void addFeatureReferenceModel(FeatureReferenceModel featureReference) {
+ public void addFeatureReferenceModel(SiteFeatureReferenceModel featureReference) {
assertIsWriteable();
if (this.featureReferences == null)
this.featureReferences = new ArrayList();
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/core/model/SiteModelFactory.java b/update/org.eclipse.update.core/src/org/eclipse/update/core/model/SiteModelFactory.java
index 4239f90..f06bcd7 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/core/model/SiteModelFactory.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/core/model/SiteModelFactory.java
@@ -9,6 +9,7 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.update.core.SiteFeatureReferenceModel;
import org.eclipse.update.core.Utilities;
import org.eclipse.update.internal.core.Policy;
import org.xml.sax.SAXException;
@@ -98,14 +99,14 @@
}
/**
- * Create a default feature reference model.
+ * Create a default site feature reference model.
*
- * @see FeatureReferenceModel
- * @return feature reference model
+ * @see SiteFeatureReferenceModel
+ * @return site feature reference model
* @since 2.0
*/
- public FeatureReferenceModel createFeatureReferenceModel() {
- return new FeatureReferenceModel();
+ public SiteFeatureReferenceModel createFeatureReferenceModel() {
+ return new SiteFeatureReferenceModel();
}
/**
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/ConfigurationPolicy.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/ConfigurationPolicy.java
index ec95315..a203b21 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/ConfigurationPolicy.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/ConfigurationPolicy.java
@@ -92,7 +92,7 @@
try {
feature = featureReference.getFeature();
} catch (CoreException e) {
- if (!featureReference.isOptional()){
+ if (!UpdateManagerUtils.isOptional(featureReference)){
URL url = featureReference.getURL();
String urlString = (url != null) ? url.toExternalForm() : "<no feature reference url>";
UpdateManagerPlugin.warn("Error retrieving feature:" + urlString, e);
@@ -174,7 +174,7 @@
try {
feature = featureReference.getFeature();
} catch (CoreException e) {
- if (!featureReference.isOptional()){
+ if (!UpdateManagerUtils.isOptional(featureReference)){
URL url = featureReference.getURL();
String urlString = (url != null) ? url.toExternalForm() : "<no feature reference url>";
UpdateManagerPlugin.warn("Error retrieving feature:" + urlString, e);
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/ConfiguredSite.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/ConfiguredSite.java
index 24b9954..84469a0 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/ConfiguredSite.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/ConfiguredSite.java
@@ -236,8 +236,8 @@
try {
IFeatureReference referenceToRemove = null;
- IFeatureReference[] featureRef = getSite().getFeatureReferences();
- IFeatureReference ref = getSite().getFeatureReference(feature);
+ ISiteFeatureReference[] featureRef = getSite().getFeatureReferences();
+ ISiteFeatureReference ref = getSite().getFeatureReference(feature);
for (int i = 0; i < featureRef.length; i++) {
if (featureRef[i].equals(ref)) {
referenceToRemove = featureRef[i];
@@ -305,9 +305,9 @@
return;
// bottom up approach, same configuredSite
- IFeatureReference[] childrenRef = feature.getIncludedFeatureReferences();
+ IIncludedFeatureReference[] childrenRef = feature.getIncludedFeatureReferences();
if (optionalFeatures!=null){
- childrenRef = childrenToConfigure(childrenRef,optionalFeatures);
+ childrenRef = childrenToConfigure(childrenRef, optionalFeatures);
}
for (int i = 0; i < childrenRef.length; i++) {
@@ -339,12 +339,12 @@
* @param optionalfeatures optional features to install
* @return IFeatureReference[]
*/
- private IFeatureReference[] childrenToConfigure(IFeatureReference[] children, IFeatureReference[] optionalfeatures) {
+ private IIncludedFeatureReference[] childrenToConfigure(IIncludedFeatureReference[] children, IFeatureReference[] optionalfeatures) {
List childrenToInstall = new ArrayList();
for (int i = 0; i < children.length; i++) {
- IFeatureReference optionalFeatureToConfigure = children[i];
- if (!optionalFeatureToConfigure.isOptional()){
+ IIncludedFeatureReference optionalFeatureToConfigure = children[i];
+ if (!optionalFeatureToConfigure.isOptional()){
childrenToInstall.add(optionalFeatureToConfigure);
} else {
for (int j = 0; j < optionalfeatures.length; j++) {
@@ -363,7 +363,7 @@
}
}
- IFeatureReference[] result = new IFeatureReference[childrenToInstall.size()];
+ IIncludedFeatureReference[] result = new IIncludedFeatureReference[childrenToInstall.size()];
if (childrenToInstall.size()>0){
childrenToInstall.toArray(result);
}
@@ -419,7 +419,7 @@
if (includePatches) unconfigurePatches(feature);
// top down approach, same configuredSite
- IFeatureReference[] childrenRef = feature.getIncludedFeatureReferences();
+ IIncludedFeatureReference[] childrenRef = feature.getIncludedFeatureReferences();
for (int i = 0; i < childrenRef.length; i++) {
try {
IFeature child = childrenRef[i].getFeature(true,null); // disable the exact feature
@@ -486,7 +486,7 @@
public IFeatureReference[] getConfiguredFeatures() {
ConfigurationPolicy configPolicy = getConfigurationPolicy();
if (configPolicy == null)
- return new IFeatureReference[0];
+ return new ISiteFeatureReference[0];
return configPolicy.getConfiguredFeatures();
}
@@ -498,7 +498,7 @@
ConfigurationPolicy configPolicy = getConfigurationPolicy();
if (configPolicy == null)
- return new IFeatureReference[0];
+ return new ISiteFeatureReference[0];
IFeatureReference[] configuredFeatures = getConfiguredFeatures();
int confLen = configuredFeatures.length;
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/FeatureExecutableFactory.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/FeatureExecutableFactory.java
index 8bef59a..d97f814 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/FeatureExecutableFactory.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/FeatureExecutableFactory.java
@@ -41,7 +41,7 @@
contentProvider.getFeatureManifestReference(null /*IProgressMonitor*/
).asURL();
URL resolvedURL = URLEncoder.encode(nonResolvedURL);
- featureStream = resolvedURL.openStream();
+ featureStream = UpdateManagerPlugin.getPlugin().get(resolvedURL).getInputStream();
feature = (TargetFeature) this.parseFeature(featureStream);
feature.setSite(site);
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/FileResponse.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/FileResponse.java
new file mode 100644
index 0000000..21e69cc
--- /dev/null
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/FileResponse.java
@@ -0,0 +1,25 @@
+package org.eclipse.update.internal.core;
+/*
+ * (c) Copyright IBM Corp. 2000, 2002.
+ * All Rights Reserved.
+ */
+import java.io.InputStream;
+
+//import org.eclipse.update.internal.core.net.http.IContext;
+//import org.eclipse.update.internal.core.net.http.client.IStatusCodes;
+//import org.eclipse.update.internal.core.net.http.client.Response;
+
+/**
+ * A File repsonse message
+ */
+public class FileResponse extends Response {
+
+ /**
+ *
+ */
+ public FileResponse(InputStream in) {
+ //super(IStatusCodes.HTTP_OK,"", context, in);
+ super(in);
+ }
+
+}
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/HttpClient.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/HttpClient.java
new file mode 100644
index 0000000..69a2a46
--- /dev/null
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/HttpClient.java
@@ -0,0 +1,25 @@
+package org.eclipse.update.internal.core;
+
+import java.net.Authenticator;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2002.
+ * All Rights Reserved.
+ */
+public class HttpClient {
+
+ /**
+ * Method close.
+ */
+ public void close() {
+ }
+
+ /**
+ * Method setAuthenticator.
+ * @param authenticator
+ */
+ public void setAuthenticator(Authenticator authenticator) {
+ Authenticator.setDefault(authenticator);
+ }
+
+}
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/HttpResponse.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/HttpResponse.java
new file mode 100644
index 0000000..2b2a48e
--- /dev/null
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/HttpResponse.java
@@ -0,0 +1,19 @@
+package org.eclipse.update.internal.core;
+
+import java.net.URL;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2002.
+ * All Rights Reserved.
+ */
+public class HttpResponse extends Response {
+
+ /**
+ *
+ */
+ public HttpResponse(URL url) {
+ //super(IStatusCodes.HTTP_OK,"", context, in);
+ super(url);
+ }
+
+}
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/IStatusCodes.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/IStatusCodes.java
new file mode 100644
index 0000000..1fe2f2c
--- /dev/null
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/IStatusCodes.java
@@ -0,0 +1,64 @@
+/**********************************************************************
+ * Copyright (c) 2000,2002 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.update.internal.core;
+
+/**
+ * HTTP status codes.
+ * <p>
+ * <b>Note:</b> This class/interface is part of an interim API that is still under
+ * development and expected to change significantly before reaching stability.
+ * It is being made available at this early stage to solicit feedback from pioneering
+ * adopters on the understanding that any code that uses this API will almost
+ * certainly be broken (repeatedly) as the API evolves.
+ * </p>
+ */
+public interface IStatusCodes {
+ public static final int HTTP_CONTINUE = 100;
+ public static final int HTTP_SWITCHING_PROTOCOLS = 101;
+ public static final int HTTP_OK = 200;
+ public static final int HTTP_CREATED = 201;
+ public static final int HTTP_ACCEPTED = 202;
+ public static final int HTTP_NON_AUTHORITATIVE_INFORMATION = 203;
+ public static final int HTTP_NO_CONTENT = 204;
+ public static final int HTTP_RESET_CONTENT = 205;
+ public static final int HTTP_PARTIAL_CONTENT = 206;
+ public static final int HTTP_MULTIPLE_CHOICES = 300;
+ public static final int HTTP_MOVED_PERMANENTLY = 301;
+ public static final int HTTP_MOVED_TEMPORARILY = 302;
+ public static final int HTTP_SEE_OTHER = 303;
+ public static final int HTTP_NOT_MODIFIED = 304;
+ public static final int HTTP_USE_PROXY = 305;
+ public static final int HTTP_TEMPORARY_REDIRECT = 307;
+ public static final int HTTP_BAD_REQUEST = 400;
+ public static final int HTTP_UNAUTHORIZED = 401;
+ public static final int HTTP_PAYMENT_REQUIRED = 402;
+ public static final int HTTP_FORBIDDEN = 403;
+ public static final int HTTP_NOT_FOUND = 404;
+ public static final int HTTP_METHOD_NOT_ALLOWED = 405;
+ public static final int HTTP_NOT_ACCEPTABLE = 406;
+ public static final int HTTP_PROXY_AUTHENTICATION_REQUIRED = 407;
+ public static final int HTTP_REQUEST_TIMEOUT = 408;
+ public static final int HTTP_CONFLICT = 409;
+ public static final int HTTP_GONE = 410;
+ public static final int HTTP_LENGTH_REQUIRED = 411;
+ public static final int HTTP_PRECONDITION_FAILED = 412;
+ public static final int HTTP_REQUEST_TOO_LONG = 413;
+ public static final int HTTP_REQUEST_URI_TOO_LONG = 414;
+ public static final int HTTP_UNSUPPORTED_MEDIA_TYPE = 415;
+ public static final int HTTP_REQUESTED_RANGE_NOT_SATISFIABLE = 416;
+ public static final int HTTP_EXPECTATION_FAILED = 417;
+ public static final int HTTP_INTERNAL_SERVER_ERROR = 500;
+ public static final int HTTP_NOT_IMPLEMENTED = 501;
+ public static final int HTTP_BAD_GATEWAY = 502;
+ public static final int HTTP_SERVICE_UNAVAILABLE = 503;
+ public static final int HTTP_GATEWAY_TIMEOUT = 504;
+ public static final int HTTP_HTTP_VERSION_NOT_SUPPORTED = 505;
+}
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/InstallConfiguration.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/InstallConfiguration.java
index e37833a..7ee2336 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/InstallConfiguration.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/InstallConfiguration.java
@@ -168,7 +168,7 @@
*/
private void configure(ConfiguredSite linkedSite) throws CoreException {
ISite site = linkedSite.getSite();
- IFeatureReference[] newFeaturesRef = site.getFeatureReferences();
+ ISiteFeatureReference[] newFeaturesRef = site.getFeatureReferences();
for (int i = 0; i < newFeaturesRef.length; i++) {
// TRACE
@@ -596,7 +596,7 @@
} else {
// the site didn't exist in the InstallConfiguration we are reverting to
// unconfigure everything from this site so it is still present
- IFeatureReference[] featuresToUnconfigure = nowConfigSites[i].getSite().getFeatureReferences();
+ ISiteFeatureReference[] featuresToUnconfigure = nowConfigSites[i].getSite().getFeatureReferences();
for (int j = 0; j < featuresToUnconfigure.length; j++) {
IFeature featureToUnconfigure = null;
try {
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/InstallHandlerProxy.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/InstallHandlerProxy.java
index 09996c4..34b1b36 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/InstallHandlerProxy.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/InstallHandlerProxy.java
@@ -471,7 +471,7 @@
InputStream is = null;
try {
fos = new FileOutputStream(tempLib);
- is = cp.openStream();
+ is = UpdateManagerPlugin.getPlugin().get(cp).getInputStream();
Utilities.copy(is, fos, null);
} finally {
if (fos != null)
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/Response.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/Response.java
new file mode 100644
index 0000000..34016fb
--- /dev/null
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/Response.java
@@ -0,0 +1,88 @@
+package org.eclipse.update.internal.core;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.*;
+import java.net.URL;
+import java.net.URLConnection;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2002.
+ * All Rights Reserved.
+ */
+public class Response {
+
+ private URL url;
+ private InputStream in;
+ private URLConnection connection;
+
+ /**
+ *
+ */
+ public Response(InputStream in) {
+ super();
+ this.in = in;
+ }
+
+ /**
+ *
+ */
+ public Response(URL url) {
+ super();
+ this.url = url;
+ }
+
+ /**
+ * Method getInputStream.
+ * @return InputStream
+ */
+ public InputStream getInputStream() throws IOException {
+ if (in==null && url!=null){
+ this.connection = url.openConnection();
+ this.in = connection.getInputStream();
+ }
+ return in;
+ }
+
+ /**
+ * Method getContentLength.
+ * @return long
+ */
+ public long getContentLength() {
+ if (connection!=null) return connection.getContentLength();
+ return 0;
+ }
+
+ /**
+ * Method getStatusCode.
+ * @return int
+ */
+ public int getStatusCode() {
+ if (connection!=null){
+ if (connection instanceof HttpURLConnection)
+ try {
+ return ((HttpURLConnection)connection).getResponseCode();
+ } catch (IOException e){
+ UpdateManagerPlugin.warn("",e);
+ }
+ }
+ return IStatusCodes.HTTP_OK;
+ }
+
+ /**
+ * Method getStatusMessage.
+ * @return String
+ */
+ public String getStatusMessage() {
+ if (connection!=null){
+ if (connection instanceof HttpURLConnection)
+ try {
+ return ((HttpURLConnection)connection).getResponseMessage();
+ } catch (IOException e) {
+ UpdateManagerPlugin.warn("",e);
+ }
+ }
+ return "";
+ }
+
+}
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteFile.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteFile.java
index e2b80bd..df75bd5 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteFile.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteFile.java
@@ -151,7 +151,7 @@
}
// remove feature reference from the site
- IFeatureReference[] featureReferences = getFeatureReferences();
+ ISiteFeatureReference[] featureReferences = getFeatureReferences();
if (featureReferences != null) {
for (int indexRef = 0; indexRef < featureReferences.length; indexRef++) {
IFeatureReference element = featureReferences[indexRef];
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteFileContentConsumer.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteFileContentConsumer.java
index c899943..9c09ec2 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteFileContentConsumer.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteFileContentConsumer.java
@@ -12,7 +12,6 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.update.core.*;
import org.eclipse.update.core.model.ArchiveReferenceModel;
-import org.eclipse.update.core.model.FeatureReferenceModel;
/**
* ContentConsummer for a SiteFile
@@ -128,7 +127,7 @@
UpdateManagerPlugin.warn("Attempt to close a closed SiteFileContentConsumer", new Exception());
// create a new Feature reference to be added to the site
- FeatureReference ref = new FeatureReference();
+ SiteFeatureReference ref = new SiteFeatureReference();
ref.setSite(getSite());
File file = null;
@@ -238,7 +237,7 @@
private void commitPlugins(IFeatureReference localFeatureReference) throws CoreException {
// get the feature
- ((SiteFile) getSite()).addFeatureReferenceModel((FeatureReferenceModel) localFeatureReference);
+ ((SiteFile) getSite()).addFeatureReferenceModel((SiteFeatureReferenceModel) localFeatureReference);
IFeature localFeature = null;
try {
localFeature = localFeatureReference.getFeature();
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteFileFactory.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteFileFactory.java
index bdfa1af..0ffe043 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteFileFactory.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteFileFactory.java
@@ -172,7 +172,7 @@
File featureDir = new File(directory, Site.DEFAULT_INSTALLED_FEATURE_PATH);
if (featureDir.exists()) {
String[] dir;
- FeatureReferenceModel featureRef;
+ SiteFeatureReferenceModel featureRef;
URL featureURL;
File currentFeatureDir;
String newFilePath = null;
@@ -216,7 +216,7 @@
File featureDir = new File(directory, Site.DEFAULT_FEATURE_PATH);
if (featureDir.exists()) {
String[] dir;
- FeatureReferenceModel featureRef;
+ SiteFeatureReferenceModel featureRef;
URL featureURL;
File currentFeatureFile;
String newFilePath = null;
@@ -385,7 +385,7 @@
*/
private IFeature createFeature(URL url, String type) throws CoreException {
// InternalFeatureReference
- FeatureReference ref = new FeatureReference();
+ SiteFeatureReference ref = new SiteFeatureReference();
ref.setSite(site);
ref.setURL(url);
ref.setType(type);
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteLocal.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteLocal.java
index f497882..9201c27 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteLocal.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteLocal.java
@@ -103,7 +103,8 @@
//attempt to parse the LocalSite.xml
URL resolvedURL = URLEncoder.encode(configXML);
try {
- new SiteLocalParser(resolvedURL.openStream(), localSite);
+ InputStream in = UpdateManagerPlugin.getPlugin().get(resolvedURL).getInputStream();;
+ new SiteLocalParser(in, localSite);
} catch (FileNotFoundException exception) {
// file SITE_LOCAL_FILE doesn't exist, ok, log it
// and reconcile with platform configuration
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteReconciler.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteReconciler.java
index b81ab91..25d534b 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteReconciler.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteReconciler.java
@@ -127,7 +127,7 @@
// Add the features to the list of new found features
// and configure it based on reconciliation type
- IFeatureReference[] newFeaturesRef = site.getFeatureReferences();
+ ISiteFeatureReference[] newFeaturesRef = site.getFeatureReferences();
for (int i = 0; i < newFeaturesRef.length; i++) {
// TRACE
if (UpdateManagerPlugin.DEBUG && UpdateManagerPlugin.DEBUG_SHOW_RECONCILER) {
@@ -220,7 +220,7 @@
// and the new one. Add the new Features as Configured
List toCheck = new ArrayList();
ISite site = oldConfiguredSite.getSite();
- IFeatureReference[] foundFeatures = site.getFeatureReferences();
+ ISiteFeatureReference[] foundFeatures = site.getFeatureReferences();
IFeatureReference[] oldConfiguredFeaturesRef = oldConfiguredSite.getFeatureReferences();
// TRACE
@@ -717,7 +717,7 @@
// remove all features that nest in some other feature
for (int i = 0; i < list.length; i++) {
- IFeatureReference[] children = null;
+ IIncludedFeatureReference[] children = null;
try {
children = list[i].getIncludedFeatureReferences();
} catch (CoreException e) {
@@ -819,7 +819,7 @@
try {
child = children[j].getFeature();
} catch (CoreException e) {
- if (!children[j].isOptional())
+ if (!UpdateManagerUtils.isOptional(children[j]))
UpdateManagerPlugin.warn("", e);
// 25202 do not return right now, the peer children may be ok
}
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteStatusAnalyzer.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteStatusAnalyzer.java
index a72a764..7bd0ff6 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteStatusAnalyzer.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteStatusAnalyzer.java
@@ -189,11 +189,11 @@
// do not check children if feature is disable
if (!(code == IFeature.STATUS_DISABLED)) {
for (int i = 0; i < children.length; i++) {
- if (!children[i].isOptional()) {
+ if (!UpdateManagerUtils.isOptional(children[i])) {
try {
childFeature = children[i].getFeature();
} catch (CoreException e) {
- if (!children[i].isOptional())
+ if (!UpdateManagerUtils.isOptional(children[i]))
UpdateManagerPlugin.warn("Error retrieving feature:" + children[i]);
}
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteURLFactory.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteURLFactory.java
index b856a17..aa60d75 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteURLFactory.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteURLFactory.java
@@ -7,7 +7,7 @@
import java.io.InputStream;
import java.net.*;
-import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.update.core.*;
import org.eclipse.update.core.model.InvalidSiteTypeException;
import org.eclipse.update.core.model.SiteModelFactory;
@@ -41,9 +41,9 @@
SiteURLContentProvider contentProvider = new SiteURLContentProvider(url);
URL resolvedURL = URLEncoder.encode(url);
- URLConnection connection = openConnection(resolvedURL);
- UpdateManagerUtils.checkConnectionResult(connection);
- siteStream = connection.getInputStream();
+ Response response = UpdateManagerPlugin.getPlugin().get(resolvedURL);
+ UpdateManagerUtils.checkConnectionResult(response,resolvedURL);
+ siteStream = response.getInputStream();
SiteModelFactory factory = (SiteModelFactory) this;
site = (Site) factory.parseSite(siteStream);
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/UpdateManagerPlugin.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/UpdateManagerPlugin.java
index 846121c..fc1eb76 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/UpdateManagerPlugin.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/UpdateManagerPlugin.java
@@ -6,16 +6,19 @@
import java.io.File;
import java.io.IOException;
+import java.net.Authenticator;
import java.net.URL;
import java.util.ArrayList;
import org.eclipse.core.boot.BootLoader;
import org.eclipse.core.boot.IPlatformConfiguration;
+
import org.eclipse.core.runtime.*;
import org.eclipse.update.configuration.IInstallConfiguration;
import org.eclipse.update.core.JarContentReference;
import org.eclipse.update.core.Utilities;
+
/**
* The main plugin class to be used in the desktop.
*/
@@ -42,6 +45,8 @@
// web install
private static String appServerHost =null;
private static int appServerPort = 0;
+
+ private HttpClient client;
/**
* The constructor.
@@ -100,6 +105,8 @@
} catch (IOException e){
warn("",e);
}
+
+ client = new HttpClient();
}
/**
@@ -112,6 +119,8 @@
Utilities.shutdown(); // cleanup temp area
if (log!=null)
log.shutdown();
+
+ if (client!=null) client.close();
}
private boolean getBooleanDebugOption(String flag, boolean dflt) {
@@ -234,4 +243,53 @@
return updateStateLocation;
}
+ /**
+ * Sends the GET request to the server and returns the server's
+ * response.
+ *
+ * @param url the URL to open on the server
+ * @return the server's response
+ * @throws IOException if an I/O error occurs. Reasons include:
+ * <ul>
+ * <li>The client is closed.
+ * <li>The client could not connect to the server
+ * <li>An I/O error occurs while communicating with the server
+ * <ul>
+ */
+ public Response get(URL url) throws IOException {
+ //Request request = null;
+ Response response = null;
+
+ if ("file".equals(url.getProtocol())){
+ response = new FileResponse(url.openStream());
+ } else {
+ response = new HttpResponse(url);
+ }
+
+ /*else {
+ try {
+ request = new Request("GET", url, null);
+ response = client.invoke(request);
+ } finally {
+ if (request != null) {
+ try {
+ request.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }*/
+ return response;
+ }
+
+ /**
+ * Method setDefaultAuthenticator.
+ * @param authenticator
+ */
+ public void setDefaultAuthenticator(Authenticator authenticator) {
+ if (client!=null)
+ client.setAuthenticator(authenticator);
+ }
+
}
\ No newline at end of file
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/UpdateManagerUtils.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/UpdateManagerUtils.java
index a533d04..329c7f5 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/UpdateManagerUtils.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/UpdateManagerUtils.java
@@ -427,7 +427,7 @@
};
if (childFeature.equals(compareFeature)) {
if (onlyOptional) {
- if (children[j].isOptional()) {
+ if (UpdateManagerUtils.isOptional(children[j])) {
parentList.add(possiblesParent[i]);
} else {
UpdateManagerPlugin.warn("Feature :" + children[j] + " not optional. Not included in parents list.");
@@ -481,25 +481,14 @@
* thow an IO exception
*
*/
- public static void checkConnectionResult(URLConnection connection) throws IOException {
+ public static void checkConnectionResult(Response response,URL url) throws IOException {
// did the server return an error code ?
- if (connection instanceof HttpURLConnection) {
- int result = HttpURLConnection.HTTP_OK;
- HttpURLConnection httpConnection = null;
- URL url = null;
- try {
- httpConnection = (HttpURLConnection) connection;
- url = httpConnection.getURL();
- result = httpConnection.getResponseCode();
- } catch (IOException e) {
- // if an error occured, try again
- result = httpConnection.getResponseCode();
- }
- if (result != HttpURLConnection.HTTP_OK) {
- String serverMsg = httpConnection.getResponseMessage();
+ int result = response.getStatusCode();
+
+ if (result != IStatusCodes.HTTP_OK) {
+ String serverMsg = response.getStatusMessage();
throw new IOException(Policy.bind("ContentReference.HttpNok", new Object[] { new Integer(result), serverMsg, url })); //$NON-NLS-1$
}
- }
}
public static class StreamConsumer extends Thread {
@@ -536,7 +525,7 @@
List optionalChildrenToInstall = new ArrayList();
for (int i = 0; i < children.length; i++) {
IFeatureReference optionalFeature = children[i];
- if (!optionalFeature.isOptional()) {
+ if (!UpdateManagerUtils.isOptional(optionalFeature)) {
optionalChildrenToInstall.add(optionalFeature);
} else {
for (int j = 0; j < optionalfeatures.length; j++) {
@@ -570,4 +559,43 @@
return IImport.RULE_PERFECT;
return ruleInt;
}
+
+ /**
+ * Method isOptional.
+ * @param featureReference
+ * @return boolean
+ */
+ public static boolean isOptional(IFeatureReference featureReference) {
+ if (featureReference==null) return false;
+ if (featureReference instanceof IIncludedFeatureReference){
+ return ((IIncludedFeatureReference)featureReference).isOptional();
+ }
+ return false;
+ }
+
+ /**
+ *
+ */
+ public static boolean isValidEnvironment(IPlatformEnvironment candidate) {
+ String os = candidate.getOS();
+ String ws = candidate.getWS();
+ String arch = candidate.getOSArch();
+ if (os!=null && isMatching(os, BootLoader.getOS())==false) return false;
+ if (ws!=null && isMatching(ws, BootLoader.getWS())==false) return false;
+ if (arch!=null && isMatching(arch, BootLoader.getOSArch())==false) return false;
+ return true;
+ }
+
+ /**
+ *
+ */
+ private static boolean isMatching(String values, String current) {
+ StringTokenizer stok = new StringTokenizer(values, ",");
+ while (stok.hasMoreTokens()) {
+ String token = stok.nextToken();
+ if (token.equalsIgnoreCase(current)) return true;
+ }
+ return false;
+ }
+
}
\ No newline at end of file
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/model/InstallChangeParser.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/model/InstallChangeParser.java
index 1160408..708a065 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/model/InstallChangeParser.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/model/InstallChangeParser.java
@@ -145,7 +145,7 @@
URL featureURL = new URL(siteURL, featureUrlPath);
if (featureURL != null) {
- FeatureReference ref = new FeatureReference();
+ SiteFeatureReference ref = new SiteFeatureReference();
ref.setSite(currentSite);
ref.setURL(featureURL);
change.addReference(ref);
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/model/InstallConfigurationModel.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/model/InstallConfigurationModel.java
index a279693..d7f6e59 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/model/InstallConfigurationModel.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/model/InstallConfigurationModel.java
@@ -3,6 +3,7 @@
* (c) Copyright IBM Corp. 2000, 2002.
* All Rights Reserved.
*/
+import java.io.*;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.MalformedURLException;
@@ -27,7 +28,8 @@
public void initialize() throws CoreException {
try {
URL resolvedURL = URLEncoder.encode(getURL());
- new InstallConfigurationParser(resolvedURL.openStream(), this);
+ InputStream in = UpdateManagerPlugin.getPlugin().get(resolvedURL).getInputStream();
+ new InstallConfigurationParser(in, this);
} catch (FileNotFoundException exception) {
UpdateManagerPlugin.warn(getLocationURLString() + " does not exist, The local site is not in synch with the file system and is pointing to a file that doesn't exist.",exception); //$NON-NLS-1$
throw Utilities.newCoreException(Policy.bind("InstallConfiguration.ErrorDuringFileAccess",getLocationURLString()), exception); //$NON-NLS-1$
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/model/InstallConfigurationParser.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/model/InstallConfigurationParser.java
index b91900c..d8104c9 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/model/InstallConfigurationParser.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/model/InstallConfigurationParser.java
@@ -194,7 +194,7 @@
boolean configured = configuredString.trim().equalsIgnoreCase("true") ? true : false; //$NON-NLS-1$
if (url != null) {
- FeatureReference ref = new FeatureReference();
+ SiteFeatureReference ref = new SiteFeatureReference();
ref.setSite((ISite) configSite.getSiteModel());
ref.setURL(url);
if (ref != null)
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/security/JarVerifier.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/security/JarVerifier.java
index 5b81334..e8b8722 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/security/JarVerifier.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/security/JarVerifier.java
@@ -61,7 +61,7 @@
while (listOfKeystoreHandles.hasNext()) {
try {
handle = listOfKeystoreHandles.next();
- in = handle.getLocation().openStream();
+ in = UpdateManagerPlugin.getPlugin().get(handle.getLocation()).getInputStream();;
try {
keystore = KeyStore.getInstance(handle.getType());
keystore.load(in, null); // no password
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/security/KeyStores.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/security/KeyStores.java
index b68c144..dcf5097 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/security/KeyStores.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/security/KeyStores.java
@@ -130,7 +130,7 @@
try {
URL url = new URL(location);
- in = url.openStream();
+ in = UpdateManagerPlugin.getPlugin().get(url).getInputStream();;
Reader reader = new InputStreamReader(in);
int result = reader.read(buff);
StringBuffer contentBuff = new StringBuffer();
diff --git a/update/org.eclipse.update.examples/src/org/eclipse/update/examples/buildzip/BuildZipSiteFactory.java b/update/org.eclipse.update.examples/src/org/eclipse/update/examples/buildzip/BuildZipSiteFactory.java
index c59ad05..2bb681d 100644
--- a/update/org.eclipse.update.examples/src/org/eclipse/update/examples/buildzip/BuildZipSiteFactory.java
+++ b/update/org.eclipse.update.examples/src/org/eclipse/update/examples/buildzip/BuildZipSiteFactory.java
@@ -67,7 +67,7 @@
File[] zips = file.listFiles(filter);
// create a reference for each matching zip
- FeatureReferenceModel ref = null;
+ SiteFeatureReferenceModel ref = null;
for (int i = 0; zips != null && i < zips.length; i++) {
ref = createFeatureReferenceModel();
ref.setType("org.eclipse.update.examples.zip");
diff --git a/update/org.eclipse.update.tests.core/data/ExecutableFeaturePackagedSite/data/features/feature3/feature.xml b/update/org.eclipse.update.tests.core/data/ExecutableFeaturePackagedSite/data/features/feature3/feature.xml
index 4122e82..767dae9 100644
--- a/update/org.eclipse.update.tests.core/data/ExecutableFeaturePackagedSite/data/features/feature3/feature.xml
+++ b/update/org.eclipse.update.tests.core/data/ExecutableFeaturePackagedSite/data/features/feature3/feature.xml
@@ -8,5 +8,5 @@
<discovery label="Discovery 1" url="http://www.eclipse.org"/>
<discovery label="Discovery 2" url="http://www.eclipse.org"/>
</url>
- <plugin download-size="1500" id="org.eclipse.update.core.tests.feature1.plugin1" install-size="1000" fragment="false" nl="us" os="OS_WIN32" version="3.5.6" ws="WS_WIN32"/>
+ <plugin download-size="1500" id="org.eclipse.update.core.tests.feature1.plugin1" install-size="1000" fragment="false" nl="en" os="WIN32,LINUX" version="3.5.6" ws="WIN32,LINUX,GTK"/>
</feature>
\ No newline at end of file
diff --git a/update/org.eclipse.update.tests.core/data/ExecutableFeaturePackagedSite/data2/features/feature3/feature.xml b/update/org.eclipse.update.tests.core/data/ExecutableFeaturePackagedSite/data2/features/feature3/feature.xml
index c7d9226..b406d65 100644
--- a/update/org.eclipse.update.tests.core/data/ExecutableFeaturePackagedSite/data2/features/feature3/feature.xml
+++ b/update/org.eclipse.update.tests.core/data/ExecutableFeaturePackagedSite/data2/features/feature3/feature.xml
@@ -8,5 +8,5 @@
<discovery label="Discovery 1" url="http://www.eclipse.org"/>
<discovery label="Discovery 2" url="http://www.eclipse.org"/>
</url>
- <plugin download-size="1500" id="org.eclipse.update.plugin1" install-size="1000" fragment="false" nl="us" os="OS_WIN32" version="1.1.1" ws="WS_WIN32"/>
+ <plugin download-size="1500" id="org.eclipse.update.plugin1" install-size="1000" fragment="false" nl="en,fr" os="WIN32,LINUX" version="1.1.1" ws="WIN32,GTK,MOTIF"/>
</feature>
\ No newline at end of file
diff --git a/update/org.eclipse.update.tests.core/data/ExecutableFeaturePackagedSite/data2/features/helpFeature.jar b/update/org.eclipse.update.tests.core/data/ExecutableFeaturePackagedSite/data2/features/helpFeature.jar
index 9809713..2d1ed77 100644
--- a/update/org.eclipse.update.tests.core/data/ExecutableFeaturePackagedSite/data2/features/helpFeature.jar
+++ b/update/org.eclipse.update.tests.core/data/ExecutableFeaturePackagedSite/data2/features/helpFeature.jar
Binary files differ
diff --git a/update/org.eclipse.update.tests.core/data/ExecutableFeaturePackagedSite/data2/features/org.eclipse.pde.feature_1.0.0.jar b/update/org.eclipse.update.tests.core/data/ExecutableFeaturePackagedSite/data2/features/org.eclipse.pde.feature_1.0.0.jar
index 844a4d7..7e23cab 100644
--- a/update/org.eclipse.update.tests.core/data/ExecutableFeaturePackagedSite/data2/features/org.eclipse.pde.feature_1.0.0.jar
+++ b/update/org.eclipse.update.tests.core/data/ExecutableFeaturePackagedSite/data2/features/org.eclipse.pde.feature_1.0.0.jar
Binary files differ
diff --git a/update/org.eclipse.update.tests.core/data/Site with space/features space/helpFeature.jar b/update/org.eclipse.update.tests.core/data/Site with space/features space/helpFeature.jar
index 9809713..161abde 100644
--- a/update/org.eclipse.update.tests.core/data/Site with space/features space/helpFeature.jar
+++ b/update/org.eclipse.update.tests.core/data/Site with space/features space/helpFeature.jar
Binary files differ
diff --git a/update/org.eclipse.update.tests.core/data/Site with space/features space/space feature.jar b/update/org.eclipse.update.tests.core/data/Site with space/features space/space feature.jar
index e5cb2d5..173fbf7 100644
--- a/update/org.eclipse.update.tests.core/data/Site with space/features space/space feature.jar
+++ b/update/org.eclipse.update.tests.core/data/Site with space/features space/space feature.jar
Binary files differ
diff --git a/update/org.eclipse.update.tests.core/data/Site with space/install/features space/feature3/feature.xml b/update/org.eclipse.update.tests.core/data/Site with space/install/features space/feature3/feature.xml
index c7d9226..e82ec30 100644
--- a/update/org.eclipse.update.tests.core/data/Site with space/install/features space/feature3/feature.xml
+++ b/update/org.eclipse.update.tests.core/data/Site with space/install/features space/feature3/feature.xml
@@ -8,5 +8,5 @@
<discovery label="Discovery 1" url="http://www.eclipse.org"/>
<discovery label="Discovery 2" url="http://www.eclipse.org"/>
</url>
- <plugin download-size="1500" id="org.eclipse.update.plugin1" install-size="1000" fragment="false" nl="us" os="OS_WIN32" version="1.1.1" ws="WS_WIN32"/>
+ <plugin download-size="1500" id="org.eclipse.update.plugin1" install-size="1000" fragment="false" nl="en,fr" os="WIN32,LINUX" version="1.1.1" ws="WIN32,MOTIF,GTK"/>
</feature>
\ No newline at end of file
diff --git a/update/org.eclipse.update.tests.core/data/parsertests/site2.xml b/update/org.eclipse.update.tests.core/data/parsertests/site2.xml
index 83c23f2..007550e 100644
--- a/update/org.eclipse.update.tests.core/data/parsertests/site2.xml
+++ b/update/org.eclipse.update.tests.core/data/parsertests/site2.xml
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<site>
- <feature id="com.ibm.jdt" url="http://www.eclipse.org/feature3" version="1.0.0">
- </feature>
+ <feature id="com.ibm.jdt" url="http://www.not-eclipse.org/feature3" version="1.0.0"/>
</site>
\ No newline at end of file
diff --git a/update/org.eclipse.update.tests.core/data/testAPI/features/feature3/feature.xml b/update/org.eclipse.update.tests.core/data/testAPI/features/feature3/feature.xml
index 3141af8..f878d60 100644
--- a/update/org.eclipse.update.tests.core/data/testAPI/features/feature3/feature.xml
+++ b/update/org.eclipse.update.tests.core/data/testAPI/features/feature3/feature.xml
@@ -8,5 +8,5 @@
<discovery label="Discovery 1" url="http://www.eclipse.org"/>
<discovery label="Discovery 2" url="http://www.eclipse.org"/>
</url>
- <plugin download-size="1500" id="org.eclipse.update.plugin1" install-size="1000" fragment="false" nl="us" os="OS_WIN32" version="1.1.1" ws="WS_WIN32"/>
+ <plugin download-size="1500" id="org.eclipse.update.plugin1" install-size="1000" fragment="false" nl="us" os="WIN32,LINUX" version="1.1.1"/>
</feature>
\ No newline at end of file
diff --git a/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/api/TestDefaultExecutableFeatureAPI.java b/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/api/TestDefaultExecutableFeatureAPI.java
index b6249fb..8ddd809 100644
--- a/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/api/TestDefaultExecutableFeatureAPI.java
+++ b/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/api/TestDefaultExecutableFeatureAPI.java
@@ -33,7 +33,7 @@
ISite site = SiteManager.getSite(SOURCE_FILE_SITE);
URL url = UpdateManagerUtils.getURL(site.getURL(),"testAPI/"+Site.DEFAULT_INSTALLED_FEATURE_PATH+"feature3/",null);
- FeatureReference ref = new FeatureReference();
+ SiteFeatureReference ref = new SiteFeatureReference();
ref.setSite(site);
ref.setURL(url);
IFeature feature = ref.getFeature();
diff --git a/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/api/TestLocalSiteAPI.java b/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/api/TestLocalSiteAPI.java
index 3cf093b..2eb8bb2 100644
--- a/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/api/TestLocalSiteAPI.java
+++ b/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/api/TestLocalSiteAPI.java
@@ -66,7 +66,7 @@
}
if (!found) fail("cannot find category 'category' in site");
- IFeatureReference ref = new FeatureReference();
+ ISiteFeatureReference ref = new SiteFeatureReference();
ref.setSite(site);
ref.addCategory(category);
categories = ref.getCategories();
diff --git a/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/api/TestNestedFeatureAPI.java b/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/api/TestNestedFeatureAPI.java
index affffd4..653743a 100644
--- a/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/api/TestNestedFeatureAPI.java
+++ b/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/api/TestNestedFeatureAPI.java
@@ -32,7 +32,7 @@
Site.DEFAULT_INSTALLED_FEATURE_PATH
+ "rootfeature.jar",
null);
- FeatureReference ref = new FeatureReference();
+ SiteFeatureReference ref = new SiteFeatureReference();
ref.setSite(site);
ref.setURL(url);
ref.setType(ISite.DEFAULT_PACKAGED_FEATURE_TYPE);
@@ -53,7 +53,7 @@
Site.DEFAULT_INSTALLED_FEATURE_PATH
+ "org.eclipse.update.core.tests.childrenfeature_2.0.0.jar",
null);
- FeatureReference ref = new FeatureReference();
+ SiteFeatureReference ref = new SiteFeatureReference();
ref.setSite(site);
ref.setURL(url);
ref.setType(ISite.DEFAULT_PACKAGED_FEATURE_TYPE);
@@ -88,7 +88,7 @@
Site.DEFAULT_INSTALLED_FEATURE_PATH
+ "rootfeature.jar",
null);
- FeatureReference ref = new FeatureReference();
+ SiteFeatureReference ref = new SiteFeatureReference();
ref.setSite(site);
ref.setURL(url);
ref.setType(ISite.DEFAULT_PACKAGED_FEATURE_TYPE);
@@ -109,7 +109,7 @@
Site.DEFAULT_INSTALLED_FEATURE_PATH
+ "childrenfeature.jar",
null);
- FeatureReference ref = new FeatureReference();
+ SiteFeatureReference ref = new SiteFeatureReference();
ref.setSite(site);
ref.setURL(url);
ref.setType(ISite.DEFAULT_PACKAGED_FEATURE_TYPE);
@@ -144,7 +144,7 @@
Site.DEFAULT_INSTALLED_FEATURE_PATH
+ "rootfeature.jar",
null);
- FeatureReference ref = new FeatureReference();
+ SiteFeatureReference ref = new SiteFeatureReference();
ref.setSite(site);
ref.setURL(url);
ref.setType(ISite.DEFAULT_PACKAGED_FEATURE_TYPE);
@@ -165,7 +165,7 @@
Site.DEFAULT_INSTALLED_FEATURE_PATH
+ "childrenfeature.jar",
null);
- FeatureReference ref = new FeatureReference();
+ SiteFeatureReference ref = new SiteFeatureReference();
ref.setSite(site);
ref.setURL(url);
ref.setType(ISite.DEFAULT_PACKAGED_FEATURE_TYPE);
diff --git a/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/api/TestSiteManagerAPI.java b/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/api/TestSiteManagerAPI.java
index e17e1d5..0a41260 100644
--- a/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/api/TestSiteManagerAPI.java
+++ b/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/api/TestSiteManagerAPI.java
@@ -34,6 +34,8 @@
fail("Connected to ftp://255.255.255.255/, should not happen");
} catch (CoreException e){
// expected
+ } catch (IllegalArgumentException e){
+ // expected as the version of the WebDav HTTP Connection returns so
}
}
diff --git a/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/implementation/SiteFTP.java b/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/implementation/SiteFTP.java
index db01749..038acd4 100644
--- a/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/implementation/SiteFTP.java
+++ b/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/implementation/SiteFTP.java
@@ -29,7 +29,7 @@
/*
* @see ISite#getFeatureReferences()
*/
- public IFeatureReference[] getFeatureReferences() {
+ public ISiteFeatureReference[] getFeatureReferences() {
return null;
}
@@ -202,7 +202,7 @@
/*
* @see ISite#getFeatureReference(IFeature)
*/
- public IFeatureReference getFeatureReference(IFeature feature) {
+ public ISiteFeatureReference getFeatureReference(IFeature feature) {
return null;
}
diff --git a/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/model/SiteMain.java b/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/model/SiteMain.java
index 043c336..61194ab 100644
--- a/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/model/SiteMain.java
+++ b/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/model/SiteMain.java
@@ -5,6 +5,7 @@
import java.io.PrintWriter;
import java.net.URL;
+import org.eclipse.update.core.SiteFeatureReferenceModel;
import org.eclipse.update.core.model.*;
import org.eclipse.update.core.model.ArchiveReferenceModel;
import org.eclipse.update.core.model.DefaultSiteParser;
@@ -95,7 +96,7 @@
getIndent(level+1);
w.println("");
- FeatureReferenceModel[] features = site.getFeatureReferenceModels();
+ SiteFeatureReferenceModel[] features = site.getFeatureReferenceModels();
for (int i=0; i<features.length; i++) {
w.println(in+"<feature");
w.println(in+" "+"type=\""+features[i].getType()+"\"");
@@ -135,7 +136,7 @@
}
}
- private static void writeCategories(PrintWriter w, int level, FeatureReferenceModel feature) {
+ private static void writeCategories(PrintWriter w, int level, SiteFeatureReferenceModel feature) {
String in = getIndent(level);
String[] cat = feature.getCategoryNames();
for (int i=0; i<cat.length; i++) {
diff --git a/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/parser/TestCategories.java b/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/parser/TestCategories.java
index 55123cd..913519f 100644
--- a/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/parser/TestCategories.java
+++ b/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/parser/TestCategories.java
@@ -6,7 +6,7 @@
import java.net.URL;
import org.eclipse.update.core.*;
-import org.eclipse.update.core.FeatureReference;
+import org.eclipse.update.core.SiteFeatureReference;
import org.eclipse.update.tests.UpdateManagerTestCase;
public class TestCategories extends UpdateManagerTestCase {
@@ -22,7 +22,7 @@
URL remoteUrl = new URL(SOURCE_FILE_SITE + "xmls/site1/");
ISite remoteSite = SiteManager.getSite(remoteUrl);
- IFeatureReference[] feature = remoteSite.getFeatureReferences();
+ ISiteFeatureReference[] feature = remoteSite.getFeatureReferences();
//ICategory[] categories = remoteSite.getCategories();
ICategory featureCategory = feature[0].getCategories()[0];
diff --git a/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/parser/TestFeatureParse.java b/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/parser/TestFeatureParse.java
index 0feb3ff..9e4e6fd 100644
--- a/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/parser/TestFeatureParse.java
+++ b/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/parser/TestFeatureParse.java
Binary files differ
diff --git a/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/parser/TestSiteParse.java b/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/parser/TestSiteParse.java
index 12a307e..5cf7e79 100644
--- a/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/parser/TestSiteParse.java
+++ b/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/parser/TestSiteParse.java
@@ -166,11 +166,11 @@
assertTrue("Wrong number of features", featureRef.length == 1);
assertTrue("Wrong number of archives", archives.length == 0);
- try {
+ try {
((FeatureReference)featureRef[0]).getFeature();
} catch (CoreException e){
Throwable e1 = e.getStatus().getException();
- if (!e1.getMessage().endsWith("www.eclipse.org/feature3/feature.xml")){
+ if (e1.getMessage().indexOf("not-eclipse")==-1){
throw e;
}
}
@@ -211,7 +211,7 @@
remoteSite.resolve(remoteURL, null);
FeatureReferenceModel[] featureRef = remoteSite.getFeatureReferenceModels();
- ICategory[] categories = ((FeatureReference)featureRef[0]).getCategories();
+ ICategory[] categories = ((SiteFeatureReference)featureRef[0]).getCategories();
assertTrue(categories.length==0);
}
diff --git a/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/regularInstall/TestExecutableInstall.java b/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/regularInstall/TestExecutableInstall.java
index e06247a..7557bf6 100644
--- a/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/regularInstall/TestExecutableInstall.java
+++ b/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/regularInstall/TestExecutableInstall.java
Binary files differ
diff --git a/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/regularInstall/TestExecutablePackagedInstall.java b/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/regularInstall/TestExecutablePackagedInstall.java
index a25a3e9..3d258fd 100644
--- a/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/regularInstall/TestExecutablePackagedInstall.java
+++ b/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/regularInstall/TestExecutablePackagedInstall.java
@@ -50,7 +50,7 @@
// verify
String site = localSite.getURL().getFile();
- IPluginEntry[] entries = remoteFeature.getPluginEntries();
+ IPluginEntry[] entries = remoteFeature.getRawPluginEntries();
assertTrue("no plugins entry", (entries != null && entries.length != 0));
String pluginName = entries[0].getVersionedIdentifier().toString();
File pluginFile = new File(site, Site.DEFAULT_PLUGIN_PATH + pluginName);
@@ -114,7 +114,7 @@
// verify
String site = localSite.getURL().getFile();
- IPluginEntry[] entries = remoteFeature.getPluginEntries();
+ IPluginEntry[] entries = remoteFeature.getRawPluginEntries();
assertTrue("no plugins entry", (entries != null && entries.length != 0));
String pluginName = entries[0].getVersionedIdentifier().toString();
File pluginFile = new File(site, Site.DEFAULT_PLUGIN_PATH + pluginName);
diff --git a/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/regularInstall/TestInstall.java b/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/regularInstall/TestInstall.java
index b253109..b62788f 100644
--- a/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/regularInstall/TestInstall.java
+++ b/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/regularInstall/TestInstall.java
@@ -51,7 +51,7 @@
private IFeature getFeature1(ISite site)
throws MalformedURLException, CoreException {
- FeatureReference ref = new FeatureReference();
+ SiteFeatureReference ref = new SiteFeatureReference();
ref.setSite(site);
ref.setURLString("features/org.eclipse.update.core.tests.feature1_1.0.4.jar");
ref.setType(getDefaultInstallableFeatureType());
@@ -197,7 +197,7 @@
((ConfiguredSite)site).isUpdatable(true);
site.install(remoteFeature, null, null);
- IPluginEntry[] entries = remoteFeature.getPluginEntries();
+ IPluginEntry[] entries = remoteFeature.getRawPluginEntries();
assertTrue("no plugins entry", (entries != null && entries.length != 0));
String sitePath = site.getSite().getURL().getFile();
diff --git a/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/regularInstall/TestInstallURLSIteXML.java b/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/regularInstall/TestInstallURLSIteXML.java
index 083f8c0..470d7e8 100644
--- a/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/regularInstall/TestInstallURLSIteXML.java
+++ b/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/regularInstall/TestInstallURLSIteXML.java
@@ -51,7 +51,7 @@
private IFeature getFeature1(ISite site)
throws MalformedURLException, CoreException {
- FeatureReference ref = new FeatureReference();
+ SiteFeatureReference ref = new SiteFeatureReference();
ref.setSite(site);
ref.setURLString("features/org.eclipse.update.core.tests.feature1_1.0.4.jar");
ref.setType(ISite.DEFAULT_PACKAGED_FEATURE_TYPE);
@@ -216,7 +216,7 @@
((ConfiguredSite)site).isUpdatable(true);
site.install(remoteFeature, null, null);
- IPluginEntry[] entries = remoteFeature.getPluginEntries();
+ IPluginEntry[] entries = remoteFeature.getRawPluginEntries();
assertTrue("no plugins entry", (entries != null && entries.length != 0));
String sitePath = site.getSite().getURL().getFile();
diff --git a/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/regularInstall/TestSpaceInInstall.java b/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/regularInstall/TestSpaceInInstall.java
index 7fa469a..d05be72 100644
--- a/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/regularInstall/TestSpaceInInstall.java
+++ b/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/regularInstall/TestSpaceInInstall.java
@@ -9,7 +9,6 @@
import org.eclipse.update.core.*;
import org.eclipse.update.internal.core.*;
import org.eclipse.update.tests.UpdateManagerTestCase;
-import org.eclipse.update.tests.UpdateTestsPlugin;
public class TestSpaceInInstall extends UpdateManagerTestCase {
/**
@@ -54,7 +53,7 @@
// verify
String site = testURL.getFile();
- IPluginEntry[] entries = remoteFeature.getPluginEntries();
+ IPluginEntry[] entries = remoteFeature.getRawPluginEntries();
assertTrue("no plugins entry", (entries != null && entries.length != 0));
String pluginName = entries[0].getVersionedIdentifier().toString();
File pluginFile = new File(site, Site.DEFAULT_PLUGIN_PATH + pluginName);
@@ -108,7 +107,7 @@
// verify
String site = TARGET_FILE_SITE.getFile();
- IPluginEntry[] entries = remoteFeature.getPluginEntries();
+ IPluginEntry[] entries = remoteFeature.getRawPluginEntries();
assertTrue("no plugins entry", (entries != null && entries.length != 0));
String pluginName = entries[0].getVersionedIdentifier().toString();
File pluginFile = new File(site, Site.DEFAULT_PLUGIN_PATH + pluginName);
diff --git a/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/regularRemove/TestRemove.java b/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/regularRemove/TestRemove.java
index 39b34eb..6f13f6d 100644
--- a/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/regularRemove/TestRemove.java
+++ b/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/regularRemove/TestRemove.java
@@ -47,7 +47,7 @@
private IFeature getFeature1(ISite site)
throws MalformedURLException, CoreException {
//URL url = UpdateManagerUtils.getURL(site.getURL(), "features/org.eclipse.update.core.tests.feature1_1.0.4.jar", null);
- FeatureReference ref = new FeatureReference();
+ SiteFeatureReference ref = new SiteFeatureReference();
ref.setSite(site);
ref.setURLString("features/org.eclipse.update.core.tests.feature1_1.0.4.jar");
ref.setType(ISite.DEFAULT_PACKAGED_FEATURE_TYPE);
diff --git a/update/org.eclipse.update.tests.core/webserver/Site with space/features space/helpFeature.jar b/update/org.eclipse.update.tests.core/webserver/Site with space/features space/helpFeature.jar
index 9809713..6369149 100644
--- a/update/org.eclipse.update.tests.core/webserver/Site with space/features space/helpFeature.jar
+++ b/update/org.eclipse.update.tests.core/webserver/Site with space/features space/helpFeature.jar
Binary files differ
diff --git a/update/org.eclipse.update.tests.core/webserver/Site with space/features space/space feature.jar b/update/org.eclipse.update.tests.core/webserver/Site with space/features space/space feature.jar
index 5039d7b..27e81eb 100644
--- a/update/org.eclipse.update.tests.core/webserver/Site with space/features space/space feature.jar
+++ b/update/org.eclipse.update.tests.core/webserver/Site with space/features space/space feature.jar
Binary files differ
diff --git a/update/org.eclipse.update.tests.core/webserver/UpdateManager/features/helpFeature.jar b/update/org.eclipse.update.tests.core/webserver/UpdateManager/features/helpFeature.jar
index 9809713..aec67d4 100644
--- a/update/org.eclipse.update.tests.core/webserver/UpdateManager/features/helpFeature.jar
+++ b/update/org.eclipse.update.tests.core/webserver/UpdateManager/features/helpFeature.jar
Binary files differ
diff --git a/update/org.eclipse.update.tests.core/webserver/UpdateManager/features/org.eclipse.pde.feature_1.0.0.jar b/update/org.eclipse.update.tests.core/webserver/UpdateManager/features/org.eclipse.pde.feature_1.0.0.jar
index b5f241a..870b40a 100644
--- a/update/org.eclipse.update.tests.core/webserver/UpdateManager/features/org.eclipse.pde.feature_1.0.0.jar
+++ b/update/org.eclipse.update.tests.core/webserver/UpdateManager/features/org.eclipse.pde.feature_1.0.0.jar
Binary files differ
diff --git a/update/org.eclipse.update.ui/src/org/eclipse/update/internal/ui/UpdateUIPlugin.java b/update/org.eclipse.update.ui/src/org/eclipse/update/internal/ui/UpdateUIPlugin.java
index 9c79101..6fae4b9 100644
--- a/update/org.eclipse.update.ui/src/org/eclipse/update/internal/ui/UpdateUIPlugin.java
+++ b/update/org.eclipse.update.ui/src/org/eclipse/update/internal/ui/UpdateUIPlugin.java
@@ -22,6 +22,7 @@
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.update.configuration.*;
import org.eclipse.update.core.*;
+import org.eclipse.update.internal.core.UpdateManagerPlugin;
import org.eclipse.update.internal.model.SiteLocalModel;
import org.eclipse.update.internal.ui.forms.UpdateAdapterFactory;
import org.eclipse.update.internal.ui.model.*;
@@ -29,7 +30,7 @@
import org.eclipse.update.internal.ui.parts.SWTUtil;
import org.eclipse.update.internal.ui.preferences.MainPreferencePage;
import org.eclipse.update.internal.ui.preferences.UpdateColors;
-import org.eclipse.update.internal.ui.security.AuthorizationDatabase;
+import org.eclipse.update.internal.ui.security.UpdateManagerAuthenticator;
/**
* The main plugin class to be used in the desktop.
@@ -42,7 +43,7 @@
private ResourceBundle resourceBundle;
private UpdateAdapterFactory adapterFactory;
private UpdateModel model;
- private AuthorizationDatabase database;
+ private UpdateManagerAuthenticator authenticator;
private AboutInfo aboutInfo;
/**
@@ -139,8 +140,8 @@
IAdapterManager manager = Platform.getAdapterManager();
adapterFactory = new UpdateAdapterFactory();
manager.registerAdapters(adapterFactory, UIModelObject.class);
- database = new AuthorizationDatabase();
- Authenticator.setDefault(database);
+ authenticator = new UpdateManagerAuthenticator();
+ UpdateManagerPlugin.getPlugin().setDefaultAuthenticator(authenticator);
int historyPref = getPluginPreferences().getInt(MainPreferencePage.P_HISTORY_SIZE);
if(historyPref>0){
SiteLocalModel.DEFAULT_HISTORY= historyPref;
@@ -301,14 +302,6 @@
return null;
}
- /**
- * Gets the database.
- * @return Returns a AuthorizationDatabase
- */
- public AuthorizationDatabase getDatabase() {
- return database;
- }
-
public static URL getOriginatingURL(String id) {
IDialogSettings section = getOriginatingURLSection();
String value=section.get(id);
@@ -408,4 +401,12 @@
MainPreferencePage.EQUIVALENT_VALUE);
UpdateColors.setDefaults(store);
}
+ /**
+ * Returns the authenticator.
+ * @return UpdateManagerAuthenticator
+ */
+ public UpdateManagerAuthenticator getAuthenticator() {
+ return authenticator;
+ }
+
}
\ No newline at end of file
diff --git a/update/org.eclipse.update.ui/src/org/eclipse/update/internal/ui/security/AuthorizationDatabase.java b/update/org.eclipse.update.ui/src/org/eclipse/update/internal/ui/security/AuthorizationDatabase.java
deleted file mode 100644
index 0afce4b..0000000
--- a/update/org.eclipse.update.ui/src/org/eclipse/update/internal/ui/security/AuthorizationDatabase.java
+++ /dev/null
@@ -1,194 +0,0 @@
-package org.eclipse.update.internal.ui.security;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import java.net.*;
-import java.util.*;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.update.core.Utilities;
-import org.eclipse.update.internal.core.UpdateManagerPlugin;
-
-/**
- * A transient database that remembers information, such as usernames and
- * passwords. The information is stored in memory only and is discarted
- * when the Plaform shuts down.
- */
-public class AuthorizationDatabase extends Authenticator {
-
- private InetAddress requestingSite;
- private int requestingPort;
- private String requestingProtocol;
- private String requestingPrompt;
- private String requestingScheme;
- private PasswordAuthentication savedPasswordAuthentication;
-
- // fields needed for caching the password
- public static final String INFO_PASSWORD = "org.eclipse.update.internal.ui.security.password"; //$NON-NLS-1$
- public static final String INFO_USERNAME = "org.eclipse.update.internal.ui.security.username"; //$NON-NLS-1$
- public static final String AUTH_SCHEME = ""; //$NON-NLS-1$
-
- /**
- * The Map containing the userid and password
- */
- private Map result = new Hashtable();
-
- /**
- *
- */
- public void addAuthenticationInfo(URL serverUrl, String realm, String scheme, Map info) {
- try {
- Platform.addAuthorizationInfo(serverUrl, realm, scheme, info);
- } catch (CoreException e) {
- UpdateManagerPlugin.getPlugin().getLog().log(e.getStatus());
- }
- }
-
- /**
- *
- */
- public Map getAuthenticationInfo(URL serverUrl, String realm, String scheme) {
-
- return Platform.getAuthorizationInfo(serverUrl, realm, scheme);
- }
-
- /**
- *
- */
- public Map requestAuthenticationInfo(final URL resourceUrl, final String realm, final String scheme) {
-
- result = new Hashtable();
- if (scheme != null && scheme.equalsIgnoreCase("Basic")) {
-
- Display disp = Display.getCurrent();
- if (disp != null) {
- promptForPassword(resourceUrl, realm, result);
- } else {
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- promptForPassword(resourceUrl, realm, result);
- }
- });
- };
- }
- return result;
- }
-
- public void reset(){
- requestingPort = 0;
- requestingPrompt = null;
- requestingProtocol = null;
- requestingScheme = null;
- requestingSite = null;
- }
-
- /**
- *
- */
- private void promptForPassword(URL resourceUrl, String realm, Map info) {
-
- Shell shell = new Shell();
- UserValidationDialog ui = new UserValidationDialog(shell, resourceUrl, realm, ""); //$NON-NLS-1$
- ui.setUsernameMutable(true);
- ui.setBlockOnOpen(true);
- ui.open();
-
- if (ui.getReturnCode() != ui.CANCEL) {
- info.put(INFO_USERNAME, ui.getUserid());
- info.put(INFO_PASSWORD, ui.getPassword());
- }
- shell.dispose();
-
- }
- /*
- * @see Authenticator#getPasswordAuthentication()
- */
- protected PasswordAuthentication getPasswordAuthentication() {
-
- try {
- URL url = new URL(getRequestingProtocol(), getRequestingSite().getHostName(), getRequestingPort(), ""); //$NON-NLS-1$
- return retrievePasswordAuthentication(url);
- } catch (MalformedURLException e) {
- IStatus status = Utilities.newCoreException("",e).getStatus();
- UpdateManagerPlugin.getPlugin().getLog().log(status);
- }
- return new PasswordAuthentication("", new char[] { ' ' }); //$NON-NLS-1$
- }
-
- /*
- *
- */
- private PasswordAuthentication retrievePasswordAuthentication(URL url) {
-
- Map map = null;
- String username = null;
- String password = null;
-
- if (equalsPreviousRequest()) {
- // same request, the userid/password was wrong
- // or user cancelled. force a refresh
- if (savedPasswordAuthentication != null)
- // only prompt if the user didn't cancel
- map = requestAuthenticationInfo(url, requestingPrompt, requestingScheme);
- } else {
- // save state
- requestingPort = getRequestingPort();
- requestingPrompt = getRequestingPrompt();
- requestingProtocol = getRequestingProtocol();
- requestingScheme = getRequestingScheme();
- requestingSite = getRequestingSite();
- map = Platform.getAuthorizationInfo(url, requestingPrompt, requestingScheme);
- if (map == null) {
- map = requestAuthenticationInfo(url, requestingPrompt, requestingScheme);
- }
- }
-
- if (map != null) {
- username = (String) map.get(INFO_USERNAME);
- password = (String) map.get(INFO_PASSWORD);
- }
-
- if (username!=null && password!=null){
- savedPasswordAuthentication = new PasswordAuthentication(username, password.toCharArray());
- } else {
- savedPasswordAuthentication = null;
- }
-
- return savedPasswordAuthentication;
-
- }
-
- private boolean equalsPreviousRequest() {
-
- if (requestingPort != getRequestingPort())
- return false;
-
- if (requestingPrompt != null && !requestingPrompt.equals(getRequestingPrompt()))
- return false;
- if (requestingPrompt == null && getRequestingPrompt() != null)
- return false;
-
- if (requestingProtocol != null && !requestingProtocol.equals(getRequestingProtocol()))
- return false;
- if (requestingProtocol == null && getRequestingProtocol() != null)
- return false;
-
- if (requestingScheme != null && !requestingScheme.equals(getRequestingScheme()))
- return false;
- if (requestingScheme == null && getRequestingScheme() != null)
- return false;
-
- if (requestingSite != null && !requestingSite.equals(getRequestingSite()))
- return false;
- if (requestingSite == null && getRequestingSite() != null)
- return false;
-
- return true;
- }
-
-}
\ No newline at end of file
diff --git a/update/org.eclipse.update.ui/src/org/eclipse/update/internal/ui/security/UpdateManagerAuthenticator.java b/update/org.eclipse.update.ui/src/org/eclipse/update/internal/ui/security/UpdateManagerAuthenticator.java
new file mode 100644
index 0000000..5f578ec
--- /dev/null
+++ b/update/org.eclipse.update.ui/src/org/eclipse/update/internal/ui/security/UpdateManagerAuthenticator.java
@@ -0,0 +1,207 @@
+package org.eclipse.update.internal.ui.security;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2002.
+ * All Rights Reserved.
+ */
+
+
+import java.net.*;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.update.internal.core.net.http.client.Authenticator;
+import org.eclipse.core.runtime.*;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.update.internal.core.UpdateManagerPlugin;
+
+/**
+ * A transient database that remembers information, such as usernames and
+ * passwords. The information is stored in memory only and is discarted
+ * when the Plaform shuts down.
+ */
+public class UpdateManagerAuthenticator extends Authenticator {
+
+ // fields needed for caching the password
+ public static final String INFO_PASSWORD = "password"; //$NON-NLS-1$
+ public static final String INFO_USERNAME = "username"; //$NON-NLS-1$
+ public static final String AUTH_SCHEME = ""; //$NON-NLS-1$
+
+ private InetAddress requestingSite;
+ private int requestingPort;
+ private String requestingProtocol;
+ private String requestingPrompt;
+ private String requestingScheme;
+ private Map savedPasswordAuthentication;
+
+ /**
+ * The Map containing the userid and password
+ * HashMap allows <code>null</code> as the value
+ */
+ private Map result = new HashMap();
+
+ /**
+ *
+ */
+ public void addAuthenticationInfo(URL serverUrl, String realm, String scheme, Map info) {
+ try {
+ Platform.addAuthorizationInfo(serverUrl, realm, scheme, info);
+ } catch (CoreException e) {
+ UpdateManagerPlugin.warn("",e);
+ }
+ }
+
+ /**
+ *
+ */
+ public Map getAuthenticationInfo(URL serverUrl, String realm, String scheme) {
+ return Platform.getAuthorizationInfo(serverUrl, realm, scheme);
+ }
+
+ /**
+ *
+ */
+ public Map requestAuthenticationInfo(URL resourceUrl,String realm,String scheme) {
+ if (!equalsPreviousRequest(resourceUrl,realm,scheme)) {
+ // save state
+ InetAddress ip = null;
+ try {
+ ip = InetAddress.getByName(resourceUrl.getHost());
+ } catch (UnknownHostException e){
+ UpdateManagerPlugin.warn("",e);
+ }
+
+ this.requestingPort = resourceUrl.getPort();
+ this.requestingPrompt = realm;
+ this.requestingProtocol = resourceUrl.getProtocol();
+ this.requestingScheme = scheme;
+ this.requestingSite = ip;
+
+ // try to get the password info from the in-memory database first
+ Map map = Platform.getAuthorizationInfo(resourceUrl, requestingPrompt, requestingScheme);
+ if (map == null) {
+ map = retrievePasswordAuthentication(resourceUrl, requestingPrompt, requestingScheme);
+ }
+ savedPasswordAuthentication = map;
+ }
+
+ // we must return a valid Map while we internally manage Cancel dialog (map==null -> dialog cancelled)
+ return savedPasswordAuthentication;
+ }
+
+ /**
+ * @see org.eclipse.update.internal.core.net.http.client.IAuthenticator#addProtectionSpace(URL, String)
+ */
+ public void addProtectionSpace(URL resourceUrl, String realm) {
+ try {
+ Platform.addProtectionSpace(resourceUrl, realm);
+ }
+ catch (CoreException e) {
+ UpdateManagerPlugin.warn("",e);
+ }
+ }
+
+ /**
+ * @see org.eclipse.update.internal.core.net.http.client.IAuthenticator#getProtectionSpace(URL)
+ */
+ public String getProtectionSpace(URL resourceUrl) {
+ return Platform.getProtectionSpace(resourceUrl);
+ }
+
+
+ /*
+ * forces a refresh
+ */
+ public void reset(){
+ requestingPort = 0;
+ requestingPrompt = null;
+ requestingProtocol = null;
+ requestingScheme = null;
+ requestingSite = null;
+ }
+
+ /*
+ * returns a map that contains the userid and the password
+ * or <code>null</code> if the dialog has been cancelled
+ */
+ private Map retrievePasswordAuthentication(final URL resourceUrl, final String realm, final String scheme) {
+ result = new HashMap();
+ if ("Basic".equalsIgnoreCase(scheme)) {
+ Display disp = Display.getCurrent();
+ if (disp != null) {
+ result = promptForPassword(resourceUrl, realm);
+ } else {
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ result = promptForPassword(resourceUrl, realm);
+ }
+ });
+ };
+ }
+ return result;
+ }
+
+ /*
+ * returns true if this request is the same as the saved one
+ * used to prevent double dialog if user cancelled or entered wrong userid/password
+ */
+ private boolean equalsPreviousRequest(URL url,String realm,String scheme) {
+
+ if (requestingPort != url.getPort())
+ return false;
+
+ if (requestingPrompt != null && !requestingPrompt.equals(realm))
+ return false;
+ if (requestingPrompt == null && realm != null)
+ return false;
+
+ if (requestingProtocol != null && !requestingProtocol.equals(url.getProtocol()))
+ return false;
+ if (requestingProtocol == null && url.getProtocol() != null)
+ return false;
+
+ if (requestingScheme != null && !requestingScheme.equals(scheme))
+ return false;
+ if (requestingScheme == null && scheme != null)
+ return false;
+
+ InetAddress ip = null;
+ try {
+ ip = InetAddress.getByName(url.getHost());
+ } catch (UnknownHostException e){
+ UpdateManagerPlugin.warn("",e);
+ }
+
+ if (requestingSite != null && !requestingSite.equals(ip))
+ return false;
+ if (requestingSite == null && ip != null)
+ return false;
+
+ return true;
+ }
+
+ /*
+ * returns a map that contains the userid and the password
+ * or <code>null</code> if the dialog has been cancelled
+ */
+ private Map promptForPassword(URL resourceUrl, String realm) {
+
+ Map result = null;
+ Shell shell = new Shell();
+ UserValidationDialog ui = new UserValidationDialog(shell, resourceUrl, realm, ""); //$NON-NLS-1$
+ ui.setUsernameMutable(true);
+ ui.setBlockOnOpen(true);
+ ui.open();
+
+ boolean isCancelled = ui.getReturnCode() == ui.CANCEL;
+ if (!isCancelled){
+ result= new HashMap();
+ result.put(INFO_USERNAME, ui.getUserid());
+ result.put(INFO_PASSWORD, ui.getPassword());
+ }
+ shell.dispose();
+
+ return result;
+ }
+}
\ No newline at end of file
diff --git a/update/org.eclipse.update.ui/src/org/eclipse/update/internal/ui/views/UpdatesView.java b/update/org.eclipse.update.ui/src/org/eclipse/update/internal/ui/views/UpdatesView.java
index 65aedbd..ab8e17f 100644
--- a/update/org.eclipse.update.ui/src/org/eclipse/update/internal/ui/views/UpdatesView.java
+++ b/update/org.eclipse.update.ui/src/org/eclipse/update/internal/ui/views/UpdatesView.java
@@ -27,7 +27,7 @@
import org.eclipse.update.internal.ui.model.*;
import org.eclipse.update.internal.ui.parts.*;
import org.eclipse.update.internal.ui.search.*;
-import org.eclipse.update.internal.ui.security.AuthorizationDatabase;
+import org.eclipse.update.internal.ui.security.UpdateManagerAuthenticator;
import org.eclipse.update.internal.ui.wizards.*;
/**
@@ -717,9 +717,9 @@
.showWhile(viewer.getTree().getDisplay(), new Runnable() {
public void run() {
try {
- // reinitialize the authenticator
- AuthorizationDatabase auth =
- UpdateUIPlugin.getDefault().getDatabase();
+ // reinitialize the authenticator
+ UpdateManagerAuthenticator auth =
+ UpdateUIPlugin.getDefault().getAuthenticator();
if (auth != null)
auth.reset();
if (obj instanceof SiteBookmark)