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 2009/07/21 20:51:41 UTC

svn commit: r796467 [24/25] - in /felix/trunk/sigil: common/core.tests/src/org/apache/felix/sigil/core/ common/core/src/org/apache/felix/sigil/bnd/ common/core/src/org/apache/felix/sigil/config/ common/core/src/org/apache/felix/sigil/core/ common/core/...

Modified: felix/trunk/sigil/eclipse/utils/src/org/apache/felix/sigil/utils/PathHelper.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/utils/src/org/apache/felix/sigil/utils/PathHelper.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/utils/src/org/apache/felix/sigil/utils/PathHelper.java (original)
+++ felix/trunk/sigil/eclipse/utils/src/org/apache/felix/sigil/utils/PathHelper.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.utils;
 
+
 import java.io.File;
 import java.util.List;
 import java.util.regex.Pattern;
@@ -26,18 +27,24 @@
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.Path;
 
-public class PathHelper {
 
-	public static void scanFiles(List<IPath> paths, IPath path, String pattern, boolean recurse) {
-		Pattern p = GlobCompiler.compile(pattern);
-		
-		for ( File f : path.toFile().listFiles() ) {
-			if ( f.isDirectory() && recurse ) {
-				scanFiles( paths, new Path(f.getAbsolutePath()), pattern, recurse);
-			}
-			else if ( f.isFile() && p.matcher(f.getName()).matches() ) {
-				paths.add( new Path(f.getAbsolutePath()) );
-			}
-		}
-	}
+public class PathHelper
+{
+
+    public static void scanFiles( List<IPath> paths, IPath path, String pattern, boolean recurse )
+    {
+        Pattern p = GlobCompiler.compile( pattern );
+
+        for ( File f : path.toFile().listFiles() )
+        {
+            if ( f.isDirectory() && recurse )
+            {
+                scanFiles( paths, new Path( f.getAbsolutePath() ), pattern, recurse );
+            }
+            else if ( f.isFile() && p.matcher( f.getName() ).matches() )
+            {
+                paths.add( new Path( f.getAbsolutePath() ) );
+            }
+        }
+    }
 }

Modified: felix/trunk/sigil/eclipse/utils/src/org/apache/felix/sigil/utils/SigilUtils.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/utils/src/org/apache/felix/sigil/utils/SigilUtils.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/utils/src/org/apache/felix/sigil/utils/SigilUtils.java (original)
+++ felix/trunk/sigil/eclipse/utils/src/org/apache/felix/sigil/utils/SigilUtils.java Tue Jul 21 18:51:33 2009
@@ -19,21 +19,29 @@
 
 package org.apache.felix.sigil.utils;
 
+
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.Platform;
 import org.eclipse.core.runtime.content.IContentType;
 
-public final class SigilUtils {
-	private SigilUtils () {
-	}
-	
-	public static boolean isResourceType(IResource resource, String type) {
-		IContentType[] types = Platform.getContentTypeManager().findContentTypesFor(resource.getName());
-		for (IContentType contentType : types) {
-			if(contentType.getId().equals(type)) {
-				return true;
-			}
-		}
-		return false;
-	}
+
+public final class SigilUtils
+{
+    private SigilUtils()
+    {
+    }
+
+
+    public static boolean isResourceType( IResource resource, String type )
+    {
+        IContentType[] types = Platform.getContentTypeManager().findContentTypesFor( resource.getName() );
+        for ( IContentType contentType : types )
+        {
+            if ( contentType.getId().equals( type ) )
+            {
+                return true;
+            }
+        }
+        return false;
+    }
 }

Modified: felix/trunk/sigil/eclipse/utils/src/org/apache/felix/sigil/utils/properties/EditorPropertyTester.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/utils/src/org/apache/felix/sigil/utils/properties/EditorPropertyTester.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/utils/src/org/apache/felix/sigil/utils/properties/EditorPropertyTester.java (original)
+++ felix/trunk/sigil/eclipse/utils/src/org/apache/felix/sigil/utils/properties/EditorPropertyTester.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.utils.properties;
 
+
 import org.apache.felix.sigil.utils.SigilUtils;
 import org.eclipse.core.expressions.PropertyTester;
 import org.eclipse.core.resources.IFile;
@@ -27,25 +28,31 @@
 import org.eclipse.ui.IFileEditorInput;
 import org.eclipse.ui.IWorkbenchPart;
 
-public class EditorPropertyTester extends PropertyTester {
 
-	public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
-		IWorkbenchPart part = (IWorkbenchPart) receiver;
+public class EditorPropertyTester extends PropertyTester
+{
+
+    public boolean test( Object receiver, String property, Object[] args, Object expectedValue )
+    {
+        IWorkbenchPart part = ( IWorkbenchPart ) receiver;
+
+        boolean result = false;
+
+        if ( part instanceof IEditorPart )
+        {
+            IEditorInput input = ( ( IEditorPart ) part ).getEditorInput();
+            if ( input instanceof IFileEditorInput )
+            {
+                IFile file = ( ( IFileEditorInput ) input ).getFile();
+
+                if ( "isEditorOfType".equals( property ) )
+                {
+                    result = SigilUtils.isResourceType( file, ( String ) expectedValue );
+                }
+            }
+        }
 
-		boolean result = false;
-		
-		if(part instanceof IEditorPart) {
-			IEditorInput input = ((IEditorPart) part).getEditorInput();
-			if(input instanceof IFileEditorInput) {
-				IFile file = ((IFileEditorInput) input).getFile();
-				
-				if("isEditorOfType".equals(property)) {
-					result = SigilUtils.isResourceType(file, (String) expectedValue);
-				}
-			}
-		}
-		
-		return result;
-	}
+        return result;
+    }
 
 }

Modified: felix/trunk/sigil/eclipse/utils/src/org/apache/felix/sigil/utils/properties/PartKindPropertyTester.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/utils/src/org/apache/felix/sigil/utils/properties/PartKindPropertyTester.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/utils/src/org/apache/felix/sigil/utils/properties/PartKindPropertyTester.java (original)
+++ felix/trunk/sigil/eclipse/utils/src/org/apache/felix/sigil/utils/properties/PartKindPropertyTester.java Tue Jul 21 18:51:33 2009
@@ -19,32 +19,46 @@
 
 package org.apache.felix.sigil.utils.properties;
 
+
 import org.eclipse.core.expressions.PropertyTester;
 import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.IViewPart;
 import org.eclipse.ui.IWorkbenchPart;
 
-public class PartKindPropertyTester extends PropertyTester{
 
-	public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
-		IWorkbenchPart part = (IWorkbenchPart) receiver;
-		
-		Object value;
-		if("partKind".equals(property)) {
-			if(part instanceof IEditorPart) {
-				value = "editor";
-			} else if(part instanceof IViewPart) {
-				value = "view";
-			} else {
-				value = null;
-			}
-		} else if("partId".equals(property)) {
-			value = part.getSite().getId();
-		} else {
-			value = null;
-		}
-		
-		return expectedValue.equals(value);
-	}
-	
+public class PartKindPropertyTester extends PropertyTester
+{
+
+    public boolean test( Object receiver, String property, Object[] args, Object expectedValue )
+    {
+        IWorkbenchPart part = ( IWorkbenchPart ) receiver;
+
+        Object value;
+        if ( "partKind".equals( property ) )
+        {
+            if ( part instanceof IEditorPart )
+            {
+                value = "editor";
+            }
+            else if ( part instanceof IViewPart )
+            {
+                value = "view";
+            }
+            else
+            {
+                value = null;
+            }
+        }
+        else if ( "partId".equals( property ) )
+        {
+            value = part.getSite().getId();
+        }
+        else
+        {
+            value = null;
+        }
+
+        return expectedValue.equals( value );
+    }
+
 }

Modified: felix/trunk/sigil/eclipse/utils/src/org/apache/felix/sigil/utils/properties/ResourceTypePropertyTester.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/utils/src/org/apache/felix/sigil/utils/properties/ResourceTypePropertyTester.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/utils/src/org/apache/felix/sigil/utils/properties/ResourceTypePropertyTester.java (original)
+++ felix/trunk/sigil/eclipse/utils/src/org/apache/felix/sigil/utils/properties/ResourceTypePropertyTester.java Tue Jul 21 18:51:33 2009
@@ -19,34 +19,41 @@
 
 package org.apache.felix.sigil.utils.properties;
 
+
 import org.eclipse.core.expressions.PropertyTester;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.Platform;
 import org.eclipse.core.runtime.content.IContentType;
 
-public class ResourceTypePropertyTester extends PropertyTester {
 
-	public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
-		if (!(receiver instanceof IResource)) {
-			return false;
-		}
-
-		boolean result = false;
-
-		IResource resource = (IResource) receiver;
-		if ("isResourceOfType".equals(property)) {
-			IContentType[] types = Platform.getContentTypeManager().findContentTypesFor(
-					resource.getName());
-
-			for (IContentType type : types) {
-				if (type.getId().equals(expectedValue)) {
-					result = true;
-					break;
-				}
-			}
-		}
+public class ResourceTypePropertyTester extends PropertyTester
+{
+
+    public boolean test( Object receiver, String property, Object[] args, Object expectedValue )
+    {
+        if ( !( receiver instanceof IResource ) )
+        {
+            return false;
+        }
+
+        boolean result = false;
+
+        IResource resource = ( IResource ) receiver;
+        if ( "isResourceOfType".equals( property ) )
+        {
+            IContentType[] types = Platform.getContentTypeManager().findContentTypesFor( resource.getName() );
+
+            for ( IContentType type : types )
+            {
+                if ( type.getId().equals( expectedValue ) )
+                {
+                    result = true;
+                    break;
+                }
+            }
+        }
 
-		return result;
-	}
+        return result;
+    }
 
 }

Modified: felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ant/BundleInfoTask.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ant/BundleInfoTask.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ant/BundleInfoTask.java (original)
+++ felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ant/BundleInfoTask.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.ant;
 
+
 import java.io.File;
 import java.io.IOException;
 import java.util.jar.JarFile;
@@ -27,58 +28,78 @@
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Task;
 
-public class BundleInfoTask extends Task {
-	private File bundle;
-	private String header;
-	private String property;
-	private String defaultValue;
-	
-	@Override
-	public void execute() throws BuildException {
-		if (bundle == null)
-			throw new BuildException("missing attribute: bundle");
-		if (header == null)
-			throw new BuildException("missing attribute: header");
-		
-		try {
-			JarFile jar = new JarFile(bundle);
-			Manifest mf = jar.getManifest();
-			String value = mf.getMainAttributes().getValue(header);
-			if ( property == null ) {
-				log(header + "=" + value);
-			}
-			else {
-			    if ("Bundle-SymbolicName".equals(header) && value != null) {
-			        // remove singleton flag
-			        int semi = value.indexOf(';');
-			        if (semi > 0)
-			            value = value.substring(0, semi);
-			    }
-				if ( value == null ) {
-					value = defaultValue;
-				}
-				if ( value != null ) {
-					getProject().setNewProperty(property, value);
-				}
-			}
-		} catch (IOException e) {
-			throw new BuildException( "Failed to access bundle", e);
-		}
-	}
-	
-	public void setBundle(String bundle) {
-		this.bundle = new File( bundle );
-	}
-	
-	public void setHeader(String header) {
-		this.header = header;
-	}
-	
-	public void setProperty(String property) {
-		this.property = property;
-	}
-	
-	public void setDefaultValue(String defaultValue) {
-		this.defaultValue = defaultValue;
-	}
+
+public class BundleInfoTask extends Task
+{
+    private File bundle;
+    private String header;
+    private String property;
+    private String defaultValue;
+
+
+    @Override
+    public void execute() throws BuildException
+    {
+        if ( bundle == null )
+            throw new BuildException( "missing attribute: bundle" );
+        if ( header == null )
+            throw new BuildException( "missing attribute: header" );
+
+        try
+        {
+            JarFile jar = new JarFile( bundle );
+            Manifest mf = jar.getManifest();
+            String value = mf.getMainAttributes().getValue( header );
+            if ( property == null )
+            {
+                log( header + "=" + value );
+            }
+            else
+            {
+                if ( "Bundle-SymbolicName".equals( header ) && value != null )
+                {
+                    // remove singleton flag
+                    int semi = value.indexOf( ';' );
+                    if ( semi > 0 )
+                        value = value.substring( 0, semi );
+                }
+                if ( value == null )
+                {
+                    value = defaultValue;
+                }
+                if ( value != null )
+                {
+                    getProject().setNewProperty( property, value );
+                }
+            }
+        }
+        catch ( IOException e )
+        {
+            throw new BuildException( "Failed to access bundle", e );
+        }
+    }
+
+
+    public void setBundle( String bundle )
+    {
+        this.bundle = new File( bundle );
+    }
+
+
+    public void setHeader( String header )
+    {
+        this.header = header;
+    }
+
+
+    public void setProperty( String property )
+    {
+        this.property = property;
+    }
+
+
+    public void setDefaultValue( String defaultValue )
+    {
+        this.defaultValue = defaultValue;
+    }
 }

Modified: felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ant/BundleTask.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ant/BundleTask.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ant/BundleTask.java (original)
+++ felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ant/BundleTask.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.ant;
 
+
 import java.io.File;
 import java.io.IOException;
 import java.net.URI;
@@ -35,119 +36,164 @@
 import org.apache.tools.ant.Task;
 import org.apache.tools.ant.types.Path;
 
-public class BundleTask extends Task {
-	private File[] classpath;
-	private String destPattern;
-	private boolean force;
-	private String property;
-	private String sigilFile;
-
-	@Override
-	public void execute() throws BuildException {
-		if (classpath == null)
-			throw new BuildException("missing: attribute: classpathref");
-		if (destPattern == null)
-			throw new BuildException("missing attribute: destpattern");
-		
-		IBldProject project;
-
-		try {
-			project = BldFactory.getProject(getSigilFileURI());
-
-		} catch (IOException e) {
-			throw new BuildException("failed to get project file: " + e);
-		}
-		
-		Properties env = new Properties();
-		@SuppressWarnings("unchecked") Hashtable<String, String> properties = getProject().getProperties();
-		for (String key : properties.keySet()) {
-			if (key.matches("^[a-z].*")) {    // avoid props starting with Uppercase - bnd adds them to manifest
-				env.setProperty(key, properties.get(key));
-			}
-		}
-		
-		BundleBuilder bb = new BundleBuilder(project, classpath, destPattern, env);
-		boolean anyModified = false;
-
-		for (IBldBundle bundle : project.getBundles()) {
-			String id = bundle.getId();
-			log("creating bundle: " + id);
-			int nWarn = 0;
-			int nErr = 0;
-			String msg = "";
-			
-			try {
-				boolean modified = (bb.createBundle(bundle, force, new BundleBuilder.Log() {
-					public void warn(String msg) {
-						log(msg, Project.MSG_WARN);
-					}
-					public void verbose(String msg) {
-						log(msg, Project.MSG_VERBOSE);
-					}
-				}));
-				nWarn = bb.warnings().size();
-				if (modified) {
-					anyModified = true;
-				} else {
-					msg = " (not modified)";
-				}
-			} catch (Exception e) {
-				List<String> errors = bb.errors();
-				if (errors != null) {
-    				nErr = errors.size();
-    				for (String err : errors) {
-    					log(err, Project.MSG_ERR);
-    				}
-				}
-				throw new BuildException("failed to create: " + id + ": " + e, e);
-			} finally {
-				log(id + ": " + count(nErr, "error") + ", " + count(nWarn, "warning") + msg);
-			}
-		}
-		
-		if (anyModified && property != null) {
-			getProject().setProperty(property, "true");
-		}
-	}
-	
-	private URI getSigilFileURI() {
-		File file = sigilFile == null ? new File(getProject().getBaseDir(), IBldProject.PROJECT_FILE) : new File(sigilFile);
-		if ( !file.isFile() ) {
-			throw new BuildException( "File not found " + file.getAbsolutePath() );
-		}
-		return file.toURI();
-	}
-
-	private String count(int count, String msg) {
-		return count + " " + msg + (count == 1 ? "" : "s");
-	}
-
-	public void setDestpattern(String pattern) {
-		this.destPattern = pattern;
-	}
-	
-	public void setForce(String force) {
-		this.force = Boolean.parseBoolean(force);
-	}
-	
-	public void setProperty(String property) {
-		this.property = property;
-	}
-
-	public void setClasspathref(String value) {
-		Path p = (Path) getProject().getReference(value);
-		if (p == null) {
-			throw new BuildException(value + "is not a path reference.");
-		}
-
-		String[] paths = p.list();
-		classpath = new File[paths.length];
-		for (int i = 0; i < paths.length; ++i) {
-			classpath[i] = new File(paths[i]);
-		}
-	}
-
-	public void setSigilFile(String sigilFile) {
-		this.sigilFile = sigilFile;
-	}
+
+public class BundleTask extends Task
+{
+    private File[] classpath;
+    private String destPattern;
+    private boolean force;
+    private String property;
+    private String sigilFile;
+
+
+    @Override
+    public void execute() throws BuildException
+    {
+        if ( classpath == null )
+            throw new BuildException( "missing: attribute: classpathref" );
+        if ( destPattern == null )
+            throw new BuildException( "missing attribute: destpattern" );
+
+        IBldProject project;
+
+        try
+        {
+            project = BldFactory.getProject( getSigilFileURI() );
+
+        }
+        catch ( IOException e )
+        {
+            throw new BuildException( "failed to get project file: " + e );
+        }
+
+        Properties env = new Properties();
+        @SuppressWarnings("unchecked")
+        Hashtable<String, String> properties = getProject().getProperties();
+        for ( String key : properties.keySet() )
+        {
+            if ( key.matches( "^[a-z].*" ) )
+            { // avoid props starting with Uppercase - bnd adds them to manifest
+                env.setProperty( key, properties.get( key ) );
+            }
+        }
+
+        BundleBuilder bb = new BundleBuilder( project, classpath, destPattern, env );
+        boolean anyModified = false;
+
+        for ( IBldBundle bundle : project.getBundles() )
+        {
+            String id = bundle.getId();
+            log( "creating bundle: " + id );
+            int nWarn = 0;
+            int nErr = 0;
+            String msg = "";
+
+            try
+            {
+                boolean modified = ( bb.createBundle( bundle, force, new BundleBuilder.Log()
+                {
+                    public void warn( String msg )
+                    {
+                        log( msg, Project.MSG_WARN );
+                    }
+
+
+                    public void verbose( String msg )
+                    {
+                        log( msg, Project.MSG_VERBOSE );
+                    }
+                } ) );
+                nWarn = bb.warnings().size();
+                if ( modified )
+                {
+                    anyModified = true;
+                }
+                else
+                {
+                    msg = " (not modified)";
+                }
+            }
+            catch ( Exception e )
+            {
+                List<String> errors = bb.errors();
+                if ( errors != null )
+                {
+                    nErr = errors.size();
+                    for ( String err : errors )
+                    {
+                        log( err, Project.MSG_ERR );
+                    }
+                }
+                throw new BuildException( "failed to create: " + id + ": " + e, e );
+            }
+            finally
+            {
+                log( id + ": " + count( nErr, "error" ) + ", " + count( nWarn, "warning" ) + msg );
+            }
+        }
+
+        if ( anyModified && property != null )
+        {
+            getProject().setProperty( property, "true" );
+        }
+    }
+
+
+    private URI getSigilFileURI()
+    {
+        File file = sigilFile == null ? new File( getProject().getBaseDir(), IBldProject.PROJECT_FILE ) : new File(
+            sigilFile );
+        if ( !file.isFile() )
+        {
+            throw new BuildException( "File not found " + file.getAbsolutePath() );
+        }
+        return file.toURI();
+    }
+
+
+    private String count( int count, String msg )
+    {
+        return count + " " + msg + ( count == 1 ? "" : "s" );
+    }
+
+
+    public void setDestpattern( String pattern )
+    {
+        this.destPattern = pattern;
+    }
+
+
+    public void setForce( String force )
+    {
+        this.force = Boolean.parseBoolean( force );
+    }
+
+
+    public void setProperty( String property )
+    {
+        this.property = property;
+    }
+
+
+    public void setClasspathref( String value )
+    {
+        Path p = ( Path ) getProject().getReference( value );
+        if ( p == null )
+        {
+            throw new BuildException( value + "is not a path reference." );
+        }
+
+        String[] paths = p.list();
+        classpath = new File[paths.length];
+        for ( int i = 0; i < paths.length; ++i )
+        {
+            classpath[i] = new File( paths[i] );
+        }
+    }
+
+
+    public void setSigilFile( String sigilFile )
+    {
+        this.sigilFile = sigilFile;
+    }
 }

Modified: felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/BldRepositoryManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/BldRepositoryManager.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/BldRepositoryManager.java (original)
+++ felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/BldRepositoryManager.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.ivy;
 
+
 import java.io.File;
 import java.util.HashMap;
 import java.util.Map;
@@ -29,59 +30,73 @@
 import org.apache.felix.sigil.repository.IBundleRepository;
 import org.apache.felix.sigil.repository.IRepositoryProvider;
 
-public class BldRepositoryManager extends AbstractRepositoryManager {
-	private static Map<String, String> aliases = new HashMap<String, String>();
 
-	static {
-		aliases.put("filesystem", "org.cauldron.bld.core.repository.FileSystemRepositoryProvider");
-		aliases.put("obr", "org.cauldron.bld.obr.OBRRepositoryProvider");
-		aliases.put("project", "org.cauldron.bld.ivy.ProjectRepositoryProvider");
-		aliases.put("system", "org.cauldron.bld.core.repository.SystemRepositoryProvider");
-	};
-
-	private Map<String, Properties> repos;
-
-	public BldRepositoryManager(Map<String, Properties> repos) {
-		this.repos = repos;
-	}
-
-	@Override
-	protected void loadRepositories() {
-		for (String name : repos.keySet()) {
-			Properties repo = repos.get(name);
-
-			String alias = repo.getProperty(IRepositoryConfig.REPOSITORY_PROVIDER);
-			if (alias == null) {
-				Log.error("provider not specified for repository: " + name);
-				continue;
-			}
-			
-			String provider = (aliases.containsKey(alias) ? aliases.get(alias) : alias);
-
-            if (alias.equals("obr")) {
-				// cache is directory where synchronized bundles are stored;
-				// not needed in ivy.
-				repo.setProperty("cache", "/no-cache");
-				
-				if (!repo.containsKey("index")) {
-    				// index is created as copy of url
-    				File indexFile = new File(System.getProperty("java.io.tmpdir"), "obr-index-" + name);
-    				indexFile.deleteOnExit();
-    				repo.setProperty("index", indexFile.getAbsolutePath());
-				}
-			}
-
-			int level = Integer.parseInt(repo.getProperty(IRepositoryConfig.REPOSITORY_LEVEL,
-					IBundleRepository.NORMAL_PRIORITY + ""));
-
-			try {
-				IRepositoryProvider instance = (IRepositoryProvider) (Class.forName(provider).newInstance());
-				IBundleRepository repository = instance.createRepository(name, repo);
-				addRepository(repository, level);
-				Log.verbose("added repository: " + repository);
-			} catch (Exception e) {
-				throw new Error("createRepository() failed: " + repo + " : " + e, e);
-			}
-		}
-	}
+public class BldRepositoryManager extends AbstractRepositoryManager
+{
+    private static Map<String, String> aliases = new HashMap<String, String>();
+
+    static
+    {
+        aliases.put( "filesystem", "org.cauldron.bld.core.repository.FileSystemRepositoryProvider" );
+        aliases.put( "obr", "org.cauldron.bld.obr.OBRRepositoryProvider" );
+        aliases.put( "project", "org.cauldron.bld.ivy.ProjectRepositoryProvider" );
+        aliases.put( "system", "org.cauldron.bld.core.repository.SystemRepositoryProvider" );
+    };
+
+    private Map<String, Properties> repos;
+
+
+    public BldRepositoryManager( Map<String, Properties> repos )
+    {
+        this.repos = repos;
+    }
+
+
+    @Override
+    protected void loadRepositories()
+    {
+        for ( String name : repos.keySet() )
+        {
+            Properties repo = repos.get( name );
+
+            String alias = repo.getProperty( IRepositoryConfig.REPOSITORY_PROVIDER );
+            if ( alias == null )
+            {
+                Log.error( "provider not specified for repository: " + name );
+                continue;
+            }
+
+            String provider = ( aliases.containsKey( alias ) ? aliases.get( alias ) : alias );
+
+            if ( alias.equals( "obr" ) )
+            {
+                // cache is directory where synchronized bundles are stored;
+                // not needed in ivy.
+                repo.setProperty( "cache", "/no-cache" );
+
+                if ( !repo.containsKey( "index" ) )
+                {
+                    // index is created as copy of url
+                    File indexFile = new File( System.getProperty( "java.io.tmpdir" ), "obr-index-" + name );
+                    indexFile.deleteOnExit();
+                    repo.setProperty( "index", indexFile.getAbsolutePath() );
+                }
+            }
+
+            int level = Integer.parseInt( repo.getProperty( IRepositoryConfig.REPOSITORY_LEVEL,
+                IBundleRepository.NORMAL_PRIORITY + "" ) );
+
+            try
+            {
+                IRepositoryProvider instance = ( IRepositoryProvider ) ( Class.forName( provider ).newInstance() );
+                IBundleRepository repository = instance.createRepository( name, repo );
+                addRepository( repository, level );
+                Log.verbose( "added repository: " + repository );
+            }
+            catch ( Exception e )
+            {
+                throw new Error( "createRepository() failed: " + repo + " : " + e, e );
+            }
+        }
+    }
 }

Modified: felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/BldResolver.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/BldResolver.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/BldResolver.java (original)
+++ felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/BldResolver.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.ivy;
 
+
 import java.util.Map;
 import java.util.Properties;
 
@@ -30,59 +31,85 @@
 import org.apache.felix.sigil.repository.ResolutionConfig;
 import org.apache.felix.sigil.repository.ResolutionException;
 
-public class BldResolver implements IBldResolver {
-	private Map<String, Properties> repos;
-	private BldRepositoryManager manager;
-	
-	static {
-		try {
-			BldCore.init();
-		} catch (Exception e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-	};
-	
-	public BldResolver(Map<String,Properties> repos) {
-		this.repos = repos;
-	}
-
-	public IResolution resolve(IModelElement element, boolean transitive) {
-		int options = ResolutionConfig.IGNORE_ERRORS | ResolutionConfig.INCLUDE_OPTIONAL;
-		if (transitive) options |= ResolutionConfig.INCLUDE_DEPENDENTS;
-		
-		ResolutionConfig config = new ResolutionConfig(options);
-		try {
-			return resolve(element, config);
-		} catch (ResolutionException e) {
-			throw new IllegalStateException("eek! this shouldn't happen when ignoreErrors=true", e);
-		}
-	}
-		
-	public IResolution resolveOrFail(IModelElement element, boolean transitive) throws ResolutionException {
-		int options = 0;
-		if ( transitive ) options |= ResolutionConfig.INCLUDE_DEPENDENTS;
-		ResolutionConfig config = new ResolutionConfig(options);
-		return resolve(element, config);
-	}
-	
-	private IResolution resolve(IModelElement element, ResolutionConfig config) throws ResolutionException {
-		if (manager == null) {
-			manager = new BldRepositoryManager(repos);
-		}
-
-		IResolutionMonitor nullMonitor = new IResolutionMonitor() {
-			public void endResolution(IModelElement requirement, ISigilBundle sigilBundle) {
-			}
-
-			public boolean isCanceled() {
-				return false;
-			}
-
-			public void startResolution(IModelElement requirement) {
-			}
-		};
 
-		return manager.getBundleResolver().resolve(element, config, nullMonitor);
-	}
+public class BldResolver implements IBldResolver
+{
+    private Map<String, Properties> repos;
+    private BldRepositoryManager manager;
+
+    static
+    {
+        try
+        {
+            BldCore.init();
+        }
+        catch ( Exception e )
+        {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+    };
+
+
+    public BldResolver( Map<String, Properties> repos )
+    {
+        this.repos = repos;
+    }
+
+
+    public IResolution resolve( IModelElement element, boolean transitive )
+    {
+        int options = ResolutionConfig.IGNORE_ERRORS | ResolutionConfig.INCLUDE_OPTIONAL;
+        if ( transitive )
+            options |= ResolutionConfig.INCLUDE_DEPENDENTS;
+
+        ResolutionConfig config = new ResolutionConfig( options );
+        try
+        {
+            return resolve( element, config );
+        }
+        catch ( ResolutionException e )
+        {
+            throw new IllegalStateException( "eek! this shouldn't happen when ignoreErrors=true", e );
+        }
+    }
+
+
+    public IResolution resolveOrFail( IModelElement element, boolean transitive ) throws ResolutionException
+    {
+        int options = 0;
+        if ( transitive )
+            options |= ResolutionConfig.INCLUDE_DEPENDENTS;
+        ResolutionConfig config = new ResolutionConfig( options );
+        return resolve( element, config );
+    }
+
+
+    private IResolution resolve( IModelElement element, ResolutionConfig config ) throws ResolutionException
+    {
+        if ( manager == null )
+        {
+            manager = new BldRepositoryManager( repos );
+        }
+
+        IResolutionMonitor nullMonitor = new IResolutionMonitor()
+        {
+            public void endResolution( IModelElement requirement, ISigilBundle sigilBundle )
+            {
+            }
+
+
+            public boolean isCanceled()
+            {
+                return false;
+            }
+
+
+            public void startResolution( IModelElement requirement )
+            {
+            }
+        };
+
+        return manager.getBundleResolver().resolve( element, config, nullMonitor );
+    }
 }

Modified: felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/FindUtil.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/FindUtil.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/FindUtil.java (original)
+++ felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/FindUtil.java Tue Jul 21 18:51:33 2009
@@ -19,79 +19,107 @@
 
 package org.apache.felix.sigil.ivy;
 
+
 import java.io.File;
 import java.io.FileFilter;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
 
-public class FindUtil {
-	static final String WILD_ANY = "[^.].*";
-	static final String WILD_ONE = "[^.][^;]*";    // WILD_ONE.endsWith(WILD_ANY) == false
-	
-	// example pattern: ${repository}/projects/abc*/*/project.sigil
-	public static Collection<File> findFiles(String pattern) throws IOException {
-		int star = pattern.indexOf("*");
-		if (star == -1) {
-			throw new IOException("pattern doesn't contain '*': " + pattern);
-		}
-		int slash = pattern.lastIndexOf('/', star);
-		
-		String regex = pattern.substring(slash + 1);
-		regex = regex.replaceAll("\\*\\*", "-wildany-");
-		regex = regex.replaceAll("\\*", "-wildone-");
-		regex = regex.replaceAll("-wildany-", WILD_ANY);
-		regex = regex.replaceAll("-wildone-", WILD_ONE);
-		
-		String[] patterns = regex.split("/");
-		
-		ArrayList<File> list = new ArrayList<File>();
-		File root = new File(pattern.substring(0, slash));
-		
-		if (root.isDirectory()) {
-    		findFiles(root, 0, patterns, list);
-		} else {
-			throw new IOException("pattern root directory does not exist: " + root);
-		}
-		
-		return list;
-	}
-	
-	private static void findFiles(File dir, int level, String[] patterns, Collection<File> list) {
-		final String filePattern = patterns[patterns.length-1];
-		final String dirPattern;
-		
-		if (level < patterns.length-1) {
-			dirPattern = patterns[level];
-		} else {
-			dirPattern = "/";    // impossible to match marker
-		}
-		
-		final boolean stillWild;
-		if ((level > 0) && (level < patterns.length) && patterns[level-1].endsWith(WILD_ANY)) {
-			stillWild = true;
-		} else {
-			stillWild = false;
-		}
-		
-		for (File path : dir.listFiles(new FileFilter() {
-			public boolean accept(File pathname) {
-				String name = pathname.getName();
-				if (pathname.isDirectory()) {
-					return name.matches(dirPattern) || (stillWild && name.matches(WILD_ANY));
-				} else if (dirPattern.equals("/") || dirPattern.equals(WILD_ANY)) {
-					return name.matches(filePattern);
-				} else {
-					return false;
-				}
-			}
-		})) {
-			if (path.isDirectory()) {
-				int inc = path.getName().matches(dirPattern) ? 1 : 0;
-				findFiles(path, level + inc, patterns, list);
-			} else {
-				list.add(path);
-			}
-		}
-	}
+
+public class FindUtil
+{
+    static final String WILD_ANY = "[^.].*";
+    static final String WILD_ONE = "[^.][^;]*"; // WILD_ONE.endsWith(WILD_ANY) == false
+
+
+    // example pattern: ${repository}/projects/abc*/*/project.sigil
+    public static Collection<File> findFiles( String pattern ) throws IOException
+    {
+        int star = pattern.indexOf( "*" );
+        if ( star == -1 )
+        {
+            throw new IOException( "pattern doesn't contain '*': " + pattern );
+        }
+        int slash = pattern.lastIndexOf( '/', star );
+
+        String regex = pattern.substring( slash + 1 );
+        regex = regex.replaceAll( "\\*\\*", "-wildany-" );
+        regex = regex.replaceAll( "\\*", "-wildone-" );
+        regex = regex.replaceAll( "-wildany-", WILD_ANY );
+        regex = regex.replaceAll( "-wildone-", WILD_ONE );
+
+        String[] patterns = regex.split( "/" );
+
+        ArrayList<File> list = new ArrayList<File>();
+        File root = new File( pattern.substring( 0, slash ) );
+
+        if ( root.isDirectory() )
+        {
+            findFiles( root, 0, patterns, list );
+        }
+        else
+        {
+            throw new IOException( "pattern root directory does not exist: " + root );
+        }
+
+        return list;
+    }
+
+
+    private static void findFiles( File dir, int level, String[] patterns, Collection<File> list )
+    {
+        final String filePattern = patterns[patterns.length - 1];
+        final String dirPattern;
+
+        if ( level < patterns.length - 1 )
+        {
+            dirPattern = patterns[level];
+        }
+        else
+        {
+            dirPattern = "/"; // impossible to match marker
+        }
+
+        final boolean stillWild;
+        if ( ( level > 0 ) && ( level < patterns.length ) && patterns[level - 1].endsWith( WILD_ANY ) )
+        {
+            stillWild = true;
+        }
+        else
+        {
+            stillWild = false;
+        }
+
+        for ( File path : dir.listFiles( new FileFilter()
+        {
+            public boolean accept( File pathname )
+            {
+                String name = pathname.getName();
+                if ( pathname.isDirectory() )
+                {
+                    return name.matches( dirPattern ) || ( stillWild && name.matches( WILD_ANY ) );
+                }
+                else if ( dirPattern.equals( "/" ) || dirPattern.equals( WILD_ANY ) )
+                {
+                    return name.matches( filePattern );
+                }
+                else
+                {
+                    return false;
+                }
+            }
+        } ) )
+        {
+            if ( path.isDirectory() )
+            {
+                int inc = path.getName().matches( dirPattern ) ? 1 : 0;
+                findFiles( path, level + inc, patterns, list );
+            }
+            else
+            {
+                list.add( path );
+            }
+        }
+    }
 }

Modified: felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/IBldResolver.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/IBldResolver.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/IBldResolver.java (original)
+++ felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/IBldResolver.java Tue Jul 21 18:51:33 2009
@@ -19,11 +19,16 @@
 
 package org.apache.felix.sigil.ivy;
 
+
 import org.apache.felix.sigil.model.IModelElement;
 import org.apache.felix.sigil.repository.IResolution;
 import org.apache.felix.sigil.repository.ResolutionException;
 
-public interface IBldResolver {
-	IResolution resolveOrFail(IModelElement element, boolean transitive) throws ResolutionException;
-	IResolution resolve(IModelElement element, boolean transitive);
+
+public interface IBldResolver
+{
+    IResolution resolveOrFail( IModelElement element, boolean transitive ) throws ResolutionException;
+
+
+    IResolution resolve( IModelElement element, boolean transitive );
 }

Modified: felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/Log.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/Log.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/Log.java (original)
+++ felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/Log.java Tue Jul 21 18:51:33 2009
@@ -19,43 +19,56 @@
 
 package org.apache.felix.sigil.ivy;
 
+
 import org.apache.ivy.util.Message;
 
+
 // ensure common prefix to all sigil messages
-public class Log {
-	public static final String PREFIX = "Sigil: ";
-	
-	private static final boolean highlight = false;
-	
-	public static void error(String msg) {
-		if (highlight)
-    		Message.deprecated(PREFIX + "[error] " + msg);
-		Message.error(PREFIX + msg);
-	}
-
-	public static void warn(String msg) {
-		if (highlight)
-    		Message.deprecated(PREFIX + "[warn] " + msg);
-		else
-    		Message.warn(PREFIX + msg);
-	}
-	
-	public static void info(String msg) {
-		if (highlight)
-    		Message.deprecated(PREFIX + "[info] " + msg);
-		else
-    		Message.info(PREFIX + msg);
-	}
-
-	public static void verbose(String msg) {
-		Message.verbose(PREFIX + "[verbose] " + msg);
-	}
-	
-	public static void debug(String msg) {
-		if (highlight)
-    		Message.deprecated(PREFIX + "[debug] " + msg);
-		else
-    		Message.debug(PREFIX + msg);
-	}
+public class Log
+{
+    public static final String PREFIX = "Sigil: ";
+
+    private static final boolean highlight = false;
+
+
+    public static void error( String msg )
+    {
+        if ( highlight )
+            Message.deprecated( PREFIX + "[error] " + msg );
+        Message.error( PREFIX + msg );
+    }
+
+
+    public static void warn( String msg )
+    {
+        if ( highlight )
+            Message.deprecated( PREFIX + "[warn] " + msg );
+        else
+            Message.warn( PREFIX + msg );
+    }
+
+
+    public static void info( String msg )
+    {
+        if ( highlight )
+            Message.deprecated( PREFIX + "[info] " + msg );
+        else
+            Message.info( PREFIX + msg );
+    }
+
+
+    public static void verbose( String msg )
+    {
+        Message.verbose( PREFIX + "[verbose] " + msg );
+    }
+
+
+    public static void debug( String msg )
+    {
+        if ( highlight )
+            Message.deprecated( PREFIX + "[debug] " + msg );
+        else
+            Message.debug( PREFIX + msg );
+    }
 
 }

Modified: felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/ProjectRepository.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/ProjectRepository.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/ProjectRepository.java (original)
+++ felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/ProjectRepository.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.ivy;
 
+
 import java.io.File;
 import java.io.IOException;
 import java.net.URI;
@@ -46,75 +47,96 @@
 
 import org.osgi.framework.Version;
 
-public class ProjectRepository extends AbstractBundleRepository {
+
+public class ProjectRepository extends AbstractBundleRepository
+{
     private ArrayList<ISigilBundle> bundles;
     private ArrayList<ISigilBundle> wildBundles;
     private String projectFilePattern;
 
-    /* package */ProjectRepository(String id, String projectFilePattern) {
-        super(id);
-        this.projectFilePattern = projectFilePattern.replaceAll("\\[sigilproject\\]",
-                IBldProject.PROJECT_FILE);
+
+    /* package */ProjectRepository( String id, String projectFilePattern )
+    {
+        super( id );
+        this.projectFilePattern = projectFilePattern.replaceAll( "\\[sigilproject\\]", IBldProject.PROJECT_FILE );
     }
 
+
     @Override
-    public void accept(IRepositoryVisitor visitor, int options) {
-        for (ISigilBundle b : getBundles()) {
-            if (!visitor.visit(b)) {
+    public void accept( IRepositoryVisitor visitor, int options )
+    {
+        for ( ISigilBundle b : getBundles() )
+        {
+            if ( !visitor.visit( b ) )
+            {
                 break;
             }
         }
     }
 
+
     // override to provide fuzzy matching for wild-card exports.
     @Override
-    public Collection<ISigilBundle> findAllProviders(final IPackageImport pi, int options) {
-        return findProviders(pi, options, false);
+    public Collection<ISigilBundle> findAllProviders( final IPackageImport pi, int options )
+    {
+        return findProviders( pi, options, false );
     }
 
+
     @Override
-    public ISigilBundle findProvider(IPackageImport pi, int options) {
-        Collection<ISigilBundle> found = findProviders(pi, options, true);
+    public ISigilBundle findProvider( IPackageImport pi, int options )
+    {
+        Collection<ISigilBundle> found = findProviders( pi, options, true );
         return found.isEmpty() ? null : found.iterator().next();
     }
 
-    private Collection<ISigilBundle> findProviders(final IPackageImport pi, int options,
-            boolean findFirst) {
+
+    private Collection<ISigilBundle> findProviders( final IPackageImport pi, int options, boolean findFirst )
+    {
         ArrayList<ISigilBundle> found = new ArrayList<ISigilBundle>();
-        ILicensePolicy policy = findPolicy(pi);
+        ILicensePolicy policy = findPolicy( pi );
         String name = pi.getPackageName();
         VersionRange versions = pi.getVersions();
 
         // find exact match(es)
-        for (ISigilBundle bundle : getBundles()) {
-            if (policy.accept(bundle)) {
-                for (IPackageExport exp : bundle.getBundleInfo().getExports()) {
-                    if (name.equals(exp.getPackageName())
-                            && versions.contains(exp.getVersion())) {
-                        found.add(bundle);
-                        if (findFirst)
+        for ( ISigilBundle bundle : getBundles() )
+        {
+            if ( policy.accept( bundle ) )
+            {
+                for ( IPackageExport exp : bundle.getBundleInfo().getExports() )
+                {
+                    if ( name.equals( exp.getPackageName() ) && versions.contains( exp.getVersion() ) )
+                    {
+                        found.add( bundle );
+                        if ( findFirst )
                             return found;
                     }
                 }
             }
         }
 
-        if (!found.isEmpty())
+        if ( !found.isEmpty() )
             return found;
 
         // find best fuzzy match
         ISigilBundle fuzzyMatch = null;
         int fuzzyLen = 0;
 
-        for (ISigilBundle bundle : getWildBundles()) {
-            if (policy.accept(bundle)) {
-                for (IPackageExport exp : bundle.getBundleInfo().getExports()) {
+        for ( ISigilBundle bundle : getWildBundles() )
+        {
+            if ( policy.accept( bundle ) )
+            {
+                for ( IPackageExport exp : bundle.getBundleInfo().getExports() )
+                {
                     String export = exp.getPackageName();
-                    if (export.endsWith("*")) {
-                        String export1 = export.substring(0, export.length() - 1);
-                        if ((name.startsWith(export1) || export1.equals(name + "."))
-                                && versions.contains(exp.getVersion())) {
-                            if (export1.length() > fuzzyLen) {
+                    if ( export.endsWith( "*" ) )
+                    {
+                        String export1 = export.substring( 0, export.length() - 1 );
+                        if ( ( name.startsWith( export1 ) || export1.equals( name + "." ) )
+                            && versions.contains( exp.getVersion() ) )
+                        {
+                            if ( export1.length() > fuzzyLen )
+                            {
                                 fuzzyLen = export1.length();
                                 fuzzyMatch = bundle;
                             }
@@ -124,65 +146,89 @@
             }
         }
 
-        if (fuzzyMatch != null)
-            found.add(fuzzyMatch);
+        if ( fuzzyMatch != null )
+            found.add( fuzzyMatch );
 
         return found;
     }
 
-    private synchronized void init() {
-        System.out.println("Sigil: loading Project Repository: " + projectFilePattern);
+
+    private synchronized void init()
+    {
+        System.out.println( "Sigil: loading Project Repository: " + projectFilePattern );
 
         ArrayList<File> projects = new ArrayList<File>();
 
-        for (String pattern : projectFilePattern.split("\\s+")) {
-            try {
-                Collection<File> files = FindUtil.findFiles(pattern);
-                if (files.isEmpty()) {
-                    Log.warn("ProjectRepository: no projects match: " + pattern);
-                } else {
-                    projects.addAll(files);
+        for ( String pattern : projectFilePattern.split( "\\s+" ) )
+        {
+            try
+            {
+                Collection<File> files = FindUtil.findFiles( pattern );
+                if ( files.isEmpty() )
+                {
+                    Log.warn( "ProjectRepository: no projects match: " + pattern );
+                }
+                else
+                {
+                    projects.addAll( files );
                 }
-            } catch (IOException e) {
+            }
+            catch ( IOException e )
+            {
                 // pattern root dir does not exist
-                Log.error("ProjectRepository: " + pattern + ": " + e.getMessage());
+                Log.error( "ProjectRepository: " + pattern + ": " + e.getMessage() );
             }
         }
 
-        if (projects.isEmpty()) {
-            throw new IllegalArgumentException(
-                    "ProjectRepository: no projects found using pattern: "
-                            + projectFilePattern);
+        if ( projects.isEmpty() )
+        {
+            throw new IllegalArgumentException( "ProjectRepository: no projects found using pattern: "
+                + projectFilePattern );
         }
 
         bundles = new ArrayList<ISigilBundle>();
 
-        for (File proj : projects) {
-            try {
-                addBundles(proj, bundles);
-            } catch (IOException e) {
-                Log.warn("Skipping project: " + proj + ": " + e.getMessage());
-            } catch (ParseException e) {
-                Log.warn("Skipping project: " + proj + ": " + e.getMessage());
+        for ( File proj : projects )
+        {
+            try
+            {
+                addBundles( proj, bundles );
+            }
+            catch ( IOException e )
+            {
+                Log.warn( "Skipping project: " + proj + ": " + e.getMessage() );
+            }
+            catch ( ParseException e )
+            {
+                Log.warn( "Skipping project: " + proj + ": " + e.getMessage() );
             }
         }
     }
 
-    private List<ISigilBundle> getBundles() {
-        if (bundles == null) {
+
+    private List<ISigilBundle> getBundles()
+    {
+        if ( bundles == null )
+        {
             init();
         }
         return bundles;
     }
 
-    private List<ISigilBundle> getWildBundles() {
-        if (wildBundles == null) {
+
+    private List<ISigilBundle> getWildBundles()
+    {
+        if ( wildBundles == null )
+        {
             wildBundles = new ArrayList<ISigilBundle>();
-            for (ISigilBundle bundle : getBundles()) {
-                for (IPackageExport exp : bundle.getBundleInfo().getExports()) {
+            for ( ISigilBundle bundle : getBundles() )
+            {
+                for ( IPackageExport exp : bundle.getBundleInfo().getExports() )
+                {
                     String export = exp.getPackageName();
-                    if (export.endsWith("*")) {
-                        wildBundles.add(bundle);
+                    if ( export.endsWith( "*" ) )
+                    {
+                        wildBundles.add( bundle );
                         break;
                     }
                 }
@@ -191,100 +237,125 @@
         return wildBundles;
     }
 
-    public void refresh() {
+
+    public void refresh()
+    {
         bundles = null;
         wildBundles = null;
         notifyChange();
     }
 
-    private void addBundles(File file, List<ISigilBundle> list) throws IOException,
-            ParseException {
+
+    private void addBundles( File file, List<ISigilBundle> list ) throws IOException, ParseException
+    {
         URI uri = file.getCanonicalFile().toURI();
-        IBldProject project = BldFactory.getProject(uri);
+        IBldProject project = BldFactory.getProject( uri );
 
-        for (IBldBundle bb : project.getBundles()) {
+        for ( IBldBundle bb : project.getBundles() )
+        {
             IBundleModelElement info = new BundleModelElement();
 
-            for (IPackageExport pexport : bb.getExports()) {
-                info.addExport(pexport);
+            for ( IPackageExport pexport : bb.getExports() )
+            {
+                info.addExport( pexport );
             }
 
-            for (IPackageImport import1 : bb.getImports()) {
-                IPackageImport clone = (IPackageImport) import1.clone();
-                clone.setParent(null);
-                info.addImport(clone);
+            for ( IPackageImport import1 : bb.getImports() )
+            {
+                IPackageImport clone = ( IPackageImport ) import1.clone();
+                clone.setParent( null );
+                info.addImport( clone );
             }
 
-            for (IRequiredBundle require : bb.getRequires()) {
-                IRequiredBundle clone = (IRequiredBundle) require.clone();
-                clone.setParent(null);
-                info.addRequiredBundle(clone);
+            for ( IRequiredBundle require : bb.getRequires() )
+            {
+                IRequiredBundle clone = ( IRequiredBundle ) require.clone();
+                clone.setParent( null );
+                info.addRequiredBundle( clone );
             }
 
-            info.setSymbolicName(bb.getSymbolicName());
+            info.setSymbolicName( bb.getSymbolicName() );
 
-            Version version = new Version(bb.getVersion());
-            info.setVersion(version);
+            Version version = new Version( bb.getVersion() );
+            info.setVersion( version );
 
             ProjectBundle pb = new ProjectBundle();
-            pb.setBundleInfo(info);
-            pb.setId(bb.getId());
+            pb.setBundleInfo( info );
+            pb.setId( bb.getId() );
 
-            ModuleDescriptor md = SigilParser.instance().parseDescriptor(uri.toURL());
+            ModuleDescriptor md = SigilParser.instance().parseDescriptor( uri.toURL() );
 
             ModuleRevisionId mrid = md.getModuleRevisionId();
-            pb.setModule(mrid.getName());
-            pb.setOrg(mrid.getOrganisation());
+            pb.setModule( mrid.getName() );
+            pb.setOrg( mrid.getOrganisation() );
             // XXX: should revision be configurable?
-            pb.setRevision("latest." + md.getStatus());
+            pb.setRevision( "latest." + md.getStatus() );
 
-            list.add(pb);
-            Log.debug("ProjectRepository: added " + pb);
-            Log.debug("ProjectRepository: exports " + bb.getExports());
+            list.add( pb );
+            Log.debug( "ProjectRepository: added " + pb );
+            Log.debug( "ProjectRepository: exports " + bb.getExports() );
         }
     }
 
-    public static class ProjectBundle extends SigilBundle {
+    public static class ProjectBundle extends SigilBundle
+    {
         private String id;
         private String module;
         private String org;
         private String revision;
 
+
         @Override
-        public String toString() {
-            return "ProjectBundle[" + org + "@" + module + (id == null ? "" : "$" + id)
-                    + "#" + revision + "]";
+        public String toString()
+        {
+            return "ProjectBundle[" + org + "@" + module + ( id == null ? "" : "$" + id ) + "#" + revision + "]";
         }
 
-        public String getModule() {
+
+        public String getModule()
+        {
             return module;
         }
 
-        public void setModule(String module) {
+
+        public void setModule( String module )
+        {
             this.module = module;
         }
 
-        public String getId() {
+
+        public String getId()
+        {
             return id;
         }
 
-        public void setId(String id) {
+
+        public void setId( String id )
+        {
             this.id = id;
         }
 
-        public String getRevision() {
+
+        public String getRevision()
+        {
             return revision;
         }
 
-        public void setRevision(String rev) {
+
+        public void setRevision( String rev )
+        {
             this.revision = rev;
         }
 
-        public String getOrg() {
+
+        public String getOrg()
+        {
             return org;
         }
 
-        public void setOrg(String org) {
+
+        public void setOrg( String org )
+        {
             this.org = org;
         }
     }

Modified: felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/ProjectRepositoryProvider.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/ProjectRepositoryProvider.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/ProjectRepositoryProvider.java (original)
+++ felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/ProjectRepositoryProvider.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.ivy;
 
+
 import java.util.HashMap;
 import java.util.Properties;
 
@@ -26,21 +27,27 @@
 import org.apache.felix.sigil.repository.IRepositoryProvider;
 import org.apache.felix.sigil.repository.RepositoryException;
 
-public class ProjectRepositoryProvider implements IRepositoryProvider{
-	private static HashMap<String, ProjectRepository> cache = new HashMap<String, ProjectRepository>();
-	
-	public IBundleRepository createRepository(String id, Properties properties) throws RepositoryException {
-		ProjectRepository repository = cache.get(id);
-		
-		if (repository == null) {
-    		String pattern = properties.getProperty("pattern");
-    		if (pattern == null) {
-    		    throw new RepositoryException("property 'pattern' not specified.");
-    		}
-            repository = new ProjectRepository(id, pattern);
-            cache.put(id, repository);
-		}
-		
+
+public class ProjectRepositoryProvider implements IRepositoryProvider
+{
+    private static HashMap<String, ProjectRepository> cache = new HashMap<String, ProjectRepository>();
+
+
+    public IBundleRepository createRepository( String id, Properties properties ) throws RepositoryException
+    {
+        ProjectRepository repository = cache.get( id );
+
+        if ( repository == null )
+        {
+            String pattern = properties.getProperty( "pattern" );
+            if ( pattern == null )
+            {
+                throw new RepositoryException( "property 'pattern' not specified." );
+            }
+            repository = new ProjectRepository( id, pattern );
+            cache.put( id, repository );
+        }
+
         return repository;
     }
 }