End NL
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 c074bdc..b33ba07 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
@@ -27,16 +27,7 @@
this.feature = feature;
}
- /**
- * @see IPluginContainer#store(IPluginEntry, String, InputStream)
- */
- public void store(IPluginEntry pluginEntry, String contentKey, InputStream inStream) throws CoreException {
-
- String id = UpdateManagerPlugin.getPlugin().getDescriptor().getUniqueIdentifier();
- IStatus status = new Status(IStatus.ERROR, id, IStatus.OK, "Should not be called", null);
- throw new CoreException(status);
- }
-
+
/**
* return the path in whichh the Feature will be installed
*/
@@ -48,7 +39,7 @@
URL newURL = new URL(getSite().getURL(),path);
featurePath = newURL.getFile();
} catch (MalformedURLException e){
- throw newCoreException("Unable to create new URL :"+e.getMessage(),e);
+ throw newCoreException(Policy.bind("SiteFileContentConsumer.UnableToCreateURL")+e.getMessage(),e); //$NON-NLS-1$
}
return featurePath;
}
@@ -79,9 +70,7 @@
inStream = contentReference.getInputStream();
UpdateManagerUtils.copyToLocal(inStream, featurePath, null);
} catch (IOException e) {
- String id = UpdateManagerPlugin.getPlugin().getDescriptor().getUniqueIdentifier();
- IStatus status = new Status(IStatus.ERROR, id, IStatus.OK, "Error creating file:" + featurePath, e);
- throw new CoreException(status);
+ throw newCoreException(Policy.bind("GlobalConsumer.ErrorCreatingFile") + featurePath, e); //$NON-NLS-1$
} finally {
try {
// close stream
@@ -103,18 +92,22 @@
file = new File(getFeaturePath());
ref.setURL(file.toURL());
} catch (MalformedURLException e){
- throw newCoreException("Cannot create URL on File:"+ file.getAbsolutePath(),e);
+ throw newCoreException(Policy.bind("SiteFileContentConsumer.UnableToCreateURLForFile")+ file.getAbsolutePath(),e); //$NON-NLS-1$
}
return ref;
}
/*
- * @see ISiteContentConsumer#abort()
+ *
*/
public void abort() {
}
+ /**
+ *
+ */
private CoreException newCoreException(String s, Throwable e) throws CoreException {
- return new CoreException(new Status(IStatus.ERROR,"org.eclipse.update.core",0,s,e));
+ String id = UpdateManagerPlugin.getPlugin().getDescriptor().getUniqueIdentifier();
+ return new CoreException(new Status(IStatus.ERROR,id,0,s,e));
}
}
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 2d33a60..efa92c2 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
@@ -68,8 +68,8 @@
File siteLocation = new File(path);
if (siteLocation.isDirectory()) {
// need to add '/' if it is not there
- if (!(path.endsWith("/") || path.endsWith(File.separator))){ //$NON-NLS-1$
- url = new URL(url.getProtocol(),url.getHost(),url.getPort(),url.getFile()+"/"); //$NON-NLS-1$
+ if (!(path.endsWith("/") || path.endsWith(File.separator))) { //$NON-NLS-1$
+ url = new URL(url.getProtocol(), url.getHost(), url.getPort(), url.getFile() + "/"); //$NON-NLS-1$
}
if (new File(siteLocation, Site.SITE_XML).exists()) {
@@ -80,12 +80,12 @@
// parse siteLocation
site = parseSite(siteLocation);
} else {
- throw new IOException("Cannot retrieve a SiteFile from a directory. The URL should point to a file.");
+ throw new IOException(Policy.bind("SiteFileFactory.UnableToRetriveSite")); //$NON-NLS-1$
}
}
} else {
- // we are not pointing to a directory
- // attempt to parse the file
+ // we are not pointing to a directory
+ // attempt to parse the file
try {
URL resolvedURL = URLEncoder.encode(url);
siteStream = resolvedURL.openStream();
@@ -93,17 +93,16 @@
} catch (IOException e) {
if (forceCreation) {
// attempt to parse parent directory
- File file = new File(url.getFile());
- File parentDirectory =file.getParentFile();
-
- // create directory if it doesn't exist
- if (parentDirectory!=null && !parentDirectory.exists()){
- parentDirectory.mkdirs();
- }
-
- if (parentDirectory==null || !parentDirectory.isDirectory())
- throw new ParsingException(new Exception("Cannot obtain the parent directory from the file:"+file));
+ File file = new File(url.getFile());
+ File parentDirectory = file.getParentFile();
+ // create directory if it doesn't exist
+ if (parentDirectory != null && !parentDirectory.exists()) {
+ parentDirectory.mkdirs();
+ }
+
+ if (parentDirectory == null || !parentDirectory.isDirectory())
+ throw new ParsingException(new Exception(Policy.bind("SiteFileFactory.UnableToObtainParentDirectory") + file)); //$NON-NLS-1$
site = parseSite(parentDirectory);
} else
@@ -119,7 +118,8 @@
} finally {
try {
- if (siteStream != null) siteStream.close();
+ if (siteStream != null)
+ siteStream.close();
} catch (Exception e) {
}
}
@@ -133,10 +133,10 @@
this.site = (SiteFile) createSiteMapModel();
if (!directory.exists())
- throw new ParsingException(new Exception("The file:"+directory+" does not exist. Cannot parse site"));
+ throw new ParsingException(new Exception(Policy.bind("SiteFileFactory.FileDoesNotExist", directory.getAbsolutePath()))); //$NON-NLS-1$
File pluginPath = new File(directory, Site.DEFAULT_PLUGIN_PATH);
- File fragmentPath = new File(directory,Site.DEFAULT_FRAGMENT_PATH);
+ File fragmentPath = new File(directory, Site.DEFAULT_FRAGMENT_PATH);
try {
// FIXME: fragments
@@ -183,21 +183,17 @@
SiteFileFactory archiveFactory = new SiteFileFactory();
// the URL must ends with '/' for the bundle to be resolved
newFilePath = dir[index] + (dir[index].endsWith("/") ? "/" : ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- featureURL = new File(featureDir,newFilePath).toURL();
- //IFeature newFeature = createFeature(featureURL,ISite.DEFAULT_INSTALLED_FEATURE_TYPE);
+ featureURL = new File(featureDir, newFilePath).toURL();
- //if (newFeature!=null){
- featureRef = archiveFactory.createFeatureReferenceModel();
- featureRef.setSiteModel(site);
- featureRef.setURLString(featureURL.toExternalForm());
- featureRef.setType(ISite.DEFAULT_INSTALLED_FEATURE_TYPE);
- ((Site) site).addFeatureReferenceModel(featureRef);
- //}
+ featureRef = archiveFactory.createFeatureReferenceModel();
+ featureRef.setSiteModel(site);
+ featureRef.setURLString(featureURL.toExternalForm());
+ featureRef.setType(ISite.DEFAULT_INSTALLED_FEATURE_TYPE);
+ ((Site) site).addFeatureReferenceModel(featureRef);
+
}
} catch (MalformedURLException e) {
- String id = UpdateManagerPlugin.getPlugin().getDescriptor().getUniqueIdentifier();
- IStatus status = new Status(IStatus.ERROR, id, IStatus.OK, "Error creating file URL for:" + newFilePath, e);
- throw new CoreException(status);
+ throw newCoreException(Policy.bind("SiteFileFactory.UnableToCreateURLForFile", newFilePath), e); //$NON-NLS-1$
}
}
}
@@ -222,7 +218,6 @@
for (int index = 0; index < dir.length; index++) {
featureURL = new File(featureDir, dir[index]).toURL();
- //IFeature newFeature = createFeature(featureURL,ISite.DEFAULT_PACKAGED_FEATURE_TYPE);
SiteFileFactory archiveFactory = new SiteFileFactory();
featureRef = archiveFactory.createFeatureReferenceModel();
@@ -233,9 +228,7 @@
}
} catch (MalformedURLException e) {
- String id = UpdateManagerPlugin.getPlugin().getDescriptor().getUniqueIdentifier();
- IStatus status = new Status(IStatus.ERROR, id, IStatus.OK, "Error creating file URL for:" + newFilePath, e);
- throw new CoreException(status);
+ throw newCoreException(Policy.bind("SiteFileFactory.UnableToCreateURLForFile", newFilePath), e); //$NON-NLS-1$
}
}
}
@@ -253,7 +246,7 @@
PluginIdentifier plugin = null;
String id = UpdateManagerPlugin.getPlugin().getDescriptor().getUniqueIdentifier();
File pluginFile = null;
-
+
try {
if (dir.exists() && dir.isDirectory()) {
File[] files = dir.listFiles();
@@ -275,9 +268,10 @@
} // files[i] is a directory
}
} // path is a directory
- } catch (Exception e) {
- IStatus status = new Status(IStatus.ERROR, id, IStatus.OK, "Error parsing file :" + pluginFile + " \r\n" + e.getMessage(), e); //$NON-NLS-2$
- throw new CoreException(status);
+ } catch (IOException e) {
+ throw newCoreException(Policy.bind("SiteFileFactory.ErrorAccessing", pluginFile.getAbsolutePath()), e); //$NON-NLS-1$
+ } catch (SAXException e) {
+ throw newCoreException(Policy.bind("SiteFileFactory.ErrorParsingFile", pluginFile.getAbsolutePath()), e); //$NON-NLS-1$
}
}
@@ -312,8 +306,7 @@
((Site) site).addArchiveReferenceModel(archive);
}
} catch (MalformedURLException e) {
- IStatus status = new Status(IStatus.ERROR, id, IStatus.OK, "Error creating file URL for plugin:" + location, e);
- throw new CoreException(status);
+ throw newCoreException(Policy.bind("SiteFileFactory.UnableToCreateURLForFile", location), e); //$NON-NLS-1$
}
}
@@ -325,11 +318,10 @@
File file = null;
String[] dir;
- String id = UpdateManagerPlugin.getPlugin().getDescriptor().getUniqueIdentifier();
PluginIdentifier plugin;
ContentReference ref = null;
String refString = null;
-
+
try {
if (pluginDir.exists()) {
dir = pluginDir.list(FeaturePackagedContentProvider.filter);
@@ -340,9 +332,9 @@
ref = jarReference.peek("plugin.xml", null, null); //$NON-NLS-1$
if (ref == null)
jarReference.peek("fragment.xml", null, null); //$NON-NLS-1$
-
- refString = (ref==null)?null:ref.asURL().toExternalForm();
-
+
+ refString = (ref == null) ? null : ref.asURL().toExternalForm();
+
if (ref != null) {
IPluginEntry entry = new DefaultPluginParser().parse(ref.getInputStream());
VersionedIdentifier identifier = entry.getVersionedIdentifier();
@@ -353,8 +345,7 @@
}
} catch (Exception e) {
-
- throw new CoreException(new Status(IStatus.ERROR, id, IStatus.OK, "Error accessing file :" + refString, e));
+ throw newCoreException(Policy.bind("SiteFileFactory.ErrorAccessing", refString), e); //$NON-NLS-1$
}
}
@@ -362,7 +353,7 @@
/**
*
*/
- private IFeature createFeature(URL url,String type) throws CoreException {
+ private IFeature createFeature(URL url, String type) throws CoreException {
FeatureReference ref = new FeatureReference();
ref.setSite(site);
ref.setURL(url);
@@ -384,4 +375,15 @@
return (super.canParseSiteType(type) || SiteFileContentProvider.SITE_TYPE.equalsIgnoreCase(type));
}
+ /**
+ *
+ */
+ public void abort() {
+ }
+
+ private CoreException newCoreException(String s, Throwable e) throws CoreException {
+ String id = UpdateManagerPlugin.getPlugin().getDescriptor().getUniqueIdentifier();
+ return new CoreException(new Status(IStatus.ERROR, id, 0, s, e));
+ }
+
}
\ No newline at end of file
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteFileNonPluginContentConsumer.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteFileNonPluginContentConsumer.java
index 333cc3e..b69e735 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteFileNonPluginContentConsumer.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteFileNonPluginContentConsumer.java
@@ -34,9 +34,7 @@
inStream = contentReference.getInputStream();
UpdateManagerUtils.copyToLocal(inStream, featurePath, null);
} catch (IOException e) {
- String id = UpdateManagerPlugin.getPlugin().getDescriptor().getUniqueIdentifier();
- IStatus status = new Status(IStatus.ERROR, id, IStatus.OK, "Error creating file:" + featurePath, e);
- throw new CoreException(status);
+ throw newCoreException(Policy.bind("GlobalConsumer.ErrorCreatingFile") + featurePath, e); //$NON-NLS-1$
} finally {
try {
// close stream
@@ -51,4 +49,13 @@
*/
public void close() {
}
+
+ /**
+ *
+ */
+ private CoreException newCoreException(String s, Throwable e) throws CoreException {
+ String id = UpdateManagerPlugin.getPlugin().getDescriptor().getUniqueIdentifier();
+ return new CoreException(new Status(IStatus.ERROR,id,0,s,e));
+ }
+
}
\ No newline at end of file
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteFilePluginContentConsumer.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteFilePluginContentConsumer.java
index 3dfaaac..10a13d6 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteFilePluginContentConsumer.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteFilePluginContentConsumer.java
@@ -48,9 +48,7 @@
inStream = contentReference.getInputStream();
UpdateManagerUtils.copyToLocal(inStream, pluginPath, null);
} catch (IOException e) {
- String id = UpdateManagerPlugin.getPlugin().getDescriptor().getUniqueIdentifier();
- IStatus status = new Status(IStatus.ERROR, id, IStatus.OK, "Error creating file:" + pluginPath, e);
- throw new CoreException(status);
+ throw newCoreException(Policy.bind("GlobalConsumer.ErrorCreatingFile") + pluginPath, e); //$NON-NLS-1$
} finally {
try {
// close stream
@@ -69,6 +67,13 @@
((SiteFile) site).addPluginEntry(pluginEntry);
}
+ /**
+ *
+ */
+ private CoreException newCoreException(String s, Throwable e) throws CoreException {
+ String id = UpdateManagerPlugin.getPlugin().getDescriptor().getUniqueIdentifier();
+ return new CoreException(new Status(IStatus.ERROR,id,0,s,e));
+ }
}
\ No newline at end of file
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 76368d1..ea3af5a 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
@@ -11,9 +11,11 @@
import org.eclipse.core.boot.BootLoader;
import org.eclipse.core.boot.IPlatformConfiguration;
import org.eclipse.core.runtime.*;
-import org.eclipse.update.core.*;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.update.configuration.*;
-import org.eclipse.update.core.model.*;
+import org.eclipse.update.core.*;
+import org.eclipse.update.core.model.FeatureReferenceModel;
+import org.eclipse.update.core.model.SiteModel;
import org.eclipse.update.internal.model.*;
import org.xml.sax.SAXException;
@@ -78,11 +80,11 @@
site.save();
} catch (SAXException exception) {
- throw newCoreException("Error during parsing of the install config XML:" + site.getLocationURLString(), exception);
+ throw newCoreException(Policy.bind("SiteLocal.ErrorParsingSavedState") + site.getLocationURLString(), exception); //$NON-NLS-1$
} catch (MalformedURLException exception) {
- throw newCoreException("Cannot create URL from: " + site.getLocationURLString() + " & " + SITE_LOCAL_FILE, exception);
+ throw newCoreException(Policy.bind("SiteLocal.UnableToCreateURLFor") + site.getLocationURLString() + " & " + SITE_LOCAL_FILE, exception); //$NON-NLS-1$ //$NON-NLS-2$
} catch (IOException exception) {
- throw newCoreException("Cannot read xml file: " + configXML, exception);
+ throw newCoreException(Policy.bind("SiteLocal.UnableToAccessFile") + configXML, exception); //$NON-NLS-1$
}
return site;
@@ -107,7 +109,7 @@
// DEBUG:
if (UpdateManagerPlugin.DEBUG && UpdateManagerPlugin.DEBUG_SHOW_CONFIGURATION) {
- UpdateManagerPlugin.getPlugin().debug("Removed configuration :"+ removedConfig.getLabel()); //$NON-NLS-1$
+ UpdateManagerPlugin.getPlugin().debug("Removed configuration :" + removedConfig.getLabel()); //$NON-NLS-1$
}
// notify listeners
@@ -173,9 +175,9 @@
writer.writeSite(this, fileWriter);
fileWriter.close();
} catch (FileNotFoundException e) {
- throw newCoreException("Cannot save site into " + file.getAbsolutePath(), e);
+ throw newCoreException(Policy.bind("SiteLocal.UnableToSaveStateIn") + file.getAbsolutePath(), e); //$NON-NLS-1$
} catch (MalformedURLException e) {
- throw newCoreException("Cannot get handle on configuration file " + getLocationURL().toExternalForm() + " : " + SITE_LOCAL_FILE, e); //$NON-NLS-2$
+ throw newCoreException(Policy.bind("SiteLocal.UnableToCreateURLFor") + getLocationURL().toExternalForm() + " : " + SITE_LOCAL_FILE, e); //$NON-NLS-2$ //$NON-NLS-1$
}
}
}
@@ -266,7 +268,7 @@
// set teh same date in the installConfig
result.setCreationDate(currentDate);
} catch (MalformedURLException e) {
- throw newCoreException("Cannot create a new configuration in:" + newFileName, e);
+ throw newCoreException(Policy.bind("SiteLocal.UnableToCreateURLFor") + newFileName, e); //$NON-NLS-1$
}
return result;
}
@@ -338,7 +340,7 @@
newConfiguration.setCreationDate(currentDate);
} catch (MalformedURLException e) {
- throw newCoreException("Cannot create a new preserved configuration in:" + newFileName, e);
+ throw newCoreException(Policy.bind("SiteLocal.UnableToCreateURLFor") + newFileName, e); //$NON-NLS-1$
}
((InstallConfiguration) newConfiguration).saveConfigurationFile();
@@ -436,73 +438,84 @@
* only one feature is configured
*/
public void reconcile() throws CoreException {
- try {
- IPlatformConfiguration platformConfig = BootLoader.getCurrentPlatformConfiguration();
- IPlatformConfiguration.ISiteEntry[] newSiteEntries = platformConfig.getConfiguredSites();
- // Either it is a new site or it already exists, or it is deleted
- // new site only exist in platformConfig
- List modified = new ArrayList();
- List toInstall = new ArrayList();
- IConfiguredSite[] oldConfiguredSites = new IConfiguredSite[0];
+ IPlatformConfiguration platformConfig = BootLoader.getCurrentPlatformConfiguration();
+ IPlatformConfiguration.ISiteEntry[] newSiteEntries = platformConfig.getConfiguredSites();
- // sites from the current configuration
- if (getCurrentConfiguration() != null)
- oldConfiguredSites = getCurrentConfiguration().getConfiguredSites();
+ // Either it is a new site or it already exists, or it is deleted
+ // new site only exist in platformConfig
+ List modified = new ArrayList();
+ List toInstall = new ArrayList();
+ IConfiguredSite[] oldConfiguredSites = new IConfiguredSite[0];
- // check if sites from the platform are new or modified
- for (int siteIndex = 0; siteIndex < newSiteEntries.length; siteIndex++) {
+ // sites from the current configuration
+ if (getCurrentConfiguration() != null)
+ oldConfiguredSites = getCurrentConfiguration().getConfiguredSites();
- URL resolvedURL = Platform.resolve(newSiteEntries[siteIndex].getURL());
- boolean found = false;
- for (int index = 0; index < oldConfiguredSites.length && !found; index++) {
- if (oldConfiguredSites[index].getSite().getURL().equals(resolvedURL)) {
- found = true;
- ((ConfiguredSite) oldConfiguredSites[index]).setPreviousPluginPath(newSiteEntries[siteIndex].getSitePolicy().getList());
- modified.add(oldConfiguredSites[index]);
- }
- }
+ // check if sites from the platform are new or modified
+ for (int siteIndex = 0; siteIndex < newSiteEntries.length; siteIndex++) {
- // new site not found, create it
- if (!found) {
- ISite site = SiteManager.getSite(resolvedURL);
- //site policy
- IPlatformConfiguration.ISitePolicy sitePolicy = newSiteEntries[siteIndex].getSitePolicy();
- ConfiguredSite configSite = (ConfiguredSite) new BaseSiteLocalFactory().createConfigurationSiteModel((SiteModel) site, sitePolicy.getType());
- configSite.setPlatformURLString(newSiteEntries[siteIndex].getURL().toExternalForm());
- configSite.setPreviousPluginPath(newSiteEntries[siteIndex].getSitePolicy().getList());
+ URL resolvedURL = resolveSiteEntry(newSiteEntries[siteIndex]);
- //the site may not be read-write
- configSite.isUpdateable(newSiteEntries[siteIndex].isUpdateable());
-
- toInstall.add(configSite);
+ boolean found = false;
+ for (int index = 0; index < oldConfiguredSites.length && !found; index++) {
+ if (oldConfiguredSites[index].getSite().getURL().equals(resolvedURL)) {
+ found = true;
+ ((ConfiguredSite) oldConfiguredSites[index]).setPreviousPluginPath(newSiteEntries[siteIndex].getSitePolicy().getList());
+ modified.add(oldConfiguredSites[index]);
}
}
- // create new InstallConfiguration
- IInstallConfiguration newDefaultConfiguration = cloneConfigurationSite(null, null, null);
+ // new site not found, create it
+ if (!found) {
+ ISite site = SiteManager.getSite(resolvedURL);
+ //site policy
+ IPlatformConfiguration.ISitePolicy sitePolicy = newSiteEntries[siteIndex].getSitePolicy();
+ ConfiguredSite configSite = (ConfiguredSite) new BaseSiteLocalFactory().createConfigurationSiteModel((SiteModel) site, sitePolicy.getType());
+ configSite.setPlatformURLString(newSiteEntries[siteIndex].getURL().toExternalForm());
+ configSite.setPreviousPluginPath(newSiteEntries[siteIndex].getSitePolicy().getList());
- // check modified config site
- // and add them back
- Iterator checkIter = modified.iterator();
- while (checkIter.hasNext()) {
- IConfiguredSite modifiedOldConfigSite = (IConfiguredSite) checkIter.next();
- newDefaultConfiguration.addConfiguredSite(reconcile(modifiedOldConfigSite));
+ //the site may not be read-write
+ configSite.isUpdateable(newSiteEntries[siteIndex].isUpdateable());
+
+ toInstall.add(configSite);
}
-
- // add new sites
- Iterator addIter = toInstall.iterator();
- while (addIter.hasNext()) {
- IConfiguredSite newFoundSite = (IConfiguredSite) addIter.next();
- newDefaultConfiguration.addConfiguredSite(newFoundSite);
- }
-
- // add the configuration as the currentConfig
- this.addConfiguration(newDefaultConfiguration);
-
- } catch (IOException e) {
- throw newCoreException("Cannot create the Local Site: " + e.getMessage(), e);
}
+
+ // create new InstallConfiguration
+ IInstallConfiguration newDefaultConfiguration = cloneConfigurationSite(null, null, null);
+
+ // check modified config site
+ // and add them back
+ Iterator checkIter = modified.iterator();
+ while (checkIter.hasNext()) {
+ IConfiguredSite modifiedOldConfigSite = (IConfiguredSite) checkIter.next();
+ newDefaultConfiguration.addConfiguredSite(reconcile(modifiedOldConfigSite));
+ }
+
+ // add new sites
+ Iterator addIter = toInstall.iterator();
+ while (addIter.hasNext()) {
+ IConfiguredSite newFoundSite = (IConfiguredSite) addIter.next();
+ newDefaultConfiguration.addConfiguredSite(newFoundSite);
+ }
+
+ // add the configuration as the currentConfig
+ this.addConfiguration(newDefaultConfiguration);
+
+ }
+
+ /**
+ *
+ */
+ private URL resolveSiteEntry(IPlatformConfiguration.ISiteEntry newSiteEntry) throws CoreException {
+ URL resolvedURL = null;
+ try {
+ resolvedURL = Platform.resolve(newSiteEntry.getURL());
+ } catch (IOException e) {
+ throw newCoreException(Policy.bind("SiteLocal.UnableToResolve",newSiteEntry.getURL().toExternalForm()), e); //$NON-NLS-1$
+ }
+ return resolvedURL;
}
/**
@@ -598,7 +611,7 @@
}
}
}
-
+
/**
* compare 2 feature references
* returns 0 if the feature are different
@@ -606,17 +619,18 @@
* returns 2 if opposite
*/
private int compare(IFeatureReference featureRef1, IFeatureReference featureRef2) throws CoreException {
- if (featureRef1==null) return 0;
-
+ if (featureRef1 == null)
+ return 0;
+
IFeature feature1 = featureRef1.getFeature();
- IFeature feature2 = featureRef2.getFeature();
-
- if (feature1.equals(feature2)){
+ IFeature feature2 = featureRef2.getFeature();
+
+ if (feature1.equals(feature2)) {
Version version1 = feature1.getVersionedIdentifier().getVersion();
- Version version2 = feature2.getVersionedIdentifier().getVersion();
- if (version1!=null){
+ Version version2 = feature2.getVersionedIdentifier().getVersion();
+ if (version1 != null) {
int result = (version1.compare(version2));
- if (result==-1) {
+ if (result == -1) {
return 2;
} else {
return 1;
@@ -658,35 +672,33 @@
* We do not lose explicitly set plugins found in platform.cfg.
*/
private void preserveRuntimePluginPath() throws CoreException {
- try {
- IPlatformConfiguration platformConfig = BootLoader.getCurrentPlatformConfiguration();
- IPlatformConfiguration.ISiteEntry[] siteEntries = platformConfig.getConfiguredSites();
- // sites from the current configuration
- IConfiguredSite[] configured = new IConfiguredSite[0];
- if (getCurrentConfiguration() != null)
- configured = getCurrentConfiguration().getConfiguredSites();
+ IPlatformConfiguration platformConfig = BootLoader.getCurrentPlatformConfiguration();
+ IPlatformConfiguration.ISiteEntry[] siteEntries = platformConfig.getConfiguredSites();
- // sites from the platform
- for (int siteIndex = 0; siteIndex < siteEntries.length; siteIndex++) {
+ // sites from the current configuration
+ IConfiguredSite[] configured = new IConfiguredSite[0];
+ if (getCurrentConfiguration() != null)
+ configured = getCurrentConfiguration().getConfiguredSites();
- URL resolvedURL = Platform.resolve(siteEntries[siteIndex].getURL());
- boolean found = false;
- for (int index = 0; index < configured.length && !found; index++) {
+ // sites from the platform
+ for (int siteIndex = 0; siteIndex < siteEntries.length; siteIndex++) {
+ URL resolvedURL =resolveSiteEntry(siteEntries[siteIndex]);
+
+ boolean found = false;
+ for (int index = 0; index < configured.length && !found; index++) {
- // the array may have hole as we set found site to null
- if (configured[index] != null) {
- if (configured[index].getSite().getURL().equals(resolvedURL)) {
- found = true;
- ((ConfiguredSite) configured[index]).setPreviousPluginPath(siteEntries[siteIndex].getSitePolicy().getList());
- configured[index] = null;
- }
+ // the array may have hole as we set found site to null
+ if (configured[index] != null) {
+ if (configured[index].getSite().getURL().equals(resolvedURL)) {
+ found = true;
+ ((ConfiguredSite) configured[index]).setPreviousPluginPath(siteEntries[siteIndex].getSitePolicy().getList());
+ configured[index] = null;
}
}
}
- } catch (IOException e) {
- throw newCoreException("Cannot create the Local Site: " + e.getMessage(), e);
}
+
}
/**
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteTypeFactory.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteTypeFactory.java
index 35d1c9d..8245bbb 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteTypeFactory.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteTypeFactory.java
@@ -63,7 +63,7 @@
IPluginRegistry pluginRegistry = Platform.getPluginRegistry();
IConfigurationElement[] elements = pluginRegistry.getConfigurationElementsFor(pluginID,SIMPLE_EXTENSION_ID,type);
if (elements==null || elements.length==0){
- IStatus status = new Status(IStatus.ERROR,pluginID,IStatus.OK,"Cannot find site factory for id: " +type,null);
+ IStatus status = new Status(IStatus.ERROR,pluginID,IStatus.OK,Policy.bind("SiteTypeFactory.UnableToFindSiteFactory",type),null); //$NON-NLS-1$
throw new CoreException(status);
} else {
IConfigurationElement element = elements[0];
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 ea64905..fc59816 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
@@ -29,17 +29,17 @@
URL url = null;
// if no URL , provide Default
- if (urlString == null || urlString.trim().equals("")) {
+ if (urlString == null || urlString.trim().equals("")) { //$NON-NLS-1$
// no URL, no default, return right now...
- if (defaultURL == null || defaultURL.trim().equals(""))
+ if (defaultURL == null || defaultURL.trim().equals("")) //$NON-NLS-1$
return null;
else
urlString = defaultURL;
}
// URL can be relative or absolute
- if (urlString.startsWith("/") && urlString.length() > 1)
+ if (urlString.startsWith("/") && urlString.length() > 1) //$NON-NLS-1$
urlString = urlString.substring(1);
try {
url = new URL(urlString);
@@ -124,14 +124,14 @@
* c -> c953867549
*/
public static String getLocalRandomIdentifier(String remotePath, Date date) {
- int dotIndex = remotePath.lastIndexOf(".");
+ int dotIndex = remotePath.lastIndexOf("."); //$NON-NLS-1$
int fileIndex = remotePath.lastIndexOf(File.separator);
// if there is a separator after the dot
// do not consider it as an extension
// FIXME: LINUX ???
//String ext = (dotIndex != -1 && fileIndex < dotIndex) ? "." + remotePath.substring(dotIndex) : "";
- String ext = (dotIndex != -1 && fileIndex < dotIndex) ? remotePath.substring(dotIndex) : "";
+ String ext = (dotIndex != -1 && fileIndex < dotIndex) ? remotePath.substring(dotIndex) : ""; //$NON-NLS-1$
// the name is the string between the separator and the dot
// if there is no separator, it is the string up to the dot
@@ -140,7 +140,7 @@
if (dotIndex==-1) dotIndex=remotePath.length();
// if I have a separator and no dot: /a/b/c -> c
// if my separator is the last /a/b/c/, fileIndex and dotIndex are the same, so it will return teh default temp name
- String name = (fileIndex < dotIndex) ? remotePath.substring(fileIndex, dotIndex) : "Eclipse_Update_TMP_";
+ String name = (fileIndex < dotIndex) ? remotePath.substring(fileIndex, dotIndex) : "Eclipse_Update_TMP_"; //$NON-NLS-1$
String result = name + date.getTime() + ext;
@@ -164,7 +164,7 @@
}
if (!file.delete()) {
String id = UpdateManagerPlugin.getPlugin().getDescriptor().getUniqueIdentifier();
- IStatus status = new Status(IStatus.WARNING,id,IStatus.OK,"cannot remove: " + file.getPath()+" from the filesystem",new Exception());
+ IStatus status = new Status(IStatus.WARNING,id,IStatus.OK,Policy.bind("UpdateManagerUtils.UnableToRemoveFile", file.getAbsolutePath()),new Exception()); //$NON-NLS-1$ //$NON-NLS-2$
UpdateManagerPlugin.getPlugin().getLog().log(status);
}
}
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/messages.properties b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/messages.properties
index 61d5b49..d11c8f0 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/messages.properties
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/messages.properties
@@ -101,7 +101,7 @@
FeatureFactory.ParsingError= Error parsing 'feature.xml' stream in the feature archive {0}.
FeatureExecutableFactory.NullURL= Error creating Feature. The URL used to create the feature is null.
-FeatureExecutableFactory.CannotCreateURL= Error creating Feature. Unable to create new URL for {0}.
+FeatureExecutableFactory.CannotCreateURL= Error creating Feature. Unable to create URL for {0}.
FeaturePackagedContentProvider.NoManifestFile= Unable to retrieve {0} in feature {1} at location {2}. {0} does not exist.
FeaturePackagedContentProvider.ErrorRetrieving= Error retrieving {0} in Archive Reference {1} at location {2}. cannot access {0].
@@ -113,13 +113,13 @@
FeatureReference.UnableToResolveURL= Internal Error: Unable to resolve model using URL: {0}.
FeatureTypeFactory.UnableToFindFeatureFactory= Unable to find a feature factory for the extension id {0}.
+
InstallConfiguration.UnableToSaveConfiguration= Unable to save configuration in {0}.
InstallConfiguration.UnableToCreateURL= Unable to create URL from {0}.
InstallConfiguration.UnableToCast= Internal Error. The Configuration Site object is not a subclass of ConfiguredSiteModel
InstallConfiguration.UnableToFindConfiguredSite= Unable to find site {0} in platform configuration {1}.
InstallConfiguration.UnableToSavePlatformConfiguration= Unable to save platform configuration in {0}.
-
InternalSiteManager.UnableToCreateSiteWithType= Extension Error. The Site Factory of type {0} cannot access the Site(1}.
InternalSiteManager.UnableToAccessURL= Unable to access {0}. {1}
InternalSiteManager.UnableToCreateURL= Unable to create URL from {0}.
@@ -129,3 +129,24 @@
Policy.MissingMessage= Missing message: {0}.
Policy.Missing= missing {0}
+GlobalConsumer.ErrorCreatingFile= Unable to create file {0}.
+
+SiteFileContentConsumer.UnableToCreateURL= Unable to create URL from {0}.
+SiteFileContentConsumer.UnableToCreateURLForFile= Unable to create URL for the File:
+
+SiteFileFactory.UnableToRetriveSite= Unable retrieve this Site from a directory. The URL should point to a file instead.
+SiteFileFactory.UnableToObtainParentDirectory= Unable obtain the parent directory from the file {0}.
+SiteFileFactory.FileDoesNotExist= Unable to access site {0}. the directory does not exist.
+SiteFileFactory.UnableToCreateURLForFile= Unable to create URL from {0}.
+SiteFileFactory.ErrorParsingFile= Unable to parse file {0}.
+SiteFileFactory.ErrorAccessing= Unable to access file {0}.
+
+SiteTypeFactory.UnableToFindSiteFactory= Unable to find a site factory for the extension id {0}.
+
+UpdateManagerUtils.UnableToRemoveFile= Unable to remove {0} from the filesystem.
+
+SiteLocal.ErrorParsingSavedState= Error during parsing of the configuration saved state {0}.
+SiteLocal.UnableToCreateURLFor= Unable to create URL from {0}.
+SiteLocal.UnableToAccessFile= Unable to access file [0}.
+SiteLocal.UnableToSaveStateIn= Unable to persist configurations into {0}.
+SiteLocal.UnableToResolve= Internal Error.Unable to resolve {0}.