Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDJ Houghton2008-04-11 13:50:17 -0400
committerDJ Houghton2008-04-11 13:50:17 -0400
commitc223124b36206e6928cb501ebd339869f5490c51 (patch)
tree81be15983c2b754745cbb375be45e5a8194ae72f
parent05a39e054fa0a0117dadcb47e4dd05026b78662c (diff)
downloadrt.equinox.p2-c223124b36206e6928cb501ebd339869f5490c51.tar.gz
rt.equinox.p2-c223124b36206e6928cb501ebd339869f5490c51.tar.xz
rt.equinox.p2-c223124b36206e6928cb501ebd339869f5490c51.zip
Bug 224482 - [reconciler] Need to watch the platform.xml
-rw-r--r--bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/Activator.java34
-rw-r--r--bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/DropinsRepositoryListener.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/Messages.java1
-rw-r--r--bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/PlatformXmlListener.java50
-rw-r--r--bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/messages.properties3
-rw-r--r--bundles/org.eclipse.equinox.p2.reconciler/src/org/eclipse/equinox/internal/p2/reconciler/dropins/Activator.java34
-rw-r--r--bundles/org.eclipse.equinox.p2.reconciler/src/org/eclipse/equinox/internal/p2/reconciler/dropins/DropinsRepositoryListener.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.reconciler/src/org/eclipse/equinox/internal/p2/reconciler/dropins/Messages.java1
-rw-r--r--bundles/org.eclipse.equinox.p2.reconciler/src/org/eclipse/equinox/internal/p2/reconciler/dropins/PlatformXmlListener.java50
-rw-r--r--bundles/org.eclipse.equinox.p2.reconciler/src/org/eclipse/equinox/internal/p2/reconciler/dropins/messages.properties3
10 files changed, 88 insertions, 96 deletions
diff --git a/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/Activator.java b/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/Activator.java
index d06c115bf..858751b19 100644
--- a/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/Activator.java
+++ b/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/Activator.java
@@ -13,8 +13,7 @@ import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.*;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
@@ -38,8 +37,8 @@ public class Activator implements BundleActivator {
private static BundleContext bundleContext;
private ServiceReference packageAdminRef;
private List watchers = new ArrayList();
- private static IMetadataRepository[] dropinRepositories;
- private static IMetadataRepository[] configurationRepositories;
+ private static Collection dropinRepositories;
+ private static Collection configurationRepositories;
private static IMetadataRepository[] linksRepositories;
private static IMetadataRepository eclipseProductRepository;
@@ -88,11 +87,11 @@ public class Activator implements BundleActivator {
}
protected static Collection getDropinRepositories() {
- return (dropinRepositories != null ? Arrays.asList(dropinRepositories) : new ArrayList(0));
+ return dropinRepositories == null ? new ArrayList(0) : dropinRepositories;
}
protected static Collection getConfigurationRepositories() {
- return (configurationRepositories != null ? Arrays.asList(configurationRepositories) : new ArrayList(0));
+ return configurationRepositories == null ? new ArrayList(0) : configurationRepositories;
}
/* (non-Javadoc)
@@ -119,7 +118,7 @@ public class Activator implements BundleActivator {
watchDropins(profile);
// keep an eye on the platform.xml
if (false)
- watchConfiguration();
+ watchConfiguration();
synchronize(new ArrayList(0), null);
@@ -133,21 +132,16 @@ public class Activator implements BundleActivator {
}
private void watchEclipseProduct() {
-
- URL baseURL;
try {
- baseURL = new URL(bundleContext.getProperty(OSGI_CONFIGURATION_AREA));
+ URL baseURL = new URL(bundleContext.getProperty(OSGI_CONFIGURATION_AREA));
URL pooledURL = new URL(baseURL, "../.pooled"); //$NON-NLS-1$
loadArtifactRepository(pooledURL);
eclipseProductRepository = loadMetadataRepository(pooledURL);
} catch (MalformedURLException e) {
- // TODO proper logging
- e.printStackTrace();
+ LogHelper.log(new Status(IStatus.ERROR, ID, "Error occurred while loading repository.", e));
} catch (ProvisionException e) {
- // TODO proper logging
- e.printStackTrace();
+ LogHelper.log(new Status(IStatus.ERROR, ID, "Error occurred while loading repository.", e));
}
-
}
private boolean startEarly(String bundleName) throws BundleException {
@@ -161,17 +155,17 @@ public class Activator implements BundleActivator {
/*
* Synchronize the profile.
*/
- public static synchronized void synchronize(List extraRepositories, IProgressMonitor monitor) {
+ public static synchronized void synchronize(Collection extraRepositories, IProgressMonitor monitor) {
IProfile profile = getCurrentProfile(bundleContext);
if (profile == null)
return;
// create the profile synchronizer on all available repositories
Set repositories = new HashSet(extraRepositories);
if (dropinRepositories != null)
- repositories.addAll(Arrays.asList(dropinRepositories));
+ repositories.addAll(dropinRepositories);
if (configurationRepositories != null)
- repositories.addAll(Arrays.asList(configurationRepositories));
+ repositories.addAll(configurationRepositories);
if (linksRepositories != null)
repositories.addAll(Arrays.asList(linksRepositories));
@@ -195,9 +189,9 @@ public class Activator implements BundleActivator {
PlatformXmlListener listener = new PlatformXmlListener(configFile);
watcher.addListener(listener);
watcher.poll();
- List repositories = listener.getMetadataRepositories();
+ Collection repositories = listener.getMetadataRepositories();
if (repositories != null)
- configurationRepositories = (IMetadataRepository[]) repositories.toArray(new IMetadataRepository[0]);
+ configurationRepositories = repositories;
}
diff --git a/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/DropinsRepositoryListener.java b/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/DropinsRepositoryListener.java
index fdc3157e4..6256907a3 100644
--- a/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/DropinsRepositoryListener.java
+++ b/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/DropinsRepositoryListener.java
@@ -249,10 +249,10 @@ public class DropinsRepositoryListener extends RepositoryListener {
repository.setProperty(key, value);
}
- public IMetadataRepository[] getMetadataRepositories() {
+ public Collection getMetadataRepositories() {
List result = new ArrayList(metadataRepositories);
result.add(getMetadataRepository());
- return (IMetadataRepository[]) result.toArray(new IMetadataRepository[0]);
+ return result;
}
}
diff --git a/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/Messages.java b/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/Messages.java
index aa0e61b27..d20774237 100644
--- a/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/Messages.java
+++ b/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/Messages.java
@@ -18,6 +18,7 @@ import org.eclipse.osgi.util.NLS;
public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.equinox.internal.p2.reconciler.dropins.messages"; //$NON-NLS-1$
public static String artifact_repo_manager_not_registered;
+ public static String errorLoadingRepository;
public static String errorProcessingConfg;
public static String metadata_repo_manager_not_registered;
static {
diff --git a/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/PlatformXmlListener.java b/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/PlatformXmlListener.java
index 889a010a8..e11924ae9 100644
--- a/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/PlatformXmlListener.java
+++ b/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/PlatformXmlListener.java
@@ -14,12 +14,15 @@ import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.*;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
+import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
import org.eclipse.equinox.internal.p2.update.*;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
import org.eclipse.equinox.internal.provisional.p2.directorywatcher.DirectoryChangeListener;
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
+import org.eclipse.osgi.service.datalocation.Location;
+import org.eclipse.osgi.util.NLS;
/**
* @since 1.0
@@ -42,6 +45,18 @@ public class PlatformXmlListener extends DirectoryChangeListener {
this.root = file;
}
+ /*
+ * Do a look-up and return the OSGi install area if it is set.
+ */
+ private static URL getOSGiInstallArea() {
+ Location location = (Location) ServiceHelper.getService(Activator.getContext(), Location.class.getName(), Location.INSTALL_FILTER);
+ if (location == null)
+ return null;
+ if (!location.isSet())
+ return null;
+ return location.getURL();
+ }
+
/* (non-Javadoc)
* @see org.eclipse.equinox.internal.provisional.p2.directorywatcher.IDirectoryChangeListener#added(java.io.File)
*/
@@ -94,18 +109,17 @@ public class PlatformXmlListener extends DirectoryChangeListener {
if (changed) {
lastModified = root.lastModified();
try {
- Configuration configuration = ConfigurationParser.parse(root, (URL) null);
+ Configuration configuration = ConfigurationParser.parse(root, getOSGiInstallArea());
synchronizeConfiguration(configuration);
} catch (ProvisionException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ LogHelper.log(new Status(IStatus.ERROR, Activator.ID, Messages.errorProcessingConfg, e));
}
}
changed = false;
}
- public List getMetadataRepositories() {
- return makeList(configRepositories);
+ public Collection getMetadataRepositories() {
+ return configRepositories;
}
private IMetadataRepository getMatchingRepo(Collection repositoryList, String urlString) {
@@ -127,7 +141,7 @@ public class PlatformXmlListener extends DirectoryChangeListener {
for (Iterator iter = sites.iterator(); iter.hasNext();) {
String siteURL = ((Site) iter.next()).getUrl();
// TODO: this is our way of skipping the base.
- // we will need to change this to platform:base: at some point
+ // we will need to change this to platform:/base/ at some point
if ("file:.".equals(siteURL) || "file:".equals(siteURL)) //$NON-NLS-1$//$NON-NLS-2$
continue;
if (siteURL.startsWith("file:") && siteURL.endsWith("/eclipse/")) //$NON-NLS-1$//$NON-NLS-2$
@@ -142,11 +156,9 @@ public class PlatformXmlListener extends DirectoryChangeListener {
Activator.loadArtifactRepository(repoURL);
newRepos.add(newRepo);
} catch (MalformedURLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ LogHelper.log(new Status(IStatus.ERROR, Activator.ID, NLS.bind(Messages.errorLoadingRepository, siteURL), e));
} catch (ProvisionException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ LogHelper.log(new Status(IStatus.ERROR, Activator.ID, NLS.bind(Messages.errorLoadingRepository, siteURL), e));
}
}
}
@@ -154,18 +166,6 @@ public class PlatformXmlListener extends DirectoryChangeListener {
if (newRepos.isEmpty())
return;
configRepositories = newRepos;
- Activator.synchronize(makeList(newRepos), null);
+ Activator.synchronize(newRepos, null);
}
-
- // TODO: this is a kludge to fix collection impedance mismatch
- // between the xml listener and the activator; get rid of it!
- private List makeList(Set set) {
- List list = new ArrayList((set != null ? set.size() : 0));
- if (set != null) {
- for (Iterator iter = set.iterator(); iter.hasNext();)
- list.add(iter.next());
- }
- return list;
- }
-
}
diff --git a/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/messages.properties b/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/messages.properties
index 063c54356..d8066d062 100644
--- a/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/messages.properties
+++ b/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/messages.properties
@@ -9,5 +9,6 @@
# IBM Corporation - initial API and implementation
###############################################################################
artifact_repo_manager_not_registered=ArtifactRepositoryManager not registered.
+errorLoadingRepository=Error occurred while loading repository at {0}.
errorProcessingConfg=Exception while processing configuration.
-metadata_repo_manager_not_registered=MetadataRepositoryManager not registered.
+metadata_repo_manager_not_registered=MetadataRepositoryManager not registered. \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.reconciler/src/org/eclipse/equinox/internal/p2/reconciler/dropins/Activator.java b/bundles/org.eclipse.equinox.p2.reconciler/src/org/eclipse/equinox/internal/p2/reconciler/dropins/Activator.java
index d06c115bf..858751b19 100644
--- a/bundles/org.eclipse.equinox.p2.reconciler/src/org/eclipse/equinox/internal/p2/reconciler/dropins/Activator.java
+++ b/bundles/org.eclipse.equinox.p2.reconciler/src/org/eclipse/equinox/internal/p2/reconciler/dropins/Activator.java
@@ -13,8 +13,7 @@ import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.*;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
@@ -38,8 +37,8 @@ public class Activator implements BundleActivator {
private static BundleContext bundleContext;
private ServiceReference packageAdminRef;
private List watchers = new ArrayList();
- private static IMetadataRepository[] dropinRepositories;
- private static IMetadataRepository[] configurationRepositories;
+ private static Collection dropinRepositories;
+ private static Collection configurationRepositories;
private static IMetadataRepository[] linksRepositories;
private static IMetadataRepository eclipseProductRepository;
@@ -88,11 +87,11 @@ public class Activator implements BundleActivator {
}
protected static Collection getDropinRepositories() {
- return (dropinRepositories != null ? Arrays.asList(dropinRepositories) : new ArrayList(0));
+ return dropinRepositories == null ? new ArrayList(0) : dropinRepositories;
}
protected static Collection getConfigurationRepositories() {
- return (configurationRepositories != null ? Arrays.asList(configurationRepositories) : new ArrayList(0));
+ return configurationRepositories == null ? new ArrayList(0) : configurationRepositories;
}
/* (non-Javadoc)
@@ -119,7 +118,7 @@ public class Activator implements BundleActivator {
watchDropins(profile);
// keep an eye on the platform.xml
if (false)
- watchConfiguration();
+ watchConfiguration();
synchronize(new ArrayList(0), null);
@@ -133,21 +132,16 @@ public class Activator implements BundleActivator {
}
private void watchEclipseProduct() {
-
- URL baseURL;
try {
- baseURL = new URL(bundleContext.getProperty(OSGI_CONFIGURATION_AREA));
+ URL baseURL = new URL(bundleContext.getProperty(OSGI_CONFIGURATION_AREA));
URL pooledURL = new URL(baseURL, "../.pooled"); //$NON-NLS-1$
loadArtifactRepository(pooledURL);
eclipseProductRepository = loadMetadataRepository(pooledURL);
} catch (MalformedURLException e) {
- // TODO proper logging
- e.printStackTrace();
+ LogHelper.log(new Status(IStatus.ERROR, ID, "Error occurred while loading repository.", e));
} catch (ProvisionException e) {
- // TODO proper logging
- e.printStackTrace();
+ LogHelper.log(new Status(IStatus.ERROR, ID, "Error occurred while loading repository.", e));
}
-
}
private boolean startEarly(String bundleName) throws BundleException {
@@ -161,17 +155,17 @@ public class Activator implements BundleActivator {
/*
* Synchronize the profile.
*/
- public static synchronized void synchronize(List extraRepositories, IProgressMonitor monitor) {
+ public static synchronized void synchronize(Collection extraRepositories, IProgressMonitor monitor) {
IProfile profile = getCurrentProfile(bundleContext);
if (profile == null)
return;
// create the profile synchronizer on all available repositories
Set repositories = new HashSet(extraRepositories);
if (dropinRepositories != null)
- repositories.addAll(Arrays.asList(dropinRepositories));
+ repositories.addAll(dropinRepositories);
if (configurationRepositories != null)
- repositories.addAll(Arrays.asList(configurationRepositories));
+ repositories.addAll(configurationRepositories);
if (linksRepositories != null)
repositories.addAll(Arrays.asList(linksRepositories));
@@ -195,9 +189,9 @@ public class Activator implements BundleActivator {
PlatformXmlListener listener = new PlatformXmlListener(configFile);
watcher.addListener(listener);
watcher.poll();
- List repositories = listener.getMetadataRepositories();
+ Collection repositories = listener.getMetadataRepositories();
if (repositories != null)
- configurationRepositories = (IMetadataRepository[]) repositories.toArray(new IMetadataRepository[0]);
+ configurationRepositories = repositories;
}
diff --git a/bundles/org.eclipse.equinox.p2.reconciler/src/org/eclipse/equinox/internal/p2/reconciler/dropins/DropinsRepositoryListener.java b/bundles/org.eclipse.equinox.p2.reconciler/src/org/eclipse/equinox/internal/p2/reconciler/dropins/DropinsRepositoryListener.java
index fdc3157e4..6256907a3 100644
--- a/bundles/org.eclipse.equinox.p2.reconciler/src/org/eclipse/equinox/internal/p2/reconciler/dropins/DropinsRepositoryListener.java
+++ b/bundles/org.eclipse.equinox.p2.reconciler/src/org/eclipse/equinox/internal/p2/reconciler/dropins/DropinsRepositoryListener.java
@@ -249,10 +249,10 @@ public class DropinsRepositoryListener extends RepositoryListener {
repository.setProperty(key, value);
}
- public IMetadataRepository[] getMetadataRepositories() {
+ public Collection getMetadataRepositories() {
List result = new ArrayList(metadataRepositories);
result.add(getMetadataRepository());
- return (IMetadataRepository[]) result.toArray(new IMetadataRepository[0]);
+ return result;
}
}
diff --git a/bundles/org.eclipse.equinox.p2.reconciler/src/org/eclipse/equinox/internal/p2/reconciler/dropins/Messages.java b/bundles/org.eclipse.equinox.p2.reconciler/src/org/eclipse/equinox/internal/p2/reconciler/dropins/Messages.java
index aa0e61b27..d20774237 100644
--- a/bundles/org.eclipse.equinox.p2.reconciler/src/org/eclipse/equinox/internal/p2/reconciler/dropins/Messages.java
+++ b/bundles/org.eclipse.equinox.p2.reconciler/src/org/eclipse/equinox/internal/p2/reconciler/dropins/Messages.java
@@ -18,6 +18,7 @@ import org.eclipse.osgi.util.NLS;
public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.equinox.internal.p2.reconciler.dropins.messages"; //$NON-NLS-1$
public static String artifact_repo_manager_not_registered;
+ public static String errorLoadingRepository;
public static String errorProcessingConfg;
public static String metadata_repo_manager_not_registered;
static {
diff --git a/bundles/org.eclipse.equinox.p2.reconciler/src/org/eclipse/equinox/internal/p2/reconciler/dropins/PlatformXmlListener.java b/bundles/org.eclipse.equinox.p2.reconciler/src/org/eclipse/equinox/internal/p2/reconciler/dropins/PlatformXmlListener.java
index 889a010a8..e11924ae9 100644
--- a/bundles/org.eclipse.equinox.p2.reconciler/src/org/eclipse/equinox/internal/p2/reconciler/dropins/PlatformXmlListener.java
+++ b/bundles/org.eclipse.equinox.p2.reconciler/src/org/eclipse/equinox/internal/p2/reconciler/dropins/PlatformXmlListener.java
@@ -14,12 +14,15 @@ import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.*;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
+import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
import org.eclipse.equinox.internal.p2.update.*;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
import org.eclipse.equinox.internal.provisional.p2.directorywatcher.DirectoryChangeListener;
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
+import org.eclipse.osgi.service.datalocation.Location;
+import org.eclipse.osgi.util.NLS;
/**
* @since 1.0
@@ -42,6 +45,18 @@ public class PlatformXmlListener extends DirectoryChangeListener {
this.root = file;
}
+ /*
+ * Do a look-up and return the OSGi install area if it is set.
+ */
+ private static URL getOSGiInstallArea() {
+ Location location = (Location) ServiceHelper.getService(Activator.getContext(), Location.class.getName(), Location.INSTALL_FILTER);
+ if (location == null)
+ return null;
+ if (!location.isSet())
+ return null;
+ return location.getURL();
+ }
+
/* (non-Javadoc)
* @see org.eclipse.equinox.internal.provisional.p2.directorywatcher.IDirectoryChangeListener#added(java.io.File)
*/
@@ -94,18 +109,17 @@ public class PlatformXmlListener extends DirectoryChangeListener {
if (changed) {
lastModified = root.lastModified();
try {
- Configuration configuration = ConfigurationParser.parse(root, (URL) null);
+ Configuration configuration = ConfigurationParser.parse(root, getOSGiInstallArea());
synchronizeConfiguration(configuration);
} catch (ProvisionException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ LogHelper.log(new Status(IStatus.ERROR, Activator.ID, Messages.errorProcessingConfg, e));
}
}
changed = false;
}
- public List getMetadataRepositories() {
- return makeList(configRepositories);
+ public Collection getMetadataRepositories() {
+ return configRepositories;
}
private IMetadataRepository getMatchingRepo(Collection repositoryList, String urlString) {
@@ -127,7 +141,7 @@ public class PlatformXmlListener extends DirectoryChangeListener {
for (Iterator iter = sites.iterator(); iter.hasNext();) {
String siteURL = ((Site) iter.next()).getUrl();
// TODO: this is our way of skipping the base.
- // we will need to change this to platform:base: at some point
+ // we will need to change this to platform:/base/ at some point
if ("file:.".equals(siteURL) || "file:".equals(siteURL)) //$NON-NLS-1$//$NON-NLS-2$
continue;
if (siteURL.startsWith("file:") && siteURL.endsWith("/eclipse/")) //$NON-NLS-1$//$NON-NLS-2$
@@ -142,11 +156,9 @@ public class PlatformXmlListener extends DirectoryChangeListener {
Activator.loadArtifactRepository(repoURL);
newRepos.add(newRepo);
} catch (MalformedURLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ LogHelper.log(new Status(IStatus.ERROR, Activator.ID, NLS.bind(Messages.errorLoadingRepository, siteURL), e));
} catch (ProvisionException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ LogHelper.log(new Status(IStatus.ERROR, Activator.ID, NLS.bind(Messages.errorLoadingRepository, siteURL), e));
}
}
}
@@ -154,18 +166,6 @@ public class PlatformXmlListener extends DirectoryChangeListener {
if (newRepos.isEmpty())
return;
configRepositories = newRepos;
- Activator.synchronize(makeList(newRepos), null);
+ Activator.synchronize(newRepos, null);
}
-
- // TODO: this is a kludge to fix collection impedance mismatch
- // between the xml listener and the activator; get rid of it!
- private List makeList(Set set) {
- List list = new ArrayList((set != null ? set.size() : 0));
- if (set != null) {
- for (Iterator iter = set.iterator(); iter.hasNext();)
- list.add(iter.next());
- }
- return list;
- }
-
}
diff --git a/bundles/org.eclipse.equinox.p2.reconciler/src/org/eclipse/equinox/internal/p2/reconciler/dropins/messages.properties b/bundles/org.eclipse.equinox.p2.reconciler/src/org/eclipse/equinox/internal/p2/reconciler/dropins/messages.properties
index 063c54356..d8066d062 100644
--- a/bundles/org.eclipse.equinox.p2.reconciler/src/org/eclipse/equinox/internal/p2/reconciler/dropins/messages.properties
+++ b/bundles/org.eclipse.equinox.p2.reconciler/src/org/eclipse/equinox/internal/p2/reconciler/dropins/messages.properties
@@ -9,5 +9,6 @@
# IBM Corporation - initial API and implementation
###############################################################################
artifact_repo_manager_not_registered=ArtifactRepositoryManager not registered.
+errorLoadingRepository=Error occurred while loading repository at {0}.
errorProcessingConfg=Exception while processing configuration.
-metadata_repo_manager_not_registered=MetadataRepositoryManager not registered.
+metadata_repo_manager_not_registered=MetadataRepositoryManager not registered. \ No newline at end of file

Back to the top