]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - runtime/org.argeo.slc.support.osgi/src/main/java/org/argeo/slc/osgi/build/AbstractOsgiModularDistribution.java
Improve OSGi factory
[gpl/argeo-slc.git] / runtime / org.argeo.slc.support.osgi / src / main / java / org / argeo / slc / osgi / build / AbstractOsgiModularDistribution.java
index 65ad39f256e39475da4fceaed131f7526532bd10..2827c86d6f937fd7707b6e89618e9a24e94aa67d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org>
+ * Copyright (C) 2007-2012 Argeo GmbH
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.argeo.slc.osgi.build;
 
 import java.util.ArrayList;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 import java.util.SortedMap;
@@ -25,12 +25,12 @@ import java.util.TreeMap;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.argeo.slc.DefaultNameVersion;
+import org.argeo.slc.NameVersion;
 import org.argeo.slc.SlcException;
 import org.argeo.slc.UnsupportedException;
-import org.argeo.slc.build.BasicNameVersion;
 import org.argeo.slc.build.Distribution;
 import org.argeo.slc.build.ModularDistribution;
-import org.argeo.slc.build.NameVersion;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
 import org.springframework.beans.factory.InitializingBean;
@@ -53,21 +53,25 @@ public abstract class AbstractOsgiModularDistribution implements
 
        public Distribution getModuleDistribution(String moduleName,
                        String moduleVersion) {
-               return distributions
-                               .get(new BasicNameVersion(moduleName, moduleVersion));
+               return distributions.get(new DefaultNameVersion(moduleName,
+                               moduleVersion));
        }
 
        public String getDistributionId() {
                return bundleContext.getBundle().getSymbolicName()
                                + "-"
-                               + bundleContext.getBundle().getHeaders().get(
-                                               Constants.BUNDLE_VERSION);
+                               + bundleContext.getBundle().getHeaders()
+                                               .get(Constants.BUNDLE_VERSION);
        }
 
        public Set<NameVersion> listModulesNameVersions() {
                return distributions.keySet();
        }
 
+       public Iterator<NameVersion> nameVersions() {
+               return distributions.keySet().iterator();
+       }
+
        public void setBundleContext(BundleContext bundleContext) {
                this.bundleContext = bundleContext;
        }
@@ -153,13 +157,13 @@ public abstract class AbstractOsgiModularDistribution implements
        }
 
        public String getVersion() {
-               return bundleContext.getBundle().getHeaders().get(
-                               Constants.BUNDLE_VERSION).toString();
+               return bundleContext.getBundle().getHeaders()
+                               .get(Constants.BUNDLE_VERSION).toString();
        }
 
        @Override
        public String toString() {
-               return new BasicNameVersion(this).toString();
+               return new DefaultNameVersion(this).toString();
        }
 
        public void setEclipseUpdateSite(EclipseUpdateSite eclipseUpdateSite) {