patch for FELIX-1583 - refactored LDAP and VersionRange classes into own bundle


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@814023 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/sigil/ivy/resolver/sigil.properties b/sigil/ivy/resolver/sigil.properties
index 18622f6..820e8c4 100644
--- a/sigil/ivy/resolver/sigil.properties
+++ b/sigil/ivy/resolver/sigil.properties
@@ -5,18 +5,18 @@
 	org.apache.felix.sigil.ivy.resolver, \
 
 -contents: \
-  org.apache.felix.sigil.*, \
-  profiles.*, \
-  org.osgi.framework, \
+	profiles.*, \
+	org.osgi.framework, \
+	org.apache.felix.sigil.*, \
 
 -imports: \
 	org.apache.felix.sigil.bnd, \
+	org.apache.felix.sigil.common.osgi, \
 	org.apache.felix.sigil.config, \
 	org.apache.felix.sigil.core, \
 	org.apache.felix.sigil.core.licence, \
 	org.apache.felix.sigil.core.repository, \
 	org.apache.felix.sigil.model, \
-	org.apache.felix.sigil.model.common, \
 	org.apache.felix.sigil.model.eclipse, \
 	org.apache.felix.sigil.model.osgi, \
 	org.apache.felix.sigil.obr, \
@@ -37,6 +37,7 @@
 	org.apache.ivy.util, \
 	org.apache.tools.ant, \
 	org.apache.tools.ant.types, \
+	org.eclipse.core.runtime;version=3.4.0, \
 	org.osgi.framework, \
 
 -requires: \
diff --git a/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/ProjectRepository.java b/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/ProjectRepository.java
index dec8b2b..004b4d5 100644
--- a/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/ProjectRepository.java
+++ b/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/ProjectRepository.java
@@ -28,13 +28,13 @@
 import java.util.Collection;
 import java.util.List;
 
+import org.apache.felix.sigil.common.osgi.VersionRange;
 import org.apache.felix.sigil.config.BldFactory;
 import org.apache.felix.sigil.config.IBldProject;
 import org.apache.felix.sigil.config.IBldProject.IBldBundle;
 import org.apache.felix.sigil.core.internal.model.eclipse.SigilBundle;
 import org.apache.felix.sigil.core.internal.model.osgi.BundleModelElement;
 import org.apache.felix.sigil.core.licence.ILicensePolicy;
-import org.apache.felix.sigil.model.common.VersionRange;
 import org.apache.felix.sigil.model.eclipse.ISigilBundle;
 import org.apache.felix.sigil.model.osgi.IBundleModelElement;
 import org.apache.felix.sigil.model.osgi.IPackageExport;
diff --git a/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/SigilParser.java b/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/SigilParser.java
index 54555e7..1bb30b9 100644
--- a/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/SigilParser.java
+++ b/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/SigilParser.java
@@ -31,10 +31,10 @@
 import java.util.Map;
 import java.util.regex.Pattern;
 
+import org.apache.felix.sigil.common.osgi.VersionRange;
 import org.apache.felix.sigil.config.BldFactory;
 import org.apache.felix.sigil.config.IBldProject;
 import org.apache.felix.sigil.model.IModelElement;
-import org.apache.felix.sigil.model.common.VersionRange;
 import org.apache.felix.sigil.model.eclipse.ISigilBundle;
 import org.apache.felix.sigil.model.osgi.IBundleModelElement;
 import org.apache.felix.sigil.model.osgi.IPackageImport;
diff --git a/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/SigilResolver.java b/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/SigilResolver.java
index f41a3aa..5daad06 100644
--- a/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/SigilResolver.java
+++ b/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/SigilResolver.java
@@ -37,10 +37,10 @@
 import java.util.jar.JarInputStream;
 import java.util.jar.Manifest;
 
+import org.apache.felix.sigil.common.osgi.VersionRange;
 import org.apache.felix.sigil.config.BldFactory;
 import org.apache.felix.sigil.core.internal.model.osgi.RequiredBundle;
 import org.apache.felix.sigil.model.IModelElement;
-import org.apache.felix.sigil.model.common.VersionRange;
 import org.apache.felix.sigil.model.eclipse.ISigilBundle;
 import org.apache.felix.sigil.model.osgi.IBundleModelElement;
 import org.apache.felix.sigil.repository.IResolution;
@@ -54,6 +54,7 @@
 import org.apache.ivy.plugins.resolver.BasicResolver;
 import org.apache.ivy.plugins.resolver.util.ResolvedResource;
 import org.apache.ivy.util.FileUtil;
+import org.eclipse.core.runtime.IPath;
 
 
 /**
@@ -386,11 +387,10 @@
 
         private boolean bundleContains( ISigilBundle bundle, String j )
         {
-            URI uri = bundle.getBundleInfo().getUpdateLocation();
             InputStream is = null;
             try
             {
-                URL url = ( uri != null ) ? uri.toURL() : bundle.getLocation().toFile().toURL();
+                URL url = getURL( bundle );
                 is = url.openStream();
                 JarInputStream js = new JarInputStream( is, false );
                 JarEntry entry;
@@ -427,11 +427,10 @@
             if ( bundle == null )
                 return null;
 
-            URI uri = bundle.getBundleInfo().getUpdateLocation();
             InputStream is = null;
             try
             {
-                URL url = ( uri != null ) ? uri.toURL() : bundle.getLocation().toFile().toURL();
+                URL url = getURL( bundle );
                 is = url.openStream();
                 JarInputStream js = new JarInputStream( is, false );
                 Manifest m = js.getManifest();
@@ -459,6 +458,22 @@
         }
 
 
+        private URL getURL( ISigilBundle bundle ) throws MalformedURLException
+        {
+            URI uri = bundle.getBundleInfo().getUpdateLocation();
+            if ( uri != null ) {
+                return uri.toURL();
+            }
+            else {
+                IPath path = bundle.getLocation();
+                if ( path == null ) {
+                    throw new NullPointerException( "Missing location for " + bundle.getSymbolicName() );
+                }
+                return path.toFile().toURI().toURL();
+            }
+        }
+
+
         public String toString()
         {
             return "SigilIvy[" + name + "]";