You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ds...@apache.org on 2010/07/28 20:30:12 UTC

svn commit: r980146 - in /felix/trunk/sigil: common/core/src/org/apache/felix/sigil/bnd/ common/core/src/org/apache/felix/sigil/config/ common/core/src/org/apache/felix/sigil/config/internal/ common/core/src/org/apache/felix/sigil/core/ common/core/src...

Author: dsavage
Date: Wed Jul 28 18:30:10 2010
New Revision: 980146

URL: http://svn.apache.org/viewvc?rev=980146&view=rev
Log:
Remove dependency on IPath (FELIX-1509)
Created new Resource concept to encode BND concepts foo, foo=foo, {foo=foo}, @foo (FELIX-1814)

Added:
    felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/Resource.java
    felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/internal/
    felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/internal/AbstractResource.java
    felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/internal/InlineResource.java
    felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/internal/PreprocessedResource.java
    felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/internal/StandardResource.java
    felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/PathUtil.java
Modified:
    felix/trunk/sigil/common/core/src/org/apache/felix/sigil/bnd/BundleBuilder.java
    felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/BldConverter.java
    felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/BldProject.java
    felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/IBldProject.java
    felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/BldCore.java
    felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/eclipse/SigilBundle.java
    felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/repository/DirectoryHelper.java
    felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/repository/FileSystemRepository.java
    felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/repository/FileSystemRepositoryProvider.java
    felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/repository/SystemRepository.java
    felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/repository/SystemRepositoryProvider.java
    felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/ISigilBundle.java
    felix/trunk/sigil/common/obr/src/org/apache/felix/sigil/obr/impl/OBRHandler.java
    felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/SigilCore.java
    felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/model/project/SigilProject.java
    felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/repository/eclipse/OSGiInstallRepository.java
    felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/model/util/JavaHelper.java
    felix/trunk/sigil/eclipse/runtime/src/org/apache/felix/sigil/eclipse/runtime/RuntimeBundleResolver.java
    felix/trunk/sigil/eclipse/search/src/org/apache/felix/sigil/search/SigilSearch.java
    felix/trunk/sigil/eclipse/ui/sigil.properties
    felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/ResourceBuildSection.java
    felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/SigilResolver.java

Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/bnd/BundleBuilder.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/bnd/BundleBuilder.java?rev=980146&r1=980145&r2=980146&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/bnd/BundleBuilder.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/bnd/BundleBuilder.java Wed Jul 28 18:30:10 2010
@@ -36,6 +36,7 @@ import java.util.jar.Attributes;
 import org.apache.felix.sigil.common.osgi.VersionRange;
 import org.apache.felix.sigil.config.BldAttr;
 import org.apache.felix.sigil.config.IBldProject;
+import org.apache.felix.sigil.config.Resource;
 import org.apache.felix.sigil.config.IBldProject.IBldBundle;
 import org.apache.felix.sigil.core.repository.SystemRepositoryProvider;
 import org.apache.felix.sigil.model.osgi.IPackageExport;
@@ -188,7 +189,12 @@ public class BundleBuilder
 
         if (log != null)
         {
-            log.verbose("BND instructions: " + spec.toString());
+            log.verbose("Generated " + bundle.getSymbolicName());
+            log.verbose("-----------------------------");
+            for(Map.Entry<Object, Object> e : spec.entrySet()) {
+                log.verbose(e.getKey() + "=" + e.getValue());
+                log.verbose("-----------------------------");
+            }
             log.verbose("BND classpath: " + Arrays.asList(classpath));
         }
 
@@ -449,7 +455,7 @@ public class BundleBuilder
             addVersions(fh.getVersions(), sb);
             spec.setProperty(Constants.FRAGMENT_HOST, sb.toString());
         }
-
+        
         return spec;
     }
 
@@ -540,109 +546,21 @@ public class BundleBuilder
 
     private void addResources(IBldBundle bundle, Properties spec)
     {
-        Map<String, String> resources = bundle.getResources();
+        List<Resource> resources = bundle.getResources();
         StringBuilder sb = new StringBuilder();
 
-        for (String bPath : resources.keySet())
+        for (Resource bPath : resources)
         {
-            if (bPath.startsWith("@"))
-            {
-                handleInlineJar(bundle, sb, bPath);
-            }
-            else if (bPath.startsWith("{"))
-            {
-                handlePreprocessedResource(bundle, resources, sb, bPath);
-            }
-            else
-            {
-                handleStandardResource(bundle, resources, sb, bPath);
-            }
+            if (sb.length() > 0)
+                sb.append(",");
+            
+            sb.append(bPath.toBNDInstruction(classpath));
         }
 
         if (sb.length() > 0)
             spec.setProperty(Constants.INCLUDE_RESOURCE, sb.toString());
     }
 
-    private void handlePreprocessedResource(IBldBundle bundle,
-        Map<String, String> resources, StringBuilder sb, String bPath)
-    {
-        String fsPath = resources.get(bPath);
-
-        bPath = bPath.substring(1, bPath.length() - 1);
-
-        if ("".equals(fsPath))
-            fsPath = bPath;
-
-        fsPath = findFileSystemPath(bundle, fsPath);
-
-        if (sb.length() > 0)
-            sb.append(",");
-        sb.append("{");
-        sb.append(bPath);
-        sb.append('=');
-        sb.append(fsPath);
-        sb.append("}");
-    }
-
-    private void handleStandardResource(IBldBundle bundle, Map<String, String> resources,
-        StringBuilder sb, String bPath)
-    {
-        String fsPath = resources.get(bPath);
-        if ("".equals(fsPath))
-            fsPath = bPath;
-
-        fsPath = findFileSystemPath(bundle, fsPath);
-
-        if (sb.length() > 0)
-            sb.append(",");
-        sb.append(bPath);
-        sb.append('=');
-        sb.append(fsPath);
-    }
-
-    private String findFileSystemPath(IBldBundle bundle, String fsPath)
-    {
-        File resolved = bundle.resolve(fsPath);
-
-        // fsPath may contain Bnd variable, making path appear to not exist
-
-        if (!resolved.exists())
-        {
-            // Bnd already looks for classpath jars
-            File found = findInClasspathDir(fsPath);
-            if (found != null)
-            {
-                fsPath = found.getPath();
-            }
-            else
-            {
-                fsPath = resolved.getAbsolutePath();
-            }
-        }
-        else
-        {
-            fsPath = resolved.getAbsolutePath();
-        }
-
-        return fsPath;
-    }
-
-    private void handleInlineJar(IBldBundle bundle, StringBuilder sb, String bPath)
-    {
-        if (sb.length() > 0)
-            sb.append(",");
-
-        File f = bundle.resolve(bPath.substring(1));
-
-        if (f.exists())
-        {
-            sb.append('@');
-            sb.append(f);
-        }
-        else
-            sb.append(bPath);
-    }
-
     private List<IPackageImport> getImports(IBldBundle bundle)
     {
         List<IPackageImport> imports = bundle.getImports();

Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/BldConverter.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/BldConverter.java?rev=980146&r1=980145&r2=980146&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/BldConverter.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/BldConverter.java Wed Jul 28 18:30:10 2010
@@ -42,8 +42,6 @@ import org.apache.felix.sigil.model.osgi
 import org.apache.felix.sigil.model.osgi.IPackageExport;
 import org.apache.felix.sigil.model.osgi.IPackageImport;
 import org.apache.felix.sigil.model.osgi.IRequiredBundle;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
 
 import aQute.lib.osgi.Constants;
 
@@ -139,15 +137,10 @@ public class BldConverter
 
         // resources
         // FIXME: UI doesn't support -resources: path1=path2
-        Map<String, String> resources = bundle.getResources();
-        for ( String resource : resources.keySet() )
+        List<Resource> resources = bundle.getResources();
+        for ( Resource resource : resources )
         {
-            String fsPath = resources.get( resource );
-            if ( !"".equals( fsPath ) )
-            {
-                BldCore.error( "FIXME: can't convert resource: " + resource + "=" + fsPath );
-            }
-            sigilBundle.addSourcePath( new Path( resource ) );
+            sigilBundle.addSourcePath( resource );
         }
 
         ////////////////////
@@ -328,7 +321,7 @@ public class BldConverter
     {
         // resources
         ArrayList<String> resources = new ArrayList<String>();
-        for ( IPath ipath : bundle.getSourcePaths() )
+        for ( Resource ipath : bundle.getSourcePaths() )
         {
             resources.add( ipath.toString() );
         }

Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/BldProject.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/BldProject.java?rev=980146&r1=980145&r2=980146&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/BldProject.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/BldProject.java Wed Jul 28 18:30:10 2010
@@ -36,7 +36,6 @@ import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
@@ -44,6 +43,9 @@ import java.util.TreeSet;
 
 import org.apache.felix.sigil.common.osgi.VersionRange;
 import org.apache.felix.sigil.common.osgi.VersionTable;
+import org.apache.felix.sigil.config.internal.InlineResource;
+import org.apache.felix.sigil.config.internal.PreprocessedResource;
+import org.apache.felix.sigil.config.internal.StandardResource;
 import org.apache.felix.sigil.core.internal.model.osgi.BundleModelElement;
 import org.apache.felix.sigil.core.internal.model.osgi.PackageExport;
 import org.apache.felix.sigil.core.internal.model.osgi.PackageImport;
@@ -183,7 +185,7 @@ public class BldProject implements IBldP
                 }
                 file = file.getCanonicalFile();
                 
-                URL url = file.toURL();
+                URL url = file.toURI().toURL();
                 BldProperties bp = new BldProperties(file.getParentFile(), bldOverrides);
 
                 if (dflt == null)
@@ -287,6 +289,23 @@ public class BldProject implements IBldP
         }
         return file;
     }
+    
+    public Resource newResource(String location) {
+        String[] paths = location.split("=", 2);
+        String bPath = paths[0];
+        String fsPath = (paths.length > 1 ? paths[1] : null);
+        if (bPath.startsWith("@")) {
+            bPath = bPath.substring(1);
+            return new InlineResource(BldProject.this, bPath);
+        }
+        else if (bPath.startsWith("{")) {
+            bPath = bPath.substring(1, bPath.length() -1);
+            return new PreprocessedResource(BldProject.this, bPath, fsPath);
+        }
+        else {
+            return new StandardResource(BldProject.this, bPath, fsPath);
+        }
+    }    
 
     public String getVersion()
     {
@@ -960,23 +979,21 @@ public class BldProject implements IBldP
             return getList(BldConfig.L_CONTENTS);
         }
 
-        public Map<String, String> getResources()
+        public List<Resource> getResources()
         {
-            Map<String, String> map = new LinkedHashMap<String, String>();
             List<String> resources = getList(BldConfig.L_RESOURCES);
-
-            if (resources != null)
+            if (resources == null) {
+                return Collections.emptyList();
+            }
+            
+            List<Resource> ret = new ArrayList<Resource>(resources.size());
+            for (String resource : resources)
             {
-                for (String resource : resources)
-                {
-                    String[] paths = resource.split("=", 2);
-                    String fsPath = (paths.length > 1 ? paths[1] : "");
-                    map.put(paths[0], fsPath);
-                }
+                ret.add(newResource(resource));
             }
-            return map;
+            return ret;
         }
-
+        
         public Properties getHeaders()
         {
             Properties headers = config.getProps(id, BldConfig.P_HEADER);

Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/IBldProject.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/IBldProject.java?rev=980146&r1=980145&r2=980146&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/IBldProject.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/IBldProject.java Wed Jul 28 18:30:10 2010
@@ -136,6 +136,13 @@ public interface IBldProject
      * resolves a relative path against the project file location.
      */
     File resolve( String path );
+    
+    /**
+     * Creates a new resource for this bundle
+     * @param location
+     * @return
+     */
+    Resource newResource(String location);
 
 
     /**
@@ -211,9 +218,8 @@ public interface IBldProject
          * @return map with key as path in bundle, value as path in file system.
          * Paths are resolved relative to location of project file and also from classpath.
          */
-        Map<String, String> getResources();
-
-
+        List<Resource> getResources();
+        
         /**
          * gets additional bundle headers.
          */

Added: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/Resource.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/Resource.java?rev=980146&view=auto
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/Resource.java (added)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/Resource.java Wed Jul 28 18:30:10 2010
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.sigil.config;
+
+import java.io.File;
+
+/**
+ * @author dave
+ *
+ */
+public interface Resource
+{  
+    String toBNDInstruction(File[] classpath);
+
+    /**
+     * @return
+     */
+    String getLocalFile();
+}

Added: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/internal/AbstractResource.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/internal/AbstractResource.java?rev=980146&view=auto
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/internal/AbstractResource.java (added)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/internal/AbstractResource.java Wed Jul 28 18:30:10 2010
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.sigil.config.internal;
+
+import java.io.File;
+
+import org.apache.felix.sigil.config.IBldProject;
+import org.apache.felix.sigil.config.Resource;
+
+/**
+ * @author dave
+ *
+ */
+public abstract class AbstractResource implements Resource
+{
+    protected final String bPath;
+    protected final IBldProject project;
+    
+    protected AbstractResource(IBldProject project, String bPath) {
+        if (bPath == null) 
+            throw new NullPointerException();
+        
+        if(project == null)
+            throw new NullPointerException();
+        
+        this.bPath = bPath;
+        this.project = project;
+    }
+    
+    protected String findFileSystemPath(String fsPath, File[] classpath)
+    {
+        File resolved = project.resolve(fsPath);
+
+        // fsPath may contain Bnd variable, making path appear to not exist
+
+        if (!resolved.exists())
+        {
+            // Bnd already looks for classpath jars
+            File found = findInClasspathDir(fsPath, classpath);
+            if (found != null)
+            {
+                fsPath = found.getPath();
+            }
+            else
+            {
+                fsPath = resolved.getAbsolutePath();
+            }
+        }
+        else
+        {
+            fsPath = resolved.getAbsolutePath();
+        }
+
+        return fsPath;
+    }
+
+    private File findInClasspathDir(String file, File[] classpath)
+    {
+        for (File cp : classpath)
+        {
+            if (cp.isDirectory())
+            {
+                File path = new File(cp, file);
+                if (path.exists())
+                {
+                    return path;
+                }
+            }
+        }
+
+        return null;
+    }
+}

Added: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/internal/InlineResource.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/internal/InlineResource.java?rev=980146&view=auto
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/internal/InlineResource.java (added)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/internal/InlineResource.java Wed Jul 28 18:30:10 2010
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.sigil.config.internal;
+
+import java.io.File;
+
+import org.apache.felix.sigil.config.IBldProject;
+
+/**
+ * @author dave
+ *
+ */
+public class InlineResource extends AbstractResource
+{
+
+    /**
+     * @param bPath
+     */
+    public InlineResource(IBldProject project, String bPath)
+    {
+        super(project, bPath);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.felix.sigil.core.Resource#getLocalFile()
+     */
+    public String getLocalFile()
+    {
+        return bPath;
+    }
+    
+    public String toString() {
+        return '@' + bPath;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.felix.sigil.core.Resource#toBNDInstruction(java.io.File[])
+     */
+    public String toBNDInstruction(File[] classpath)
+    {
+        StringBuilder sb = new StringBuilder();
+        sb.append('@');
+        
+        File f = project.resolve(bPath);
+
+        if (f.exists())
+        {
+            sb.append(f);
+        }
+        else
+            sb.append(bPath);
+        
+        return sb.toString();
+    }
+
+}

Added: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/internal/PreprocessedResource.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/internal/PreprocessedResource.java?rev=980146&view=auto
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/internal/PreprocessedResource.java (added)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/internal/PreprocessedResource.java Wed Jul 28 18:30:10 2010
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.sigil.config.internal;
+
+import java.io.File;
+
+import org.apache.felix.sigil.config.IBldProject;
+
+/**
+ * @author dave
+ *
+ */
+public class PreprocessedResource extends AbstractResource
+{
+    private final String fsPath;
+    
+    public PreprocessedResource(IBldProject project, String bPath, String fsPath)
+    {
+        super(project, bPath);
+        this.fsPath = fsPath;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.felix.sigil.core.Resource#getLocalFile()
+     */
+    public String getLocalFile()
+    {
+        return fsPath == null ? bPath : fsPath;
+    }
+    
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append('{');
+        sb.append(bPath);
+        if (fsPath != null) {
+            sb.append('=');
+            sb.append(fsPath);
+        }
+        sb.append('}');
+        return sb.toString();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.felix.sigil.core.Resource#toBNDInstruction(java.io.File[])
+     */
+    public String toBNDInstruction(File[] classpath)
+    {
+        StringBuilder sb = new StringBuilder();
+        String fsp = fsPath;
+        if (fsp == null)
+            fsp = bPath;
+
+        fsp = findFileSystemPath(fsp, classpath);
+
+        sb.append('{');
+        sb.append(bPath);
+        sb.append('=');
+        sb.append(fsp);
+        sb.append('}');
+        
+        return sb.toString();
+    }
+
+}

Added: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/internal/StandardResource.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/internal/StandardResource.java?rev=980146&view=auto
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/internal/StandardResource.java (added)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/internal/StandardResource.java Wed Jul 28 18:30:10 2010
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.sigil.config.internal;
+
+import java.io.File;
+
+import org.apache.felix.sigil.config.IBldProject;
+
+/**
+ * @author dave
+ *
+ */
+public class StandardResource extends AbstractResource
+{
+    private final String fsPath;
+
+    /**
+     * @param bldProject 
+     * @param bPath2
+     * @param fsPath2
+     */
+    public StandardResource(IBldProject project, String bPath, String fsPath)
+    {
+        super(project, bPath);
+        this.fsPath = fsPath;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.felix.sigil.core.Resource#getLocalFile()
+     */
+    public String getLocalFile()
+    {
+        return fsPath == null ? bPath : fsPath;
+    }
+    
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(bPath);
+        if (fsPath != null) {
+            sb.append('=');
+            sb.append(fsPath);
+        }
+        return sb.toString();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.felix.sigil.core.Resource#toBNDInstruction(java.io.File[])
+     */
+    public String toBNDInstruction(File[] classpath)
+    {
+        StringBuilder sb = new StringBuilder();
+        String fsp = fsPath;
+        if (fsp == null)
+            fsp = bPath;
+
+        fsp = findFileSystemPath(fsp, classpath);
+
+        sb.append(bPath);
+        sb.append('=');
+        sb.append(fsp);
+        
+        return sb.toString();
+    }
+
+}

Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/BldCore.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/BldCore.java?rev=980146&r1=980145&r2=980146&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/BldCore.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/BldCore.java Wed Jul 28 18:30:10 2010
@@ -99,6 +99,5 @@ public class BldCore implements BundleAc
     {
         // TODO Auto-generated method stub
 
-    }
-
+    }    
 }

Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/eclipse/SigilBundle.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/eclipse/SigilBundle.java?rev=980146&r1=980145&r2=980146&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/eclipse/SigilBundle.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/eclipse/SigilBundle.java Wed Jul 28 18:30:10 2010
@@ -35,6 +35,7 @@ import java.util.Arrays;
 import java.util.Collection;
 import java.util.jar.JarFile;
 
+import org.apache.felix.sigil.config.Resource;
 import org.apache.felix.sigil.core.BldCore;
 import org.apache.felix.sigil.core.util.ManifestUtil;
 import org.apache.felix.sigil.model.AbstractCompoundModelElement;
@@ -43,7 +44,6 @@ import org.apache.felix.sigil.model.ecli
 import org.apache.felix.sigil.model.osgi.IBundleModelElement;
 import org.apache.felix.sigil.model.osgi.IPackageExport;
 import org.apache.felix.sigil.model.osgi.IPackageImport;
-import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.SubMonitor;
 import org.osgi.framework.Version;
@@ -59,19 +59,19 @@ public class SigilBundle extends Abstrac
     private static final long serialVersionUID = 1L;
 
     private IBundleModelElement bundle;
-    private IPath[] sourcePaths;
+    private Resource[] sourcePaths;
     private String[] classpath;
     private String[] packages;
-    private IPath location;
+    private File location;
 
-    private IPath sourcePathLocation;
-    private IPath licencePathLocation;
-    private IPath sourceRootPath;
+    private File sourcePathLocation;
+    private File licencePathLocation;
+    private String sourceRootPath;
 
     public SigilBundle()
     {
         super( "Sigil Bundle" );
-        sourcePaths = new IPath[0];
+        sourcePaths = new Resource[0];
         classpath = new String[0];
         packages = new String[0];
     }
@@ -113,10 +113,10 @@ public class SigilBundle extends Abstrac
     }
 
 
-    private void updateManifest(IPath location) throws IOException
+    private void updateManifest(File location) throws IOException
     {
         if ( location != null ) {
-            JarFile f = new JarFile(location.toFile());
+            JarFile f = new JarFile(location);
             try {
                 setBundleInfo(ManifestUtil.buildBundleModelElement(f.getManifest()));
             }
@@ -129,17 +129,17 @@ public class SigilBundle extends Abstrac
 
     public boolean isSynchronized()
     {
-        return location == null || location.toFile().exists();
+        return location == null || location.exists();
     }
 
 
-    private static void sync( IPath local, URI remote, IProgressMonitor monitor ) throws IOException
+    private static void sync( File local, URI remote, IProgressMonitor monitor ) throws IOException
     {
         try
         {
             if ( remote != null )
             {
-                if ( local != null && !local.toFile().exists() )
+                if ( local != null && !local.exists() )
                 {
                     URL url = remote.toURL();
                     URLConnection connection = url.openConnection();
@@ -159,9 +159,8 @@ public class SigilBundle extends Abstrac
                             http.setReadTimeout( 5000 );
                         }
                         in = conn.getInputStream();
-                        File f = local.toFile();
-                        f.getParentFile().mkdirs();
-                        out = new FileOutputStream( f );
+                        local.getParentFile().mkdirs();
+                        out = new FileOutputStream( local );
                         stream( in, out, monitor );
                     }
                     finally
@@ -181,7 +180,7 @@ public class SigilBundle extends Abstrac
         }
         catch ( IOException e )
         {
-            local.toFile().delete();
+            local.delete();
             throw e;
         }
     }
@@ -230,24 +229,24 @@ public class SigilBundle extends Abstrac
     }
 
 
-    public void addSourcePath( IPath path )
+    public void addSourcePath( Resource path )
     {
-        ArrayList<IPath> tmp = new ArrayList<IPath>(getSourcePaths());
+        ArrayList<Resource> tmp = new ArrayList<Resource>(getSourcePaths());
         tmp.add(path);
-        sourcePaths = tmp.toArray( new IPath[tmp.size()] );
+        sourcePaths = tmp.toArray( new Resource[tmp.size()] );
     }
 
 
-    public void removeSourcePath( IPath path )
+    public void removeSourcePath( Resource path )
     {
-        ArrayList<IPath> tmp = new ArrayList<IPath>(getSourcePaths());
+        ArrayList<Resource> tmp = new ArrayList<Resource>(getSourcePaths());
         if ( tmp.remove(path) ) {
-            sourcePaths = tmp.toArray( new IPath[tmp.size()] );
+            sourcePaths = tmp.toArray( new Resource[tmp.size()] );
         }
     }
 
 
-    public Collection<IPath> getSourcePaths()
+    public Collection<Resource> getSourcePaths()
     {
         return Arrays.asList(sourcePaths);
     }
@@ -255,7 +254,7 @@ public class SigilBundle extends Abstrac
 
     public void clearSourcePaths()
     {
-        sourcePaths = new IPath[0];
+        sourcePaths = new Resource[0];
     }
 
 
@@ -282,49 +281,49 @@ public class SigilBundle extends Abstrac
     }
 
 
-    public IPath getLocation()
+    public File getLocation()
     {
         return location;
     }
 
 
-    public void setLocation( IPath location )
+    public void setLocation( File location )
     {
         this.location = location;
     }
 
 
-    public IPath getSourcePathLocation()
+    public File getSourcePathLocation()
     {
         return sourcePathLocation;
     }
 
 
-    public IPath getSourceRootPath()
+    public void setSourcePathLocation( File location )
     {
-        return sourceRootPath;
+        this.sourcePathLocation = location;
     }
 
 
-    public void setSourcePathLocation( IPath location )
+    public String getSourceRootPath()
     {
-        this.sourcePathLocation = location;
+        return sourceRootPath;
     }
 
 
-    public void setSourceRootPath( IPath location )
+    public void setSourceRootPath( String location )
     {
         this.sourceRootPath = location;
     }
 
 
-    public IPath getLicencePathLocation()
+    public File getLicencePathLocation()
     {
         return licencePathLocation;
     }
 
 
-    public void setLicencePathLocation( IPath licencePathLocation )
+    public void setLicencePathLocation( File licencePathLocation )
     {
         this.licencePathLocation = licencePathLocation;
     }
@@ -443,7 +442,7 @@ public class SigilBundle extends Abstrac
         SigilBundle b = (SigilBundle) super.clone();
         b.bundle = (IBundleModelElement) b.bundle.clone();
         
-        IPath[] newPaths = new IPath[b.sourcePaths.length];
+        Resource[] newPaths = new Resource[b.sourcePaths.length];
         System.arraycopy(b.sourcePaths, 0, newPaths, 0, b.sourcePaths.length);
         b.sourcePaths = newPaths;
         

Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/repository/DirectoryHelper.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/repository/DirectoryHelper.java?rev=980146&r1=980145&r2=980146&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/repository/DirectoryHelper.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/repository/DirectoryHelper.java Wed Jul 28 18:30:10 2010
@@ -32,17 +32,13 @@ import org.apache.felix.sigil.model.Mode
 import org.apache.felix.sigil.model.eclipse.ISigilBundle;
 import org.apache.felix.sigil.model.osgi.IBundleModelElement;
 import org.apache.felix.sigil.repository.AbstractBundleRepository;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
 
 
 public class DirectoryHelper
 {
-    public static void scanBundles( AbstractBundleRepository repository, List<ISigilBundle> bundles, IPath path,
-        IPath source, boolean recursive )
+    public static void scanBundles( AbstractBundleRepository repository, List<ISigilBundle> bundles, File dir,
+        File source, boolean recursive )
     {
-        File dir = path.toFile();
-
         if ( dir.exists() )
         {
             for ( File f : dir.listFiles() )
@@ -51,7 +47,7 @@ public class DirectoryHelper
                 {
                     if ( recursive )
                     {
-                        scanBundles( repository, bundles, new Path( f.getAbsolutePath() ), source, recursive );
+                        scanBundles( repository, bundles, f, source, recursive );
                     }
                 }
                 else if ( f.isFile() && f.getName().endsWith( ".jar" ) )
@@ -64,7 +60,8 @@ public class DirectoryHelper
                         if ( bundle != null )
                         {
                             bundle.setSourcePathLocation( source );
-                            bundle.setSourceRootPath( new Path( "src" ) );
+                            // TODO shouldn't be hard coded
+                            bundle.setSourceRootPath( "src" );
                             bundles.add( bundle );
                         }
                     }
@@ -110,7 +107,7 @@ public class DirectoryHelper
         {
             bundle = ModelElementFactory.getInstance().newModelElement( ISigilBundle.class );
             bundle.addChild( info );
-            bundle.setLocation( new Path( f.getAbsolutePath() ) );
+            bundle.setLocation( f );
         }
 
         return bundle;

Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/repository/FileSystemRepository.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/repository/FileSystemRepository.java?rev=980146&r1=980145&r2=980146&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/repository/FileSystemRepository.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/repository/FileSystemRepository.java Wed Jul 28 18:30:10 2010
@@ -20,26 +20,26 @@
 package org.apache.felix.sigil.core.repository;
 
 
+import java.io.File;
 import java.util.ArrayList;
 
 import org.apache.felix.sigil.model.eclipse.ISigilBundle;
 import org.apache.felix.sigil.repository.AbstractBundleRepository;
 import org.apache.felix.sigil.repository.IRepositoryVisitor;
-import org.eclipse.core.runtime.IPath;
 
 
 public class FileSystemRepository extends AbstractBundleRepository
 {
 
     private ArrayList<ISigilBundle> bundles;
-    private IPath path;
+    private File dir;
     private boolean recurse;
 
 
-    public FileSystemRepository( String id, IPath path, boolean recurse )
+    public FileSystemRepository( String id, File dir, boolean recurse )
     {
         super( id );
-        this.path = path;
+        this.dir = dir;
         this.recurse = recurse;
     }
 
@@ -52,7 +52,7 @@ public class FileSystemRepository extend
             if ( bundles == null )
             {
                 bundles = new ArrayList<ISigilBundle>();
-                DirectoryHelper.scanBundles( this, bundles, path, null, recurse );
+                DirectoryHelper.scanBundles( this, bundles, dir, null, recurse );
             }
         }
 

Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/repository/FileSystemRepositoryProvider.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/repository/FileSystemRepositoryProvider.java?rev=980146&r1=980145&r2=980146&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/repository/FileSystemRepositoryProvider.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/repository/FileSystemRepositoryProvider.java Wed Jul 28 18:30:10 2010
@@ -26,7 +26,6 @@ import java.util.Properties;
 import org.apache.felix.sigil.repository.IBundleRepository;
 import org.apache.felix.sigil.repository.IRepositoryProvider;
 import org.apache.felix.sigil.repository.RepositoryException;
-import org.eclipse.core.runtime.Path;
 
 
 public class FileSystemRepositoryProvider implements IRepositoryProvider
@@ -34,13 +33,14 @@ public class FileSystemRepositoryProvide
 
     public IBundleRepository createRepository( String id, Properties preferences ) throws RepositoryException
     {
-        String dir = preferences.getProperty( "dir" );
-        if ( !new File( dir ).isDirectory() )
+        String dirStr = preferences.getProperty( "dir" );
+        File dir = new File( dirStr );
+        if ( !dir.isDirectory() )
         {
             throw new RepositoryException( "directory '" + dir + "' does not exist." );
         }
         boolean recurse = Boolean.valueOf( preferences.getProperty( "recurse" ) );
-        return new FileSystemRepository( id, new Path( dir ), recurse );
+        return new FileSystemRepository( id, dir, recurse );
     }
 
 }

Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/repository/SystemRepository.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/repository/SystemRepository.java?rev=980146&r1=980145&r2=980146&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/repository/SystemRepository.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/repository/SystemRepository.java Wed Jul 28 18:30:10 2010
@@ -20,6 +20,7 @@
 package org.apache.felix.sigil.core.repository;
 
 
+import java.io.File;
 import java.io.IOException;
 import java.util.jar.JarFile;
 
@@ -31,17 +32,16 @@ import org.apache.felix.sigil.model.osgi
 import org.apache.felix.sigil.model.osgi.IPackageExport;
 import org.apache.felix.sigil.repository.AbstractBundleRepository;
 import org.apache.felix.sigil.repository.IRepositoryVisitor;
-import org.eclipse.core.runtime.IPath;
 
 
 public class SystemRepository extends AbstractBundleRepository
 {
 
     private final String packages;
-    private final IPath frameworkPath;
+    private final File frameworkPath;
 
 
-    public SystemRepository( String id, IPath frameworkPath, String packages )
+    public SystemRepository( String id, File frameworkPath, String packages )
     {
         super( id );
         this.frameworkPath = frameworkPath;
@@ -77,7 +77,7 @@ public class SystemRepository extends Ab
                 if ( frameworkPath != null )
                 {
                     systemBundle.setLocation( frameworkPath );
-                    jar = new JarFile( frameworkPath.toFile() );
+                    jar = new JarFile(frameworkPath);
                     info = buildBundleModelElement( jar.getManifest() );
                 }
                 else

Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/repository/SystemRepositoryProvider.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/repository/SystemRepositoryProvider.java?rev=980146&r1=980145&r2=980146&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/repository/SystemRepositoryProvider.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/repository/SystemRepositoryProvider.java Wed Jul 28 18:30:10 2010
@@ -20,6 +20,7 @@
 package org.apache.felix.sigil.core.repository;
 
 
+import java.io.File;
 import java.io.IOException;
 
 import java.io.InputStream;
@@ -28,7 +29,6 @@ import java.util.Properties;
 import org.apache.felix.sigil.repository.IBundleRepository;
 import org.apache.felix.sigil.repository.IRepositoryProvider;
 import org.apache.felix.sigil.repository.RepositoryException;
-import org.eclipse.core.runtime.Path;
 
 public class SystemRepositoryProvider implements IRepositoryProvider
 {
@@ -36,7 +36,7 @@ public class SystemRepositoryProvider im
     public IBundleRepository createRepository( String id, Properties properties ) throws RepositoryException
     {
         String fw = properties.getProperty( "framework" );
-        Path frameworkPath = fw == null ? null : new Path( fw );
+        File frameworkPath = fw == null ? null : new File( fw );
         String extraPkgs = properties.getProperty( "packages" );
         String profile = properties.getProperty( "profile" );
         

Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/ISigilBundle.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/ISigilBundle.java?rev=980146&r1=980145&r2=980146&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/ISigilBundle.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/ISigilBundle.java Wed Jul 28 18:30:10 2010
@@ -20,11 +20,12 @@
 package org.apache.felix.sigil.model.eclipse;
 
 
+import java.io.File;
 import java.io.IOException;
 import java.util.Collection;
 
-import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
+import org.apache.felix.sigil.config.Resource;
 import org.apache.felix.sigil.model.ICompoundModelElement;
 import org.apache.felix.sigil.model.osgi.IBundleModelElement;
 import org.apache.felix.sigil.model.osgi.IPackageExport;
@@ -53,13 +54,14 @@ public interface ISigilBundle extends IC
     void setBundleInfo( IBundleModelElement bundle );
 
 
-    void addSourcePath( IPath path );
+    // TODO rename this method...
+    void addSourcePath( Resource path );
 
 
-    void removeSourcePath( IPath path );
+    void removeSourcePath( Resource path );
 
 
-    Collection<IPath> getSourcePaths();
+    Collection<Resource> getSourcePaths();
 
 
     void clearSourcePaths();
@@ -74,28 +76,30 @@ public interface ISigilBundle extends IC
     void removeClasspathEntry( String encodedClasspath );
 
 
-    IPath getLocation();
+    // XXX must be file due to SiglCore.isBundlePath
+    File getLocation();
 
 
-    void setLocation( IPath location );
+    // XXX must be file due to SiglCore.isBundlePath
+    void setLocation( File location );
 
 
-    IPath getSourcePathLocation();
+    File getSourcePathLocation();
 
 
-    void setSourcePathLocation( IPath location );
+    void setSourcePathLocation( File location );
 
 
-    IPath getSourceRootPath();
+    String getSourceRootPath();
 
 
-    void setSourceRootPath( IPath location );
+    void setSourceRootPath( String location );
 
 
-    void setLicencePathLocation( IPath cacheSourceLocation );
+    void setLicencePathLocation( File cacheSourceLocation );
 
 
-    IPath getLicencePathLocation();
+    File getLicencePathLocation();
 
 
     /**

Modified: felix/trunk/sigil/common/obr/src/org/apache/felix/sigil/obr/impl/OBRHandler.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/obr/src/org/apache/felix/sigil/obr/impl/OBRHandler.java?rev=980146&r1=980145&r2=980146&view=diff
==============================================================================
--- felix/trunk/sigil/common/obr/src/org/apache/felix/sigil/obr/impl/OBRHandler.java (original)
+++ felix/trunk/sigil/common/obr/src/org/apache/felix/sigil/obr/impl/OBRHandler.java Wed Jul 28 18:30:10 2010
@@ -148,7 +148,7 @@ final class OBRHandler extends DefaultHa
                 URI l = makeAbsolute( uri );
                 info.setUpdateLocation( l );
                 if ( "file".equals(  l.getScheme() ) ) {
-                    b.setLocation( new Path( new File( l ).getAbsolutePath() ) );
+                    b.setLocation( new File( l ) );
                 }
                 else {
                     b.setLocation( cachePath( info ) );
@@ -181,10 +181,9 @@ final class OBRHandler extends DefaultHa
     }
 
 
-    private IPath cachePath( IBundleModelElement info )
+    private File cachePath( IBundleModelElement info )
     {
-        return new Path( cacheDir.getAbsolutePath() )
-            .append( info.getSymbolicName() + "_" + info.getVersion() + ".jar" );
+        return new File( cacheDir, info.getSymbolicName() + "_" + info.getVersion() + ".jar" );
     }
 
 

Added: felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/PathUtil.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/PathUtil.java?rev=980146&view=auto
==============================================================================
--- felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/PathUtil.java (added)
+++ felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/PathUtil.java Wed Jul 28 18:30:10 2010
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.sigil.eclipse;
+
+import java.io.File;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+
+/**
+ * @author dave
+ *
+ */
+public class PathUtil
+{
+    /**
+     * @param sourceRootPath
+     * @return
+     */
+    public static IPath newPathIfNotNull(String path)
+    {
+        return path == null ? null : new Path(path);
+    }
+
+
+    /**
+     * @param absolutePath
+     * @return
+     */
+    public static IPath newPathIfExists(File file)
+    {
+        if (file == null) return null;
+        if (file.exists()) return new Path(file.getAbsolutePath());
+        // fine
+        return null;
+    }
+
+
+}

Modified: felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/SigilCore.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/SigilCore.java?rev=980146&r1=980145&r2=980146&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/SigilCore.java (original)
+++ felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/SigilCore.java Wed Jul 28 18:30:10 2010
@@ -20,6 +20,7 @@
 package org.apache.felix.sigil.eclipse;
 
 
+import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
@@ -364,8 +365,8 @@ public class SigilCore extends AbstractU
         {
             public boolean visit( ISigilBundle b )
             {
-                IPath path = b.getLocation();
-                if ( path != null && path.toOSString().equals( bp ) )
+                File path = b.getLocation();
+                if ( path != null && path.getAbsolutePath().equals( bp ) )
                 {
                     flag.set( true );
                     return false;

Modified: felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/model/project/SigilProject.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/model/project/SigilProject.java?rev=980146&r1=980145&r2=980146&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/model/project/SigilProject.java (original)
+++ felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/model/project/SigilProject.java Wed Jul 28 18:30:10 2010
@@ -22,6 +22,7 @@ package org.apache.felix.sigil.eclipse.i
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
+import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URI;
@@ -34,6 +35,7 @@ import java.util.regex.Matcher;
 
 import org.apache.felix.sigil.config.BldFactory;
 import org.apache.felix.sigil.config.IBldProject;
+import org.apache.felix.sigil.eclipse.PathUtil;
 import org.apache.felix.sigil.eclipse.SigilCore;
 import org.apache.felix.sigil.eclipse.job.ThreadProgressMonitor;
 import org.apache.felix.sigil.eclipse.model.project.ISigilProjectModel;
@@ -504,7 +506,7 @@ public class SigilProject extends Abstra
 
     public IPath findBundleLocation() throws CoreException
     {
-        IPath p = getBundle().getLocation();
+        IPath p = PathUtil.newPathIfExists(getBundle().getLocation());
         if ( p == null )
         {
             p = SigilCore.getDefault().findDefaultBundleLocation( this );

Modified: felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/repository/eclipse/OSGiInstallRepository.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/repository/eclipse/OSGiInstallRepository.java?rev=980146&r1=980145&r2=980146&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/repository/eclipse/OSGiInstallRepository.java (original)
+++ felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/repository/eclipse/OSGiInstallRepository.java Wed Jul 28 18:30:10 2010
@@ -117,9 +117,10 @@ public class OSGiInstallRepository exten
             ISigilBundle bundle = buildBundle( jar.getManifest(), f );
             if ( bundle != null )
             {
-                bundle.setLocation( p );
-                bundle.setSourcePathLocation( source );
-                bundle.setSourceRootPath( new Path( "src" ) );
+                bundle.setLocation( f );
+                bundle.setSourcePathLocation( source.toFile() );
+                // XXX hard coded src location
+                bundle.setSourceRootPath( "src" );
                 bundles.add( bundle );
             }
         }
@@ -162,7 +163,7 @@ public class OSGiInstallRepository exten
         {
             bundle = ModelElementFactory.getInstance().newModelElement( ISigilBundle.class );
             bundle.addChild( info );
-            bundle.setLocation( new Path( f.getAbsolutePath() ) );
+            bundle.setLocation( f );
         }
 
         return bundle;

Modified: felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/model/util/JavaHelper.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/model/util/JavaHelper.java?rev=980146&r1=980145&r2=980146&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/model/util/JavaHelper.java (original)
+++ felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/model/util/JavaHelper.java Wed Jul 28 18:30:10 2010
@@ -42,7 +42,8 @@ import java.util.jar.JarInputStream;
 import java.util.regex.Pattern;
 
 import org.apache.felix.sigil.common.osgi.VersionRange;
-import org.apache.felix.sigil.common.osgi.VersionRangeBoundingRule;
+import org.apache.felix.sigil.config.Resource;
+import org.apache.felix.sigil.eclipse.PathUtil;
 import org.apache.felix.sigil.eclipse.SigilCore;
 import org.apache.felix.sigil.eclipse.model.project.ISigilProjectModel;
 import org.apache.felix.sigil.model.IModelElement;
@@ -65,7 +66,6 @@ import org.eclipse.core.runtime.IProgres
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.SubMonitor;
 import org.eclipse.core.runtime.content.IContentDescription;
 import org.eclipse.core.runtime.content.IContentType;
 import org.eclipse.core.runtime.content.IContentTypeManager;
@@ -83,7 +83,6 @@ import org.eclipse.jdt.core.IJavaModel;
 import org.eclipse.jdt.core.IJavaProject;
 import org.eclipse.jdt.core.ILocalVariable;
 import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IPackageDeclaration;
 import org.eclipse.jdt.core.IPackageFragment;
 import org.eclipse.jdt.core.IPackageFragmentRoot;
 import org.eclipse.jdt.core.IParent;
@@ -93,7 +92,6 @@ import org.eclipse.jdt.core.ITypeRoot;
 import org.eclipse.jdt.core.JavaCore;
 import org.eclipse.jdt.core.JavaModelException;
 import org.eclipse.jdt.core.Signature;
-import org.eclipse.jface.preference.IPreferenceStore;
 import org.osgi.framework.Version;
 
 
@@ -484,7 +482,7 @@ public class JavaHelper
 
             if ( entries == null )
             {
-                IPath path = bundle.getLocation();
+                Path path = new Path(bundle.getLocation().getAbsolutePath());
 
                 if ( path == null )
                 {
@@ -527,7 +525,8 @@ public class JavaHelper
                 IPath cache = bundleCache.append( name );
                 Collection<String> classpath = bundle.getBundleInfo().getClasspaths();
                 ArrayList<IClasspathEntry> entries = new ArrayList<IClasspathEntry>( classpath.size() );
-                IPath source = bundle.getSourcePathLocation();
+                IPath source = PathUtil.newPathIfExists(bundle.getSourcePathLocation());
+                IPath rootPath = PathUtil.newPathIfNotNull(bundle.getSourceRootPath());
 
                 if ( source != null && !source.toFile().exists() )
                 {
@@ -542,7 +541,7 @@ public class JavaHelper
                         IPath p = ".".equals( cp ) ? path : cache.append( cp );
                         if ( p.toFile().exists() )
                         {
-                            IClasspathEntry e = JavaCore.newLibraryEntry( p, source, bundle.getSourceRootPath(), rules,
+                            IClasspathEntry e = JavaCore.newLibraryEntry( p, source, rootPath, rules,
                                 attributes, exported );
                             entries.add( e );
                         }
@@ -550,7 +549,7 @@ public class JavaHelper
                 }
                 else
                 { // default classpath is .
-                    IClasspathEntry e = JavaCore.newLibraryEntry( path, source, bundle.getSourceRootPath(), rules,
+                    IClasspathEntry e = JavaCore.newLibraryEntry( path, source, rootPath, rules,
                         attributes, exported );
                     entries.add( e );
                 }
@@ -587,7 +586,7 @@ public class JavaHelper
                 FileInputStream fin = null;
                 try
                 {
-                    fin = new FileInputStream( bundle.getLocation().toFile() );
+                    fin = new FileInputStream( bundle.getLocation() );
                     JarInputStream in = new JarInputStream( fin );
                     JarEntry entry;
                     while ( ( entry = in.getNextJarEntry() ) != null )
@@ -867,9 +866,9 @@ public class JavaHelper
     {
         IContentTypeManager contentTypeManager = Platform.getContentTypeManager();
         IContentType txt = contentTypeManager.getContentType( "org.eclipse.core.runtime.text" );
-        for ( IPath p : project.getBundle().getSourcePaths() )
+        for ( Resource p : project.getBundle().getSourcePaths() )
         {
-            IFile f = project.getProject().getFile( p );
+            IFile f = project.getProject().getFile( p.getLocalFile() );
             if ( f.exists() )
             {
                 try

Modified: felix/trunk/sigil/eclipse/runtime/src/org/apache/felix/sigil/eclipse/runtime/RuntimeBundleResolver.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/runtime/src/org/apache/felix/sigil/eclipse/runtime/RuntimeBundleResolver.java?rev=980146&r1=980145&r2=980146&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/runtime/src/org/apache/felix/sigil/eclipse/runtime/RuntimeBundleResolver.java (original)
+++ felix/trunk/sigil/eclipse/runtime/src/org/apache/felix/sigil/eclipse/runtime/RuntimeBundleResolver.java Wed Jul 28 18:30:10 2010
@@ -62,7 +62,7 @@ public class RuntimeBundleResolver imple
                     }
                     else {
                         b.synchronize(null);
-                        uris.add( b.getLocation().toFile().toURI() );
+                        uris.add( b.getLocation().toURI() );
                     }
                 }
             }

Modified: felix/trunk/sigil/eclipse/search/src/org/apache/felix/sigil/search/SigilSearch.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/search/src/org/apache/felix/sigil/search/SigilSearch.java?rev=980146&r1=980145&r2=980146&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/search/src/org/apache/felix/sigil/search/SigilSearch.java (original)
+++ felix/trunk/sigil/eclipse/search/src/org/apache/felix/sigil/search/SigilSearch.java Wed Jul 28 18:30:10 2010
@@ -34,6 +34,7 @@ import java.util.regex.Pattern;
 
 import org.apache.bcel.classfile.ClassParser;
 import org.apache.bcel.classfile.JavaClass;
+import org.apache.felix.sigil.eclipse.PathUtil;
 import org.apache.felix.sigil.eclipse.SigilCore;
 import org.apache.felix.sigil.eclipse.model.project.ISigilProjectModel;
 import org.apache.felix.sigil.eclipse.model.util.JavaHelper;
@@ -162,7 +163,7 @@ public class SigilSearch extends Abstrac
                 {
                     if ( bundle.isSynchronized() )
                     {
-                        IPath loc = bundle.getLocation();
+                        IPath loc = PathUtil.newPathIfExists(bundle.getLocation());
                         if ( loc == null ) {
                             SigilCore.error("Location is null for " + bundle);
                         }

Modified: felix/trunk/sigil/eclipse/ui/sigil.properties
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/sigil.properties?rev=980146&r1=980145&r2=980146&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/sigil.properties (original)
+++ felix/trunk/sigil/eclipse/ui/sigil.properties Wed Jul 28 18:30:10 2010
@@ -27,6 +27,7 @@
 
 -imports: \
 	org.apache.felix.sigil.common.osgi, \
+	org.apache.felix.sigil.config, \
 	org.apache.felix.sigil.eclipse, \
 	org.apache.felix.sigil.eclipse.install, \
 	org.apache.felix.sigil.eclipse.job, \

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/ResourceBuildSection.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/ResourceBuildSection.java?rev=980146&r1=980145&r2=980146&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/ResourceBuildSection.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/ResourceBuildSection.java Wed Jul 28 18:30:10 2010
@@ -20,9 +20,11 @@
 package org.apache.felix.sigil.ui.eclipse.ui.editors.project;
 
 
+import java.util.concurrent.Callable;
 import java.util.concurrent.atomic.AtomicBoolean;
 
 
+import org.apache.felix.sigil.config.Resource;
 import org.apache.felix.sigil.eclipse.SigilCore;
 import org.apache.felix.sigil.eclipse.model.project.ISigilProjectModel;
 import org.apache.felix.sigil.model.eclipse.ISigilBundle;
@@ -33,6 +35,7 @@ import org.eclipse.core.resources.IResou
 import org.eclipse.core.resources.IResourceChangeListener;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
 import org.eclipse.jface.preference.PreferenceDialog;
 import org.eclipse.jface.util.IPropertyChangeListener;
 import org.eclipse.jface.util.PropertyChangeEvent;
@@ -128,22 +131,32 @@ public class ResourceBuildSection extend
 
         bundle.clearSourcePaths();
 
-        SigilUI.runInUISync( new Runnable()
+        try
         {
-            public void run()
+            SigilUI.runInUISync( new Callable<Void>()
             {
-                for ( Object o : viewer.getCheckedElements() )
+                public Void call() throws Exception
                 {
-                    if ( !viewer.getGrayed( o ) )
+                    for ( Object o : viewer.getCheckedElements() )
                     {
-                        IResource r = ( IResource ) o;
-                        getProjectModel().getBundle().addSourcePath( r.getProjectRelativePath() );
+                        if ( !viewer.getGrayed( o ) )
+                        {
+                            IResource r = ( IResource ) o;
+                            
+                            getProjectModel().getBundle().addSourcePath( toBldResource(r) );
+                        }
                     }
+                    
+                    return null;
                 }
-            }
-        } );
+            } );
 
-        super.commit( onSave );
+            super.commit( onSave );
+        }
+        catch (Exception e)
+        {
+            SigilCore.warn("Failed to update resource", e);
+        }
     }
 
 
@@ -151,9 +164,9 @@ public class ResourceBuildSection extend
     protected void refreshSelections()
     {
         // zero the state
-        for ( IPath path : getProjectModel().getBundle().getSourcePaths() )
+        for ( Resource path : getProjectModel().getBundle().getSourcePaths() )
         {
-            IResource r = findResource( path );
+            IResource r = findResource( new Path(path.getLocalFile()) );
             if ( r != null )
             {
                 viewer.expandToLevel( r, 0 );
@@ -172,16 +185,35 @@ public class ResourceBuildSection extend
     @Override
     protected void syncResourceModel( IResource element, boolean checked )
     {
-        if ( checked )
+        try
         {
-            getProjectModel().getBundle().addSourcePath( element.getProjectRelativePath() );
+            Resource resource = toBldResource(element);
+            
+            if ( checked )
+            {
+                getProjectModel().getBundle().addSourcePath( resource );
+            }
+            else
+            {
+                getProjectModel().getBundle().removeSourcePath( resource );
+            }
+
+            markDirty();
         }
-        else
+        catch (CoreException e)
         {
-            getProjectModel().getBundle().removeSourcePath( element.getProjectRelativePath() );
+            SigilCore.warn("Failed to sync resource " + element, e);
         }
+    }
 
-        markDirty();
+    /**
+     * @param element
+     * @return
+     * @throws CoreException 
+     */
+    private Resource toBldResource(IResource element) throws CoreException
+    {
+        return getProjectModel().getBldProject().newResource(element.getProjectRelativePath().toString());
     }
 
     private AtomicBoolean disposed = new AtomicBoolean();

Modified: felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/SigilResolver.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/SigilResolver.java?rev=980146&r1=980145&r2=980146&view=diff
==============================================================================
--- felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/SigilResolver.java (original)
+++ felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/SigilResolver.java Wed Jul 28 18:30:10 2010
@@ -55,7 +55,6 @@ import org.apache.ivy.plugins.repository
 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;
 
 
 /**
@@ -212,7 +211,7 @@ public class SigilResolver extends Basic
 
         try
         {
-            URL url = ( uri != null ) ? uri.toURL() : bundle.getLocation().toFile().toURL();
+            URL url = ( uri != null ) ? uri.toURL() : bundle.getLocation().toURL();
             if ( name.contains( "!" ) )
             {
                 String[] split = name.split( "!" );
@@ -466,11 +465,11 @@ public class SigilResolver extends Basic
                 return uri.toURL();
             }
             else {
-                IPath path = bundle.getLocation();
+                File path = bundle.getLocation();
                 if ( path == null ) {
                     throw new NullPointerException( "Missing location for " + bundle.getSymbolicName() );
                 }
-                return path.toFile().toURI().toURL();
+                return path.toURI().toURL();
             }
         }