felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dsav...@apache.org
Subject svn commit: r796467 [3/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/s...
Date Tue, 21 Jul 2009 18:51:41 GMT
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=796467&r1=796466&r2=796467&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 Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.config;
 
+
 import java.io.BufferedInputStream;
 import java.io.BufferedReader;
 import java.io.File;
@@ -56,7 +57,9 @@
 import org.apache.felix.sigil.model.osgi.IPackageImport.OSGiImport;
 import org.osgi.framework.Version;
 
-public class BldProject implements IBldProject, IRepositoryConfig {
+
+public class BldProject implements IBldProject, IRepositoryConfig
+{
     private static final String OVERRIDE_PREFIX = "sigil.";
     private static final int MAX_HEADER = 10240;
     // cache to avoid loading the same default config for each project
@@ -73,132 +76,152 @@
     private TreeSet<String> packageWildDefaults;
     private long lastModified;
 
-    /* package */BldProject(URI relLoc) {
+
+    /* package */BldProject( URI relLoc )
+    {
         config = new BldConfig();
-        convert = new BldConverter(config);
-        loc = new File(".").toURI().resolve(relLoc).normalize();
-        File f = new File(loc);
+        convert = new BldConverter( config );
+        loc = new File( "." ).toURI().resolve( relLoc ).normalize();
+        File f = new File( loc );
         lastModified = f.lastModified();
         baseDir = f.getParentFile();
     }
 
-    /* package */void load() throws IOException {
+
+    /* package */void load() throws IOException
+    {
         // allow System property overrides, e.g.
         // ANT_OPTS='-Dsigil.option\;addMissingImports=false' ant
-        config.merge(getOverrides());
+        config.merge( getOverrides() );
 
         InputStream in = null;
-        try {
-        	in = loc.toURL().openStream();
-	        BufferedInputStream bis = new BufferedInputStream(in);
-	        bis.mark(MAX_HEADER);
-	        readHeader(bis);
-	        bis.reset();
-	
-	        Properties p = new Properties();
-	        p.load(bis);
-	        config.merge(p);
-	
-	        Properties unknown = config.getUnknown();
-	        if (!unknown.isEmpty())
-	            System.err.println("WARN: unknown keys " + unknown.keySet() + " in " + loc);
-	
-	        loadDefaults(p);
-	        requirements = parseRequirements();
-        }
-        finally {
-        	if ( in != null ) {
-        		in.close();
-        	}
+        try
+        {
+            in = loc.toURL().openStream();
+            BufferedInputStream bis = new BufferedInputStream( in );
+            bis.mark( MAX_HEADER );
+            readHeader( bis );
+            bis.reset();
+
+            Properties p = new Properties();
+            p.load( bis );
+            config.merge( p );
+
+            Properties unknown = config.getUnknown();
+            if ( !unknown.isEmpty() )
+                System.err.println( "WARN: unknown keys " + unknown.keySet() + " in " + loc );
+
+            loadDefaults( p );
+            requirements = parseRequirements();
+        }
+        finally
+        {
+            if ( in != null )
+            {
+                in.close();
+            }
         }
     }
 
-    /* package */void loadDefaults(Properties p) throws IOException {
-        BldConfig c = loadDefaults(p, baseDir, null);
-        config.setDefault(c);
 
-        Properties options = config.getProps(null, BldConfig.P_OPTION);
+    /* package */void loadDefaults( Properties p ) throws IOException
+    {
+        BldConfig c = loadDefaults( p, baseDir, null );
+        config.setDefault( c );
 
-        if (!options.containsKey(BldAttr.OPTION_ADD_IMPORTS))
-            c.setProp(null, BldConfig.P_OPTION, BldAttr.OPTION_ADD_IMPORTS, "true");
+        Properties options = config.getProps( null, BldConfig.P_OPTION );
+
+        if ( !options.containsKey( BldAttr.OPTION_ADD_IMPORTS ) )
+            c.setProp( null, BldConfig.P_OPTION, BldAttr.OPTION_ADD_IMPORTS, "true" );
 
         // default omitUnusedImports option depends on number of bundles...
         // we set it here to avoid it being written by save(),
         // but as this may alter cached defaults, once set we have to reset it
         // for each project.
 
-        boolean omitSet = options.containsKey("__omit_set__");
+        boolean omitSet = options.containsKey( "__omit_set__" );
         boolean multiple = getBundleIds().size() > 1;
 
-        if (multiple || omitSet) {
-            if (!options.containsKey(BldAttr.OPTION_OMIT_IMPORTS) || omitSet) {
-                c.setProp(null, BldConfig.P_OPTION, BldAttr.OPTION_OMIT_IMPORTS, multiple + "");
-                c.setProp(null, BldConfig.P_OPTION, "__omit_set__", "true");
+        if ( multiple || omitSet )
+        {
+            if ( !options.containsKey( BldAttr.OPTION_OMIT_IMPORTS ) || omitSet )
+            {
+                c.setProp( null, BldConfig.P_OPTION, BldAttr.OPTION_OMIT_IMPORTS, multiple + "" );
+                c.setProp( null, BldConfig.P_OPTION, "__omit_set__", "true" );
             }
         }
     }
 
-    private synchronized BldConfig loadDefaults(Properties props, File base, BldConfig dflt)
-            throws IOException {
-        boolean cached = false;
-        String defaults = props.getProperty(BldConfig.S_DEFAULTS, "-"
-                + IBldProject.PROJECT_DEFAULTS);
-
-        if (base != null && defaults.length() > 0) {
-            boolean ignore = defaults.startsWith("-");
 
-            if (ignore)
-                defaults = defaults.substring(1);
+    private synchronized BldConfig loadDefaults( Properties props, File base, BldConfig dflt ) throws IOException
+    {
+        boolean cached = false;
+        String defaults = props.getProperty( BldConfig.S_DEFAULTS, "-" + IBldProject.PROJECT_DEFAULTS );
 
-            try {
-                File file = new File(base, defaults).getCanonicalFile();
+        if ( base != null && defaults.length() > 0 )
+        {
+            boolean ignore = defaults.startsWith( "-" );
+
+            if ( ignore )
+                defaults = defaults.substring( 1 );
+
+            try
+            {
+                File file = new File( base, defaults ).getCanonicalFile();
                 URL url = file.toURL();
 
-                if (dflt == null) {
-                    dflt = defaultsCache.get(url);
-                    if (dflt != null)
+                if ( dflt == null )
+                {
+                    dflt = defaultsCache.get( url );
+                    if ( dflt != null )
                         return dflt;
 
                     dflt = new BldConfig();
-                    defaultsCache.put(url, dflt);
+                    defaultsCache.put( url, dflt );
                     cached = true;
                 }
 
                 Properties p = new Properties();
-                p.load(url.openStream());
-                dflt.merge(p);
+                p.load( url.openStream() );
+                dflt.merge( p );
 
                 ignore = false;
-                loadDefaults(p, file.getParentFile(), dflt);
-            } catch (IOException e) {
-                if (!ignore)
+                loadDefaults( p, file.getParentFile(), dflt );
+            }
+            catch ( IOException e )
+            {
+                if ( !ignore )
                     throw e;
             }
         }
 
-        if (dflt == null)
+        if ( dflt == null )
             return new BldConfig();
 
-        if (cached) {
+        if ( cached )
+        {
             Properties unknown = dflt.getUnknown();
-            if (!unknown.isEmpty())
-                System.err.println("WARN: unknown keys " + unknown.keySet() + " in defaults for "
-                        + loc);
+            if ( !unknown.isEmpty() )
+                System.err.println( "WARN: unknown keys " + unknown.keySet() + " in defaults for " + loc );
         }
 
         return dflt;
     }
 
-    private static Properties getOverrides() {
-        if (overrides == null) {
+
+    private static Properties getOverrides()
+    {
+        if ( overrides == null )
+        {
             overrides = new Properties();
             Properties sysProps = System.getProperties();
 
-            for (Object okey : sysProps.keySet()) {
-                String key = (String) okey;
-                if (key.startsWith(OVERRIDE_PREFIX)) {
-                    overrides.setProperty(key.substring(OVERRIDE_PREFIX.length()), sysProps
-                            .getProperty(key));
+            for ( Object okey : sysProps.keySet() )
+            {
+                String key = ( String ) okey;
+                if ( key.startsWith( OVERRIDE_PREFIX ) )
+                {
+                    overrides.setProperty( key.substring( OVERRIDE_PREFIX.length() ), sysProps.getProperty( key ) );
                 }
             }
         }
@@ -206,78 +229,101 @@
         return overrides;
     }
 
-    private void readHeader(InputStream in) throws IOException {
-        BufferedReader r = new BufferedReader(new InputStreamReader(in));
+
+    private void readHeader( InputStream in ) throws IOException
+    {
+        BufferedReader r = new BufferedReader( new InputStreamReader( in ) );
         StringBuffer header = new StringBuffer();
         String line;
-        while ((line = r.readLine()) != null) {
-            if (line.startsWith("#")) {
-                header.append(line);
-                header.append("\n");
-            } else {
-                config.setComment(header.toString());
+        while ( ( line = r.readLine() ) != null )
+        {
+            if ( line.startsWith( "#" ) )
+            {
+                header.append( line );
+                header.append( "\n" );
+            }
+            else
+            {
+                config.setComment( header.toString() );
                 break;
             }
         }
     }
 
-    public File resolve(String path) {
-        File file = new File(path);
-        if (!file.isAbsolute()) {
+
+    public File resolve( String path )
+    {
+        File file = new File( path );
+        if ( !file.isAbsolute() )
+        {
             // can't use loc.resolve(value), as value may not be valid URI.
-            file = new File(baseDir, path);
+            file = new File( baseDir, path );
         }
         return file;
     }
 
-    public String getVersion() {
-        String version = config.getString(null, BldConfig.S_VERSION);
+
+    public String getVersion()
+    {
+        String version = config.getString( null, BldConfig.S_VERSION );
         return version == null ? "0" : version;
     }
 
-    public IBundleModelElement getDependencies() {
+
+    public IBundleModelElement getDependencies()
+    {
         IBundleModelElement dependencies = new BundleModelElement();
 
-        for (IModelElement element : getRequirements().children()) {
-            if (element instanceof IPackageImport) {
-                IPackageImport import1 = (IPackageImport) element;
-                if (!import1.isDependency())
+        for ( IModelElement element : getRequirements().children() )
+        {
+            if ( element instanceof IPackageImport )
+            {
+                IPackageImport import1 = ( IPackageImport ) element;
+                if ( !import1.isDependency() )
                     continue;
 
-                IPackageImport pi = (IPackageImport) (element.clone());
-                pi.setParent(null);
-                dependencies.addImport(pi);
-            } else {
-                IRequiredBundle rb = (IRequiredBundle) (element.clone());
-                rb.setParent(null);
-                dependencies.addRequiredBundle(rb);
+                IPackageImport pi = ( IPackageImport ) ( element.clone() );
+                pi.setParent( null );
+                dependencies.addImport( pi );
+            }
+            else
+            {
+                IRequiredBundle rb = ( IRequiredBundle ) ( element.clone() );
+                rb.setParent( null );
+                dependencies.addRequiredBundle( rb );
             }
         }
 
         boolean containsComposite = false;
 
-        for (IBldBundle bundle : getBundles()) {
-            if (!bundle.getComposites().isEmpty()) {
+        for ( IBldBundle bundle : getBundles() )
+        {
+            if ( !bundle.getComposites().isEmpty() )
+            {
                 containsComposite = true;
                 break;
             }
         }
 
         // add dependency on component activator
-        if (containsComposite) {
+        if ( containsComposite )
+        {
             PackageImport pi = new PackageImport();
-            pi.setPackageName(BundleBuilder.COMPONENT_ACTIVATOR_PKG);
-            pi.setOSGiImport(OSGiImport.NEVER);
-            dependencies.addImport(pi);
+            pi.setPackageName( BundleBuilder.COMPONENT_ACTIVATOR_PKG );
+            pi.setOSGiImport( OSGiImport.NEVER );
+            dependencies.addImport( pi );
         }
 
         return dependencies;
     }
 
-    private IBundleModelElement getRequirements() {
+
+    private IBundleModelElement getRequirements()
+    {
         return requirements;
     }
 
+
     /*
      * private boolean globMatch(String pkg, Set<String> set) { // exact match
      * if (set.contains(pkg)) return true;
@@ -296,75 +342,98 @@
      * auto runtime ignore
      * 
      */
-    private void setResolve(IPackageImport pi, String resolve) throws IOException {
-        if (pi.isOptional())
-            pi.setDependency(false);
-
-        if (BldAttr.RESOLVE_COMPILE.equals(resolve)) {
-            if (pi.isOptional())
-                pi.setDependency(true);
+    private void setResolve( IPackageImport pi, String resolve ) throws IOException
+    {
+        if ( pi.isOptional() )
+            pi.setDependency( false );
+
+        if ( BldAttr.RESOLVE_COMPILE.equals( resolve ) )
+        {
+            if ( pi.isOptional() )
+                pi.setDependency( true );
             else
-                pi.setOSGiImport(OSGiImport.NEVER);
-        } else if (BldAttr.RESOLVE_RUNTIME.equals(resolve)) {
-            pi.setDependency(false);
-            pi.setOSGiImport(OSGiImport.ALWAYS);
-        } else if (BldAttr.RESOLVE_AUTO.equals(resolve)) {
-            pi.setDependency(false);
-        } else if (BldAttr.RESOLVE_IGNORE.equals(resolve)) {
-            pi.setDependency(false);
-            pi.setOSGiImport(OSGiImport.NEVER);
-        } else if (resolve != null) {
-            throw new IOException("Bad attribute value: " + BldAttr.RESOLVE_ATTRIBUTE + "="
-                    + resolve);
+                pi.setOSGiImport( OSGiImport.NEVER );
+        }
+        else if ( BldAttr.RESOLVE_RUNTIME.equals( resolve ) )
+        {
+            pi.setDependency( false );
+            pi.setOSGiImport( OSGiImport.ALWAYS );
+        }
+        else if ( BldAttr.RESOLVE_AUTO.equals( resolve ) )
+        {
+            pi.setDependency( false );
+        }
+        else if ( BldAttr.RESOLVE_IGNORE.equals( resolve ) )
+        {
+            pi.setDependency( false );
+            pi.setOSGiImport( OSGiImport.NEVER );
+        }
+        else if ( resolve != null )
+        {
+            throw new IOException( "Bad attribute value: " + BldAttr.RESOLVE_ATTRIBUTE + "=" + resolve );
         }
     }
 
+
     /**
      * get external resolve= attribute from internal PackageImport flags. This
      * is called from BldConverter.setBundle().
      */
-    public static String getResolve(IPackageImport pi, boolean isDependency) {
+    public static String getResolve( IPackageImport pi, boolean isDependency )
+    {
         OSGiImport osgiImport = pi.getOSGiImport();
         String resolve = null;
 
-        if (isDependency) {
-            if (osgiImport.equals(OSGiImport.NEVER) || pi.isOptional())
+        if ( isDependency )
+        {
+            if ( osgiImport.equals( OSGiImport.NEVER ) || pi.isOptional() )
                 resolve = BldAttr.RESOLVE_COMPILE;
-        } else {
-            switch (osgiImport) {
-            case ALWAYS:
-                resolve = BldAttr.RESOLVE_RUNTIME;
-                break;
-            case AUTO:
-                resolve = BldAttr.RESOLVE_AUTO;
-                break;
-            case NEVER:
-                resolve = BldAttr.RESOLVE_IGNORE;
-                break;
+        }
+        else
+        {
+            switch ( osgiImport )
+            {
+                case ALWAYS:
+                    resolve = BldAttr.RESOLVE_RUNTIME;
+                    break;
+                case AUTO:
+                    resolve = BldAttr.RESOLVE_AUTO;
+                    break;
+                case NEVER:
+                    resolve = BldAttr.RESOLVE_IGNORE;
+                    break;
             }
         }
         return resolve;
     }
 
-    public String getDefaultPackageVersion(String name) {
-        if (packageDefaults == null) {
-            packageDefaults = config.getProps(null, BldConfig.P_PACKAGE_VERSION);
+
+    public String getDefaultPackageVersion( String name )
+    {
+        if ( packageDefaults == null )
+        {
+            packageDefaults = config.getProps( null, BldConfig.P_PACKAGE_VERSION );
             packageWildDefaults = new TreeSet<String>();
 
-            for (Object key : packageDefaults.keySet()) {
-                String pkg = (String) key;
-                if (pkg.endsWith("*")) {
-                    packageWildDefaults.add(pkg.substring(0, pkg.length() - 1));
+            for ( Object key : packageDefaults.keySet() )
+            {
+                String pkg = ( String ) key;
+                if ( pkg.endsWith( "*" ) )
+                {
+                    packageWildDefaults.add( pkg.substring( 0, pkg.length() - 1 ) );
                 }
             }
         }
 
-        String version = packageDefaults.getProperty(name);
+        String version = packageDefaults.getProperty( name );
 
-        if (version == null) {
-            for (String pkg : packageWildDefaults) {
-                if (name.startsWith(pkg)) {
-                    version = packageDefaults.getProperty(pkg + "*");
+        if ( version == null )
+        {
+            for ( String pkg : packageWildDefaults )
+            {
+                if ( name.startsWith( pkg ) )
+                {
+                    version = packageDefaults.getProperty( pkg + "*" );
                     // break; -- don't break, as we want the longest match
                 }
             }
@@ -373,399 +442,511 @@
         return version;
     }
 
-    private synchronized BundleModelElement parseRequirements() throws IOException {
+
+    private synchronized BundleModelElement parseRequirements() throws IOException
+    {
         BundleModelElement reqs = new BundleModelElement();
 
         List<String> sourceContents = getSourcePkgs();
         HashSet<String> exports = new HashSet<String>();
 
-        for (IBldBundle bundle : getBundles()) {
-            for (IPackageExport export : bundle.getExports()) {
-                exports.add(export.getPackageName());
+        for ( IBldBundle bundle : getBundles() )
+        {
+            for ( IPackageExport export : bundle.getExports() )
+            {
+                exports.add( export.getPackageName() );
             }
         }
 
-        Map<String, Map<String, String>> imports = config.getMap(null, BldConfig.M_IMPORTS);
+        Map<String, Map<String, String>> imports = config.getMap( null, BldConfig.M_IMPORTS );
 
-        for (String name : imports.keySet()) {
-            Map<String, String> attr = imports.get(name);
+        for ( String name : imports.keySet() )
+        {
+            Map<String, String> attr = imports.get( name );
 
-            String resolve = attr.get(BldAttr.RESOLVE_ATTRIBUTE);
-            String resolution = attr.get(BldAttr.RESOLUTION_ATTRIBUTE);
-            String versions = attr.containsKey(BldAttr.VERSION_ATTRIBUTE) ? attr
-                    .get(BldAttr.VERSION_ATTRIBUTE) : getDefaultPackageVersion(name);
+            String resolve = attr.get( BldAttr.RESOLVE_ATTRIBUTE );
+            String resolution = attr.get( BldAttr.RESOLUTION_ATTRIBUTE );
+            String versions = attr.containsKey( BldAttr.VERSION_ATTRIBUTE ) ? attr.get( BldAttr.VERSION_ATTRIBUTE )
+                : getDefaultPackageVersion( name );
 
             PackageImport pi = new PackageImport();
-            pi.setPackageName(name);
+            pi.setPackageName( name );
 
             // avoid dependency on self-exports
             // XXX: BldConverter.setBundle contains similar logic
-            if (exports.contains(name)
-                    && (sourceContents.contains(name) || sourceContents.isEmpty())) {
-                pi.setDependency(false);
-                if (versions == null)
+            if ( exports.contains( name ) && ( sourceContents.contains( name ) || sourceContents.isEmpty() ) )
+            {
+                pi.setDependency( false );
+                if ( versions == null )
                     versions = getVersion();
             }
 
-            if (!checkVersionRange(versions)) {
-                throw new IOException("Failed to parse version range for " + resolve
-                        + " missing \"'s around version range?");
+            if ( !checkVersionRange( versions ) )
+            {
+                throw new IOException( "Failed to parse version range for " + resolve
+                    + " missing \"'s around version range?" );
             }
 
-            pi.setVersions(VersionRange.parseVersionRange(versions));
+            pi.setVersions( VersionRange.parseVersionRange( versions ) );
 
-            if (BldAttr.RESOLUTION_OPTIONAL.equals(resolution)) {
-                pi.setOptional(true);
-            } else if (resolution != null) {
-                throw new IOException("Bad attribute value: " + BldAttr.RESOLUTION_ATTRIBUTE + "="
-                        + resolution);
+            if ( BldAttr.RESOLUTION_OPTIONAL.equals( resolution ) )
+            {
+                pi.setOptional( true );
+            }
+            else if ( resolution != null )
+            {
+                throw new IOException( "Bad attribute value: " + BldAttr.RESOLUTION_ATTRIBUTE + "=" + resolution );
             }
 
-            setResolve(pi, resolve);
+            setResolve( pi, resolve );
 
-            reqs.addImport(pi);
+            reqs.addImport( pi );
         }
 
-        Map<String, Map<String, String>> requires = config.getMap(null, BldConfig.M_REQUIRES);
-        Properties bundleDefaults = config.getProps(null, BldConfig.P_BUNDLE_VERSION);
+        Map<String, Map<String, String>> requires = config.getMap( null, BldConfig.M_REQUIRES );
+        Properties bundleDefaults = config.getProps( null, BldConfig.P_BUNDLE_VERSION );
 
-        if (requires != null) {
-            for (String name : requires.keySet()) {
-                Map<String, String> attr = requires.get(name);
-                String versions = attr.containsKey(BldAttr.VERSION_ATTRIBUTE) ? attr
-                        .get(BldAttr.VERSION_ATTRIBUTE) : bundleDefaults.getProperty(name);
+        if ( requires != null )
+        {
+            for ( String name : requires.keySet() )
+            {
+                Map<String, String> attr = requires.get( name );
+                String versions = attr.containsKey( BldAttr.VERSION_ATTRIBUTE ) ? attr.get( BldAttr.VERSION_ATTRIBUTE )
+                    : bundleDefaults.getProperty( name );
 
                 RequiredBundle rb = new RequiredBundle();
-                rb.setSymbolicName(name);
-                rb.setVersions(VersionRange.parseVersionRange(versions));
+                rb.setSymbolicName( name );
+                rb.setVersions( VersionRange.parseVersionRange( versions ) );
 
-                reqs.addRequiredBundle(rb);
+                reqs.addRequiredBundle( rb );
             }
         }
 
-        for (IBldBundle bundle : getBundles()) {
+        for ( IBldBundle bundle : getBundles() )
+        {
             IRequiredBundle fh = bundle.getFragmentHost();
-            if (fh != null)
-                reqs.addRequiredBundle(fh);
+            if ( fh != null )
+                reqs.addRequiredBundle( fh );
         }
 
         return reqs;
     }
 
-    private boolean checkVersionRange(String versions) {
-        if (versions == null || versions.length() == 0) {
+
+    private boolean checkVersionRange( String versions )
+    {
+        if ( versions == null || versions.length() == 0 )
+        {
             return true;
-        } else {
-            switch (versions.charAt(0)) {
-            case '(':
-            case '[':
-                switch (versions.charAt(versions.length() - 1)) {
-                case ')':
-                case ']':
-                    return true;
+        }
+        else
+        {
+            switch ( versions.charAt( 0 ) )
+            {
+                case '(':
+                case '[':
+                    switch ( versions.charAt( versions.length() - 1 ) )
+                    {
+                        case ')':
+                        case ']':
+                            return true;
+                        default:
+                            return false;
+                    }
                 default:
-                    return false;
-                }
-            default:
-                return true;
+                    return true;
             }
         }
     }
 
-    public List<String> getBundleIds() {
-        List<String> ids = config.getList(null, BldConfig.C_BUNDLES);
-        if (ids == null)
+
+    public List<String> getBundleIds()
+    {
+        List<String> ids = config.getList( null, BldConfig.C_BUNDLES );
+        if ( ids == null )
             return Collections.emptyList();
         return ids;
     }
 
-    public List<IBldBundle> getBundles() {
+
+    public List<IBldBundle> getBundles()
+    {
         ArrayList<IBldBundle> list = new ArrayList<IBldBundle>();
 
-        for (String id : getBundleIds()) {
-            list.add(new BldBundle(id));
+        for ( String id : getBundleIds() )
+        {
+            list.add( new BldBundle( id ) );
         }
 
         return list;
     }
 
+
     // Implement IBldConfig: getRepositoryConfig
 
-    public Map<String, Properties> getRepositoryConfig() {
+    public Map<String, Properties> getRepositoryConfig()
+    {
         HashMap<String, Properties> map = new HashMap<String, Properties>();
 
         final Map<String, String> env = System.getenv();
         final Properties props = new Properties();
-        try {
+        try
+        {
             // supports ${.} and ${..} expansions
-            props.setProperty(".", resolve(".").getCanonicalPath());
-            props.setProperty("..", resolve("..").getCanonicalPath());
-        } catch (IOException e) {
+            props.setProperty( ".", resolve( "." ).getCanonicalPath() );
+            props.setProperty( "..", resolve( ".." ).getCanonicalPath() );
+        }
+        catch ( IOException e )
+        {
         }
 
-        for (String name : config.getList(null, BldConfig.C_REPOSITORIES)) {
-            Properties repo = config.getProps(null, name);
-
-            for (Object k : repo.keySet()) {
-                String key = (String) k;
-                String value = repo.getProperty(key);
-
-                String expand = BldUtil.expand(value, new Properties() {
-                    public String getProperty(String name) {
-                        return props.getProperty(name, env.get(name));
+        for ( String name : config.getList( null, BldConfig.C_REPOSITORIES ) )
+        {
+            Properties repo = config.getProps( null, name );
+
+            for ( Object k : repo.keySet() )
+            {
+                String key = ( String ) k;
+                String value = repo.getProperty( key );
+
+                String expand = BldUtil.expand( value, new Properties()
+                {
+                    public String getProperty( String name )
+                    {
+                        return props.getProperty( name, env.get( name ) );
                     }
-                });
+                } );
 
-                if (!value.equals(expand)) {
+                if ( !value.equals( expand ) )
+                {
                     value = expand;
-                    repo.setProperty(key, value);
+                    repo.setProperty( key, value );
                 }
 
                 // backwards compatible support before ${.} and ${..} was added
-                if (value.startsWith("./") || value.startsWith("../")) {
-                    try {
+                if ( value.startsWith( "./" ) || value.startsWith( "../" ) )
+                {
+                    try
+                    {
                         // need canonical path, to normalise
-                        value = resolve(value).getCanonicalPath();
-                    } catch (IOException e) {
+                        value = resolve( value ).getCanonicalPath();
+                    }
+                    catch ( IOException e )
+                    {
                     }
-                    repo.setProperty(key, value);
+                    repo.setProperty( key, value );
                 }
             }
 
-            map.put(name, repo);
+            map.put( name, repo );
         }
         return map;
     }
 
-    public Properties getOptions() {
-        return config.getProps(null, BldConfig.P_OPTION);
+
+    public Properties getOptions()
+    {
+        return config.getProps( null, BldConfig.P_OPTION );
     }
 
-    public Properties getDefaultPackageVersions() {
-        return config.getProps(null, BldConfig.P_PACKAGE_VERSION);
+
+    public Properties getDefaultPackageVersions()
+    {
+        return config.getProps( null, BldConfig.P_PACKAGE_VERSION );
     }
 
-    public ISigilBundle getDefaultBundle() {
+
+    public ISigilBundle getDefaultBundle()
+    {
         List<String> bundles = getBundleIds();
-        if (bundles.isEmpty())
+        if ( bundles.isEmpty() )
             return null;
 
-        String id = bundles.get(0);
-        return getSigilBundle(id);
+        String id = bundles.get( 0 );
+        return getSigilBundle( id );
     }
 
-    public ISigilBundle getSigilBundle(String id) {
-        BldBundle bundle = new BldBundle(id);
-        return convert.getBundle(id, bundle);
+
+    public ISigilBundle getSigilBundle( String id )
+    {
+        BldBundle bundle = new BldBundle( id );
+        return convert.getBundle( id, bundle );
     }
 
-    public void setDefaultBundle(ISigilBundle bundle) {
-        setSigilBundle(null, bundle);
+
+    public void setDefaultBundle( ISigilBundle bundle )
+    {
+        setSigilBundle( null, bundle );
     }
 
-    public void setSigilBundle(String id, ISigilBundle bundle) {
+
+    public void setSigilBundle( String id, ISigilBundle bundle )
+    {
         List<String> ids = getBundleIds();
 
-        if (ids.isEmpty()) {
+        if ( ids.isEmpty() )
+        {
             ArrayList<String> list = new ArrayList<String>();
-            list.add(id == null ? bundle.getBundleInfo().getSymbolicName() : id);
-            config.setList(null, BldConfig.C_BUNDLES, list);
-        } else if (id == null) {
-            id = ids.get(0);
-        } else if (!ids.contains(id)) {
-            List<String> list = config.getList(null, BldConfig.C_BUNDLES);
-            list.add(id);
-            config.setList(null, BldConfig.C_BUNDLES, list);
+            list.add( id == null ? bundle.getBundleInfo().getSymbolicName() : id );
+            config.setList( null, BldConfig.C_BUNDLES, list );
+        }
+        else if ( id == null )
+        {
+            id = ids.get( 0 );
+        }
+        else if ( !ids.contains( id ) )
+        {
+            List<String> list = config.getList( null, BldConfig.C_BUNDLES );
+            list.add( id );
+            config.setList( null, BldConfig.C_BUNDLES, list );
         }
 
-        if (ids.size() == 1)
+        if ( ids.size() == 1 )
             id = null; // don't prefix default bundle with id
 
-        convert.setBundle(id, bundle);
+        convert.setBundle( id, bundle );
     }
 
-    public void save() throws IOException {
-        saveAs(new File(loc));
+
+    public void save() throws IOException
+    {
+        saveAs( new File( loc ) );
     }
 
-    public void saveAs(File path) throws IOException {
-        File part = new File(path.getPath() + ".part");
-        saveTo(new FileOutputStream((part)));
+
+    public void saveAs( File path ) throws IOException
+    {
+        File part = new File( path.getPath() + ".part" );
+        saveTo( new FileOutputStream( ( part ) ) );
 
         path.delete();
-        if (!part.renameTo(path))
-            throw new IOException("failed to rename " + part + " to " + path);
+        if ( !part.renameTo( path ) )
+            throw new IOException( "failed to rename " + part + " to " + path );
     }
 
-    public void saveTo(OutputStream out) {
-        PrintWriter writer = new PrintWriter(new OutputStreamWriter(out));
-        config.write(writer);
+
+    public void saveTo( OutputStream out )
+    {
+        PrintWriter writer = new PrintWriter( new OutputStreamWriter( out ) );
+        config.write( writer );
         writer.close();
     }
 
-    public List<String> getSourceDirs() {
-        List<String> list = config.getList(null, BldConfig.L_SRC_CONTENTS);
+
+    public List<String> getSourceDirs()
+    {
+        List<String> list = config.getList( null, BldConfig.L_SRC_CONTENTS );
         return list != null ? list : Collections.<String> emptyList();
     }
 
-    public List<String> getSourcePkgs() {
-        if (sourcePkgs == null) {
+
+    public List<String> getSourcePkgs()
+    {
+        if ( sourcePkgs == null )
+        {
             sourcePkgs = new ArrayList<String>();
-            for (String src : getSourceDirs()) {
-                File dir = resolve(src);
-                if (!dir.isDirectory()) {
-                    System.err.println("WARN: sourcedir does not exist: " + dir);
+            for ( String src : getSourceDirs() )
+            {
+                File dir = resolve( src );
+                if ( !dir.isDirectory() )
+                {
+                    System.err.println( "WARN: sourcedir does not exist: " + dir );
                     continue;
                     // throw new RuntimeException("sourcedir: " + dir +
                     // " : is not a directory.");
                 }
-                findSrcPkgs(dir, null, sourcePkgs);
+                findSrcPkgs( dir, null, sourcePkgs );
             }
         }
 
         return sourcePkgs;
     }
 
-    private void findSrcPkgs(File dir, String pkg, List<String> result) {
+
+    private void findSrcPkgs( File dir, String pkg, List<String> result )
+    {
         ArrayList<File> dirs = new ArrayList<File>();
         boolean found = false;
 
-        for (String name : dir.list()) {
-            if (name.endsWith(".java")) {
+        for ( String name : dir.list() )
+        {
+            if ( name.endsWith( ".java" ) )
+            {
                 found = true;
-            } else if (!name.equals(".svn")) {
-                File d = new File(dir, name);
-                if (d.isDirectory())
-                    dirs.add(d);
+            }
+            else if ( !name.equals( ".svn" ) )
+            {
+                File d = new File( dir, name );
+                if ( d.isDirectory() )
+                    dirs.add( d );
             }
         }
 
-        if (pkg == null) {
+        if ( pkg == null )
+        {
             pkg = "";
-        } else if (pkg.equals("")) {
+        }
+        else if ( pkg.equals( "" ) )
+        {
             pkg = dir.getName();
-        } else {
+        }
+        else
+        {
             pkg = pkg + "." + dir.getName();
         }
 
-        if (found)
-            result.add(pkg);
+        if ( found )
+            result.add( pkg );
 
-        for (File d : dirs)
-            findSrcPkgs(d, pkg, result);
+        for ( File d : dirs )
+            findSrcPkgs( d, pkg, result );
     }
 
     /**
      * BldBundle
      * 
      */
-    class BldBundle implements IBldBundle {
+    class BldBundle implements IBldBundle
+    {
         private String id;
 
-        public BldBundle(String id) {
+
+        public BldBundle( String id )
+        {
             this.id = id;
         }
 
-        public File resolve(String path) {
-            return BldProject.this.resolve(path);
+
+        public File resolve( String path )
+        {
+            return BldProject.this.resolve( path );
         }
 
-        private String getString(String key) {
-            return config.getString(id, key);
+
+        private String getString( String key )
+        {
+            return config.getString( id, key );
         }
 
-        private List<String> getList(String key) {
-            List<String> list = config.getList(id, key);
+
+        private List<String> getList( String key )
+        {
+            List<String> list = config.getList( id, key );
             return list != null ? list : Collections.<String> emptyList();
         }
 
-        private Map<String, Map<String, String>> getMap(String key) {
-            Map<String, Map<String, String>> map = config.getMap(id, key);
+
+        private Map<String, Map<String, String>> getMap( String key )
+        {
+            Map<String, Map<String, String>> map = config.getMap( id, key );
             return map != null ? map : Collections.<String, Map<String, String>> emptyMap();
         }
 
-        public String getActivator() {
-            return getString(BldConfig.S_ACTIVATOR);
+
+        public String getActivator()
+        {
+            return getString( BldConfig.S_ACTIVATOR );
         }
 
-        public String getId() {
-            String name = getString("id");
+
+        public String getId()
+        {
+            String name = getString( "id" );
             return name != null ? name : id;
         }
 
-        public String getVersion() {
-            String ver = getString(BldConfig.S_VERSION);
-            if (ver == null) {
+
+        public String getVersion()
+        {
+            String ver = getString( BldConfig.S_VERSION );
+            if ( ver == null )
+            {
                 ver = BldProject.this.getVersion();
             }
             return ver;
         }
 
-        public String getSymbolicName() {
-            String name = getString(BldConfig.S_SYM_NAME);
+
+        public String getSymbolicName()
+        {
+            String name = getString( BldConfig.S_SYM_NAME );
             return name != null ? name : getId();
         }
 
-        public List<IPackageExport> getExports() {
+
+        public List<IPackageExport> getExports()
+        {
             ArrayList<IPackageExport> list = new ArrayList<IPackageExport>();
-            Map<String, Map<String, String>> exports = getMap(BldConfig.M_EXPORTS);
+            Map<String, Map<String, String>> exports = getMap( BldConfig.M_EXPORTS );
 
-            if (exports != null) {
-                for (String name : exports.keySet()) {
-                    Map<String, String> attrs = exports.get(name);
+            if ( exports != null )
+            {
+                for ( String name : exports.keySet() )
+                {
+                    Map<String, String> attrs = exports.get( name );
                     PackageExport pkgExport = new PackageExport();
-                    pkgExport.setPackageName(name);
+                    pkgExport.setPackageName( name );
 
-                    String version = attrs.get(BldAttr.VERSION_ATTRIBUTE);
+                    String version = attrs.get( BldAttr.VERSION_ATTRIBUTE );
                     // only default export version from local packages
-                    if (version == null
-                            && (getSourcePkgs().isEmpty() || getSourcePkgs().contains(name))) {
+                    if ( version == null && ( getSourcePkgs().isEmpty() || getSourcePkgs().contains( name ) ) )
+                    {
                         version = getVersion();
                     }
 
-                    if (version != null)
-                        pkgExport.setVersion(new Version(version));
+                    if ( version != null )
+                        pkgExport.setVersion( new Version( version ) );
 
-                    list.add(pkgExport);
+                    list.add( pkgExport );
                 }
             }
 
             return list;
         }
 
-        public List<IPackageImport> getImports() {
+
+        public List<IPackageImport> getImports()
+        {
             ArrayList<IPackageImport> list = new ArrayList<IPackageImport>();
 
-            for (IPackageImport import1 : getRequirements().childrenOfType(IPackageImport.class)) {
-                list.add(import1);
+            for ( IPackageImport import1 : getRequirements().childrenOfType( IPackageImport.class ) )
+            {
+                list.add( import1 );
             }
 
             return list;
         }
 
-        public List<IRequiredBundle> getRequires() {
+
+        public List<IRequiredBundle> getRequires()
+        {
             ArrayList<IRequiredBundle> list = new ArrayList<IRequiredBundle>();
-            list.addAll(Arrays.asList(getRequirements().childrenOfType(IRequiredBundle.class)));
+            list.addAll( Arrays.asList( getRequirements().childrenOfType( IRequiredBundle.class ) ) );
 
-            for (IBldBundle bundle : getBundles()) {
+            for ( IBldBundle bundle : getBundles() )
+            {
                 IRequiredBundle fh = bundle.getFragmentHost();
-                if (fh != null)
-                    list.remove(fh);
+                if ( fh != null )
+                    list.remove( fh );
             }
 
             return list;
         }
 
-        public IRequiredBundle getFragmentHost() {
+
+        public IRequiredBundle getFragmentHost()
+        {
             IRequiredBundle fragment = null;
-            Map<String, Map<String, String>> fragments = getMap(BldConfig.M_FRAGMENT);
-            if (fragments != null) {
-                for (String name : fragments.keySet()) {
-                    Map<String, String> attr = fragments.get(name);
-                    String versions = attr.isEmpty() ? null : attr.get(BldAttr.VERSION_ATTRIBUTE);
+            Map<String, Map<String, String>> fragments = getMap( BldConfig.M_FRAGMENT );
+            if ( fragments != null )
+            {
+                for ( String name : fragments.keySet() )
+                {
+                    Map<String, String> attr = fragments.get( name );
+                    String versions = attr.isEmpty() ? null : attr.get( BldAttr.VERSION_ATTRIBUTE );
                     fragment = new RequiredBundle();
-                    fragment.setSymbolicName(name);
-                    fragment.setVersions(VersionRange.parseVersionRange(versions));
+                    fragment.setSymbolicName( name );
+                    fragment.setVersions( VersionRange.parseVersionRange( versions ) );
                     break;
                 }
             }
@@ -773,50 +954,67 @@
             return fragment;
         }
 
-        public Map<String, Map<String, String>> getLibs() {
-            Map<String, Map<String, String>> libs = getMap(BldConfig.M_LIBS);
-            return (libs != null) ? libs : Collections.<String, Map<String, String>> emptyMap();
+
+        public Map<String, Map<String, String>> getLibs()
+        {
+            Map<String, Map<String, String>> libs = getMap( BldConfig.M_LIBS );
+            return ( libs != null ) ? libs : Collections.<String, Map<String, String>> emptyMap();
         }
 
-        public List<String> getContents() {
-            return getList(BldConfig.L_CONTENTS);
+
+        public List<String> getContents()
+        {
+            return getList( BldConfig.L_CONTENTS );
         }
 
-        public List<String> getDownloadContents() {
-            return getList(BldConfig.L_DL_CONTENTS);
+
+        public List<String> getDownloadContents()
+        {
+            return getList( BldConfig.L_DL_CONTENTS );
         }
 
-        public List<String> getComposites() {
+
+        public List<String> getComposites()
+        {
             ArrayList<String> list = new ArrayList<String>();
-            for (String composite : getList(BldConfig.L_COMPOSITES)) {
-                list.add(composite);
+            for ( String composite : getList( BldConfig.L_COMPOSITES ) )
+            {
+                list.add( composite );
             }
 
             return list;
         }
 
-        public Map<String, String> getResources() {
+
+        public Map<String, String> getResources()
+        {
             HashMap<String, String> map = new HashMap<String, String>();
-            List<String> resources = getList(BldConfig.L_RESOURCES);
+            List<String> resources = getList( BldConfig.L_RESOURCES );
 
-            if (resources != null) {
-                for (String resource : resources) {
-                    String[] paths = resource.split("=", 2);
-                    String fsPath = (paths.length > 1 ? paths[1] : "");
-                    map.put(paths[0], fsPath);
+            if ( resources != null )
+            {
+                for ( String resource : resources )
+                {
+                    String[] paths = resource.split( "=", 2 );
+                    String fsPath = ( paths.length > 1 ? paths[1] : "" );
+                    map.put( paths[0], fsPath );
                 }
             }
             return map;
         }
 
-        public Properties getHeaders() {
-            Properties headers = config.getProps(id, BldConfig.P_HEADER);
+
+        public Properties getHeaders()
+        {
+            Properties headers = config.getProps( id, BldConfig.P_HEADER );
             return headers;
         }
 
     }
 
-    public long getLastModified() {
+
+    public long getLastModified()
+    {
         return lastModified;
     }
 

Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/BldUtil.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/BldUtil.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/BldUtil.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/BldUtil.java Tue Jul 21 18:51:33 2009
@@ -19,14 +19,17 @@
 
 package org.apache.felix.sigil.config;
 
+
 import java.util.Map;
 import java.util.Properties;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+
 // taken from Newton Launcher
 
-public class BldUtil {
+public class BldUtil
+{
     /**
      * expands property references embedded in strings. Each occurrence of ${name} is replaced with the value of
      * p.getProperty("name"); If the property is not set, then the original reference, is returned as follows "?<name>".
@@ -54,72 +57,86 @@
      *      with word as the message.
      * </pre>
      */
-    public static String expand(String s, Properties p) {
+    public static String expand( String s, Properties p )
+    {
         // regex to match property references e.g. ${name}
         // TODO this is very simplistic, so strings to be expanded should not
         // contain $ or }, except where substitution is expected.
-	// Update: propRef regex now allows substitutions to contain $,
-	// e.g. where a Windows ${user.name} is $Admin or similar.
-        final Pattern propRef = Pattern.compile("\\$\\{(((\\$[^\\{\\}])|[^\\$\\}])+\\$?)\\}");
-        final Pattern backslash = Pattern.compile("\\\\");
-        final Pattern dollar = Pattern.compile("\\$");
+        // Update: propRef regex now allows substitutions to contain $,
+        // e.g. where a Windows ${user.name} is $Admin or similar.
+        final Pattern propRef = Pattern.compile( "\\$\\{(((\\$[^\\{\\}])|[^\\$\\}])+\\$?)\\}" );
+        final Pattern backslash = Pattern.compile( "\\\\" );
+        final Pattern dollar = Pattern.compile( "\\$" );
 
-        if (s == null) {
+        if ( s == null )
+        {
             return null;
         }
 
-        if (s.indexOf("${") == -1) { // shortcut if no expansions
+        if ( s.indexOf( "${" ) == -1 )
+        { // shortcut if no expansions
             return s;
         }
 
-        for (int i = 0; i < 20; i++) { // avoids self-referencing expansions
+        for ( int i = 0; i < 20; i++ )
+        { // avoids self-referencing expansions
             // System.out.println("XXX expand[" + i + "] = [" + s + "]");
-            Matcher matcher = propRef.matcher(s);
+            Matcher matcher = propRef.matcher( s );
 
-            if (!matcher.find()) {
+            if ( !matcher.find() )
+            {
                 // replace unmatched items
-                s = s.replaceAll("\\Q??[\\E", "\\${");
-                s = s.replaceAll("\\Q??]\\E", "}");
+                s = s.replaceAll( "\\Q??[\\E", "\\${" );
+                s = s.replaceAll( "\\Q??]\\E", "}" );
                 // debug("expanded: " + s);
-                if (s.indexOf("${") != -1) {
-                    throw new RuntimeException("Can't expand: " + s);
+                if ( s.indexOf( "${" ) != -1 )
+                {
+                    throw new RuntimeException( "Can't expand: " + s );
                 }
                 return s;
             }
 
-            String key = matcher.group(1);
-            String[] keydef = key.split(":[=+-?@]", 2);
+            String key = matcher.group( 1 );
+            String[] keydef = key.split( ":[=+-?@]", 2 );
             String replace;
 
-            if (keydef.length != 2) {
-                replace = key.length() == 0 ? null : p.getProperty(key);
+            if ( keydef.length != 2 )
+            {
+                replace = key.length() == 0 ? null : p.getProperty( key );
             }
-            else {
-                replace = keydef[0].length() == 0 ? null : p.getProperty(keydef[0]);
+            else
+            {
+                replace = keydef[0].length() == 0 ? null : p.getProperty( keydef[0] );
 
-                if (replace != null && (replace.length() == 0 || replace.indexOf("${") != -1)) {
+                if ( replace != null && ( replace.length() == 0 || replace.indexOf( "${" ) != -1 ) )
+                {
                     // don't want unexpanded replacement, as it may stop ${...:-default}
                     replace = null;
                 }
 
-                if (key.indexOf(":+") != -1) {
-                    replace = ((replace == null) ? "" : keydef[1]);
+                if ( key.indexOf( ":+" ) != -1 )
+                {
+                    replace = ( ( replace == null ) ? "" : keydef[1] );
                 }
-                else if (replace == null) {
+                else if ( replace == null )
+                {
                     replace = keydef[1];
 
-                    if (key.indexOf(":?") != -1) {
+                    if ( key.indexOf( ":?" ) != -1 )
+                    {
                         String msg = "${" + keydef[0] + ":?" + keydef[1] + "} property not set";
-                        throw new RuntimeException(msg);
+                        throw new RuntimeException( msg );
                     }
 
-                    if (key.indexOf(":=") != -1) {
-                        p.setProperty(keydef[0], keydef[1]);
+                    if ( key.indexOf( ":=" ) != -1 )
+                    {
+                        p.setProperty( keydef[0], keydef[1] );
                     }
                 }
             }
 
-            if (replace == null) {
+            if ( replace == null )
+            {
                 // TODO: this is a hack to avoid looping on unmatched references
                 // should really leave unchanged and process rest of string.
                 // We use "]" as delimiter to avoid non-matched "}"
@@ -138,23 +155,27 @@
             // to
             // escape literal characters in the replacement string.
             // escape any \ or $ in replacement string
-            replace = backslash.matcher(replace).replaceAll("\\\\\\\\");
-            replace = dollar.matcher(replace).replaceAll("\\\\\\$");
+            replace = backslash.matcher( replace ).replaceAll( "\\\\\\\\" );
+            replace = dollar.matcher( replace ).replaceAll( "\\\\\\$" );
 
-            s = s.replaceAll("\\Q${" + key + "}\\E", replace);
+            s = s.replaceAll( "\\Q${" + key + "}\\E", replace );
         }
 
-        throw new RuntimeException("expand: loop expanding: " + s);
+        throw new RuntimeException( "expand: loop expanding: " + s );
     }
 
-    public static String expand(String s) {
+
+    public static String expand( String s )
+    {
         final Map<String, String> env = System.getenv();
 
-        return expand(s, new Properties() {
-            public String getProperty(String name) {
-                return System.getProperty(name, env.get(name));
+        return expand( s, new Properties()
+        {
+            public String getProperty( String name )
+            {
+                return System.getProperty( name, env.get( name ) );
             }
-        });
+        } );
     }
 
 }

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=796467&r1=796466&r2=796467&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 Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.config;
 
+
 import java.io.File;
 import java.io.IOException;
 import java.io.OutputStream;
@@ -32,176 +33,211 @@
 import org.apache.felix.sigil.model.osgi.IPackageImport;
 import org.apache.felix.sigil.model.osgi.IRequiredBundle;
 
-public interface IBldProject {
-	
-	static final String PROJECT_FILE = "sigil.properties";
-	static final String PROJECT_DEFAULTS = "../sigil-defaults.properties";
-	
-	void save() throws IOException;
-	
-	void saveAs(File path) throws IOException;
-	
-	void saveTo(OutputStream out) throws IOException;
-	
-	/**
-	 * gets default package version ranges.
-	 */
-	Properties getDefaultPackageVersions();
-	
-	/**
-	 * gets default package version range for named package.
-	 * Also handles wildcards in defaults.
-	 */
-	String getDefaultPackageVersion(String name);
-	
-	/**
-	 * get project options.
-	 */
-	Properties getOptions();
-	
-	/**
-	 * get project version.
-	 */
-	String getVersion();
-	
-	/**
-	 * gets dependencies (Package-Import and Require-Bundle) needed to compile.
-	 */
-	IBundleModelElement getDependencies();
-	
-	/**
-	 * gets project source directories.
-	 * This is a convenient way to specify bundle contents
-	 * when the project doesn't contains multiple bundles.
-	 */
-	List<String> getSourceDirs();
-	
-	/**
-	 * gets the list of packages represented by getSourceDirs().
-	 * @throws IOException 
-	 */
-	List<String> getSourcePkgs();
-	
-	/**
-	 * gets bundle ids.
-	 */
-	List<String> getBundleIds();
-	
-	/**
-	 * gets bundles.
-	 */
-	List<IBldBundle> getBundles();
-	
-	/**
-	 * convert specified bundle to SigilBundle.
-	 */
-	ISigilBundle getSigilBundle(String id);
-	
-	/**
-	 * convert SigilBundle to specified bundle.
-	 */
-	void setSigilBundle(String id, ISigilBundle sb);
-	
-	/**
-	 * converts default bundle to SigilBundle.
-	 */
-	ISigilBundle getDefaultBundle();
-	
-	/**
-	 * converts SigilBundle to default bundle.
-	 */
-	void setDefaultBundle(ISigilBundle sb);
-	
-	/**
-	 * resolves a relative path against the project file location.
-	 */
-	File resolve(String path);
-	
-	/**
-	 * gets the last modification date of the project file.
-	 */
-	long getLastModified();
-	
-	interface IBldBundle {
-		/**
-		 * gets bundle activator
-		 */
-		String getActivator();
-		
-		/**
-		 * gets bundle id within project.
-		 */
-		String getId();
-		
-		/**
-		 * gets bundle version.
-		 */
-		String getVersion();
-		
-		/**
-		 * gets the Bundle-SymbolicName.
-		 */
-		String getSymbolicName();
-
-		/**
-		 * gets bundles export-packages.
-		 */
-		List<IPackageExport> getExports();
-		
-		/**
-		 * gets project import-packages. 
-		 */
-		List<IPackageImport> getImports();
-		
-		/**
-		 * gets project require-bundles. 
-		 */
-		List<IRequiredBundle> getRequires();
-		
-		/**
-		 * get bundle fragment-host. 
-		 */
-		IRequiredBundle getFragmentHost();
-		
-		/**
-		 * gets bundle libs. 
-		 */
-		Map<String, Map<String, String>> getLibs();
-	
-		/**
-		 * gets the bundle contents
-		 * @return list of package patterns.
-		 */
-		List<String> getContents();
-		
-		/**
-		 * gets the bundle's associated dljar contents.
-		 * This is a convenience which avoids having to define another bundle
-		 * just for the dljar, which is then added to the parent bundle.
-		 * @return list of package patterns.
-		 */
-		List<String> getDownloadContents();
-	
-		/**
-		 * gets SCA composites.
-		 */
-		List<String> getComposites();
-		
-		/**
-		 * gets the additional resources.
-		 * @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();
-		
-		/**
-		 * gets additional bundle headers.
-		 */
-		Properties getHeaders();
-		
-		/**
-		 * resolves a relative path against the project file location.
-		 */
-		File resolve(String path);
-	}
+
+public interface IBldProject
+{
+
+    static final String PROJECT_FILE = "sigil.properties";
+    static final String PROJECT_DEFAULTS = "../sigil-defaults.properties";
+
+
+    void save() throws IOException;
+
+
+    void saveAs( File path ) throws IOException;
+
+
+    void saveTo( OutputStream out ) throws IOException;
+
+
+    /**
+     * gets default package version ranges.
+     */
+    Properties getDefaultPackageVersions();
+
+
+    /**
+     * gets default package version range for named package.
+     * Also handles wildcards in defaults.
+     */
+    String getDefaultPackageVersion( String name );
+
+
+    /**
+     * get project options.
+     */
+    Properties getOptions();
+
+
+    /**
+     * get project version.
+     */
+    String getVersion();
+
+
+    /**
+     * gets dependencies (Package-Import and Require-Bundle) needed to compile.
+     */
+    IBundleModelElement getDependencies();
+
+
+    /**
+     * gets project source directories.
+     * This is a convenient way to specify bundle contents
+     * when the project doesn't contains multiple bundles.
+     */
+    List<String> getSourceDirs();
+
+
+    /**
+     * gets the list of packages represented by getSourceDirs().
+     * @throws IOException 
+     */
+    List<String> getSourcePkgs();
+
+
+    /**
+     * gets bundle ids.
+     */
+    List<String> getBundleIds();
+
+
+    /**
+     * gets bundles.
+     */
+    List<IBldBundle> getBundles();
+
+
+    /**
+     * convert specified bundle to SigilBundle.
+     */
+    ISigilBundle getSigilBundle( String id );
+
+
+    /**
+     * convert SigilBundle to specified bundle.
+     */
+    void setSigilBundle( String id, ISigilBundle sb );
+
+
+    /**
+     * converts default bundle to SigilBundle.
+     */
+    ISigilBundle getDefaultBundle();
+
+
+    /**
+     * converts SigilBundle to default bundle.
+     */
+    void setDefaultBundle( ISigilBundle sb );
+
+
+    /**
+     * resolves a relative path against the project file location.
+     */
+    File resolve( String path );
+
+
+    /**
+     * gets the last modification date of the project file.
+     */
+    long getLastModified();
+
+    interface IBldBundle
+    {
+        /**
+         * gets bundle activator
+         */
+        String getActivator();
+
+
+        /**
+         * gets bundle id within project.
+         */
+        String getId();
+
+
+        /**
+         * gets bundle version.
+         */
+        String getVersion();
+
+
+        /**
+         * gets the Bundle-SymbolicName.
+         */
+        String getSymbolicName();
+
+
+        /**
+         * gets bundles export-packages.
+         */
+        List<IPackageExport> getExports();
+
+
+        /**
+         * gets project import-packages. 
+         */
+        List<IPackageImport> getImports();
+
+
+        /**
+         * gets project require-bundles. 
+         */
+        List<IRequiredBundle> getRequires();
+
+
+        /**
+         * get bundle fragment-host. 
+         */
+        IRequiredBundle getFragmentHost();
+
+
+        /**
+         * gets bundle libs. 
+         */
+        Map<String, Map<String, String>> getLibs();
+
+
+        /**
+         * gets the bundle contents
+         * @return list of package patterns.
+         */
+        List<String> getContents();
+
+
+        /**
+         * gets the bundle's associated dljar contents.
+         * This is a convenience which avoids having to define another bundle
+         * just for the dljar, which is then added to the parent bundle.
+         * @return list of package patterns.
+         */
+        List<String> getDownloadContents();
+
+
+        /**
+         * gets SCA composites.
+         */
+        List<String> getComposites();
+
+
+        /**
+         * gets the additional resources.
+         * @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();
+
+
+        /**
+         * gets additional bundle headers.
+         */
+        Properties getHeaders();
+
+
+        /**
+         * resolves a relative path against the project file location.
+         */
+        File resolve( String path );
+    }
 }

Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/IRepositoryConfig.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/IRepositoryConfig.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/IRepositoryConfig.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/IRepositoryConfig.java Tue Jul 21 18:51:33 2009
@@ -19,18 +19,22 @@
 
 package org.apache.felix.sigil.config;
 
+
 import java.util.Map;
 import java.util.Properties;
 
-public interface IRepositoryConfig {
-	static final String REPOSITORY_PROVIDER = "provider";
-	static final String REPOSITORY_LEVEL = "level";
-
-	/**
-	 * get properties with which to instantiate repositories.
-	 * The key REPOSITORY_PROVIDER will be set to the fully qualified class name of the IRepositoryProvider.
-	 * The key REPOSITORY_LEVEL indicates repository search order.
-	 * @return
-	 */
-	Map<String,Properties> getRepositoryConfig();
+
+public interface IRepositoryConfig
+{
+    static final String REPOSITORY_PROVIDER = "provider";
+    static final String REPOSITORY_LEVEL = "level";
+
+
+    /**
+     * get properties with which to instantiate repositories.
+     * The key REPOSITORY_PROVIDER will be set to the fully qualified class name of the IRepositoryProvider.
+     * The key REPOSITORY_LEVEL indicates repository search order.
+     * @return
+     */
+    Map<String, Properties> getRepositoryConfig();
 }

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=796467&r1=796466&r2=796467&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 Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.core;
 
+
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -46,53 +47,64 @@
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
 
-public class BldCore implements BundleActivator {
-	private static LicenseManager licenceManager = new LicenseManager();
-	
-	private static final Logger log = Logger.getLogger(BldCore.class.getName());
-
-	public static void error(String string, Throwable e) {
-		// TODO 
-		log.log( Level.WARNING, string, e );
-	}
-
-	public static void error(String string) {
-		log.log( Level.WARNING, string );
-	}
-
-	public static ILicenseManager getLicenseManager() {
-		return licenceManager;
-	}
-
-	public void start(BundleContext context) throws Exception {
-		init();
-	}
-	
-	public static void init() throws Exception {
-		String uri = "http://sigil.codecauldron.org/xml/sigil-namespace";
-		ModelElementFactory.getInstance().register(ISigilBundle.class,
-				SigilBundle.class, "bundle", "sigil", uri);
-		ModelElementFactory.getInstance().register(IDownloadJar.class,
-				DownloadJar.class, "download", "sigil", uri);
-		ModelElementFactory.getInstance().register(ILibrary.class,
-				Library.class, "library", "sigil", uri);
-		ModelElementFactory.getInstance().register(ILibraryImport.class,
-				LibraryImport.class, "library-import", "sigil", uri);
-		
-		// osgi elements
-		ModelElementFactory.getInstance().register(IBundleModelElement.class,
-				BundleModelElement.class, "bundle", null, null);
-		ModelElementFactory.getInstance().register(IPackageExport.class,
-				PackageExport.class, "package.export", null, null);
-		ModelElementFactory.getInstance().register(IPackageImport.class,
-				PackageImport.class, "package.import", null, null);
-		ModelElementFactory.getInstance().register(IRequiredBundle.class,
-				RequiredBundle.class, "required.bundle", null, null);
-	}
-
-	public void stop(BundleContext context) throws Exception {
-		// TODO Auto-generated method stub
-		
-	}
+
+public class BldCore implements BundleActivator
+{
+    private static LicenseManager licenceManager = new LicenseManager();
+
+    private static final Logger log = Logger.getLogger( BldCore.class.getName() );
+
+
+    public static void error( String string, Throwable e )
+    {
+        // TODO 
+        log.log( Level.WARNING, string, e );
+    }
+
+
+    public static void error( String string )
+    {
+        log.log( Level.WARNING, string );
+    }
+
+
+    public static ILicenseManager getLicenseManager()
+    {
+        return licenceManager;
+    }
+
+
+    public void start( BundleContext context ) throws Exception
+    {
+        init();
+    }
+
+
+    public static void init() throws Exception
+    {
+        String uri = "http://sigil.codecauldron.org/xml/sigil-namespace";
+        ModelElementFactory.getInstance().register( ISigilBundle.class, SigilBundle.class, "bundle", "sigil", uri );
+        ModelElementFactory.getInstance().register( IDownloadJar.class, DownloadJar.class, "download", "sigil", uri );
+        ModelElementFactory.getInstance().register( ILibrary.class, Library.class, "library", "sigil", uri );
+        ModelElementFactory.getInstance().register( ILibraryImport.class, LibraryImport.class, "library-import",
+            "sigil", uri );
+
+        // osgi elements
+        ModelElementFactory.getInstance().register( IBundleModelElement.class, BundleModelElement.class, "bundle",
+            null, null );
+        ModelElementFactory.getInstance().register( IPackageExport.class, PackageExport.class, "package.export", null,
+            null );
+        ModelElementFactory.getInstance().register( IPackageImport.class, PackageImport.class, "package.import", null,
+            null );
+        ModelElementFactory.getInstance().register( IRequiredBundle.class, RequiredBundle.class, "required.bundle",
+            null, null );
+    }
+
+
+    public void stop( BundleContext context ) throws Exception
+    {
+        // TODO Auto-generated method stub
+
+    }
 
 }

Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/internal/license/LicenseManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/internal/license/LicenseManager.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/internal/license/LicenseManager.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/internal/license/LicenseManager.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.core.internal.license;
 
+
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Set;
@@ -27,43 +28,55 @@
 import org.apache.felix.sigil.core.licence.ILicenseManager;
 import org.apache.felix.sigil.core.licence.ILicensePolicy;
 
-public class LicenseManager implements ILicenseManager {
 
-	private HashMap<String, Pattern> licenses = new HashMap<String, Pattern>();
-	private HashMap<String, LicensePolicy> policies = new HashMap<String, LicensePolicy>();
-	private LicensePolicy defaultPolicy = new LicensePolicy(this);
-	
-	public void addLicense(String name, Pattern pattern) {
-		licenses.put( name, pattern );
-	}
-
-	public void removeLicense(String name) {
-		licenses.remove(name);
-	}
-
-	public Set<String> getLicenseNames() {
-		return Collections.unmodifiableSet(licenses.keySet());
-	}
-
-	public Pattern getLicensePattern(String name) {
-		return licenses.get( name );
-	}
-
-	public ILicensePolicy getDefaultPolicy() {
-		return defaultPolicy;
-	}
-
-	//public ILicensePolicy getPolicy(ISigilProjectModel project) {
-	//	synchronized( policies ) {
-	//		LicensePolicy p = policies.get(project.getName());
-	//		
-	//		if ( p == null ) {
-	//			p = new LicensePolicy(this, project);
-	//			policies.put( project.getName(), p );
-	//		}
-	//		
-	//		return p;
-	//	}
-	//}
+public class LicenseManager implements ILicenseManager
+{
+
+    private HashMap<String, Pattern> licenses = new HashMap<String, Pattern>();
+    private HashMap<String, LicensePolicy> policies = new HashMap<String, LicensePolicy>();
+    private LicensePolicy defaultPolicy = new LicensePolicy( this );
+
+
+    public void addLicense( String name, Pattern pattern )
+    {
+        licenses.put( name, pattern );
+    }
+
+
+    public void removeLicense( String name )
+    {
+        licenses.remove( name );
+    }
+
+
+    public Set<String> getLicenseNames()
+    {
+        return Collections.unmodifiableSet( licenses.keySet() );
+    }
+
+
+    public Pattern getLicensePattern( String name )
+    {
+        return licenses.get( name );
+    }
+
+
+    public ILicensePolicy getDefaultPolicy()
+    {
+        return defaultPolicy;
+    }
+
+    //public ILicensePolicy getPolicy(ISigilProjectModel project) {
+    //	synchronized( policies ) {
+    //		LicensePolicy p = policies.get(project.getName());
+    //		
+    //		if ( p == null ) {
+    //			p = new LicensePolicy(this, project);
+    //			policies.put( project.getName(), p );
+    //		}
+    //		
+    //		return p;
+    //	}
+    //}
 
 }

Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/internal/license/LicensePolicy.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/internal/license/LicensePolicy.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/internal/license/LicensePolicy.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/internal/license/LicensePolicy.java Tue Jul 21 18:51:33 2009
@@ -19,35 +19,48 @@
 
 package org.apache.felix.sigil.core.internal.license;
 
+
 import org.apache.felix.sigil.core.licence.ILicensePolicy;
 import org.apache.felix.sigil.model.eclipse.ISigilBundle;
 import org.eclipse.core.runtime.IProgressMonitor;
 
-public class LicensePolicy implements ILicensePolicy {
 
-	private LicenseManager licenseManager;
-	
-	public LicensePolicy(LicenseManager licenseManager) {
-		this.licenseManager = licenseManager;
-	}
-
-	public boolean accept(ISigilBundle bundle) {
-		return true;
-	}
-
-	public void addAllowed(String licenseName) {
-		// TODO Auto-generated method stub
-		
-	}
-
-	public void removeAllowed(String licenseName) {
-		// TODO Auto-generated method stub
-		
-	}
-
-	public void save(IProgressMonitor monitor) {
-		// TODO Auto-generated method stub
-		
-	}
+public class LicensePolicy implements ILicensePolicy
+{
+
+    private LicenseManager licenseManager;
+
+
+    public LicensePolicy( LicenseManager licenseManager )
+    {
+        this.licenseManager = licenseManager;
+    }
+
+
+    public boolean accept( ISigilBundle bundle )
+    {
+        return true;
+    }
+
+
+    public void addAllowed( String licenseName )
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+
+    public void removeAllowed( String licenseName )
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+
+    public void save( IProgressMonitor monitor )
+    {
+        // TODO Auto-generated method stub
+
+    }
 
 }

Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/eclipse/DownloadJar.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/eclipse/DownloadJar.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/eclipse/DownloadJar.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/eclipse/DownloadJar.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.core.internal.model.eclipse;
 
+
 import java.util.HashSet;
 import java.util.Set;
 
@@ -26,29 +27,41 @@
 import org.apache.felix.sigil.model.eclipse.IDownloadJar;
 import org.eclipse.core.runtime.IPath;
 
-public class DownloadJar extends AbstractCompoundModelElement implements IDownloadJar {
 
-	private static final long serialVersionUID = 1L;
+public class DownloadJar extends AbstractCompoundModelElement implements IDownloadJar
+{
+
+    private static final long serialVersionUID = 1L;
+
+    private Set<IPath> entries = new HashSet<IPath>();
+
+
+    public DownloadJar()
+    {
+        super( "RMI Classpath Download Jar" );
+    }
+
+
+    public void addEntry( IPath entry )
+    {
+        entries.add( entry );
+    }
+
+
+    public void removeEntry( IPath entry )
+    {
+        entries.remove( entry );
+    }
+
+
+    public Set<IPath> getEntrys()
+    {
+        return entries;
+    }
+
 
-	private Set<IPath> entries = new HashSet<IPath>();
-	
-	public DownloadJar() {
-		super("RMI Classpath Download Jar");
-	}
-	
-	public void addEntry(IPath entry) {
-		entries.add( entry );
-	}
-	
-	public void removeEntry(IPath entry) {
-		entries.remove( entry );
-	}
-	
-	public Set<IPath> getEntrys() {
-		return entries;
-	}
-
-	public void clearEntries() {
-		entries.clear();
-	}
+    public void clearEntries()
+    {
+        entries.clear();
+    }
 }

Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/eclipse/Library.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/eclipse/Library.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/eclipse/Library.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/eclipse/Library.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.core.internal.model.eclipse;
 
+
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.Set;
@@ -29,58 +30,82 @@
 import org.apache.felix.sigil.model.osgi.IRequiredBundle;
 import org.osgi.framework.Version;
 
-public class Library extends AbstractCompoundModelElement implements ILibrary {
 
-	private static final long serialVersionUID = 1L;
-	
-	private String name;
-	private Version version;
-	private Set<IRequiredBundle> bundles;
-	private Set<IPackageImport> imports;
-	
-	public Library() {
-		super("Library");
-		bundles = new HashSet<IRequiredBundle>();
-		imports = new HashSet<IPackageImport>();
-	}
-	
-	public void addBundle(IRequiredBundle bundle) {
-		bundles.add(bundle);
-	}
-
-	public void addImport(IPackageImport pi) {
-		imports.add(pi);
-	}
-
-	public Collection<IRequiredBundle> getBundles() {
-		return bundles;
-	}
-
-	public Collection<IPackageImport> getImports() {
-		return imports;
-	}
-
-	public String getName() {
-		return name;
-	}
-
-	public Version getVersion() {
-		return version;
-	}
-
-	public void removeBundle(IRequiredBundle bundle) {
-		bundles.remove(bundle);
-	}
-
-	public void removeImport(IPackageImport pi) {
-		imports.remove(pi);
-	}
-
-	public void setName(String name) {
-		this.name = name;
-	}
-
-	public void setVersion(Version version) {
-		this.version = version;
-	}
+public class Library extends AbstractCompoundModelElement implements ILibrary
+{
+
+    private static final long serialVersionUID = 1L;
+
+    private String name;
+    private Version version;
+    private Set<IRequiredBundle> bundles;
+    private Set<IPackageImport> imports;
+
+
+    public Library()
+    {
+        super( "Library" );
+        bundles = new HashSet<IRequiredBundle>();
+        imports = new HashSet<IPackageImport>();
+    }
+
+
+    public void addBundle( IRequiredBundle bundle )
+    {
+        bundles.add( bundle );
+    }
+
+
+    public void addImport( IPackageImport pi )
+    {
+        imports.add( pi );
+    }
+
+
+    public Collection<IRequiredBundle> getBundles()
+    {
+        return bundles;
+    }
+
+
+    public Collection<IPackageImport> getImports()
+    {
+        return imports;
+    }
+
+
+    public String getName()
+    {
+        return name;
+    }
+
+
+    public Version getVersion()
+    {
+        return version;
+    }
+
+
+    public void removeBundle( IRequiredBundle bundle )
+    {
+        bundles.remove( bundle );
+    }
+
+
+    public void removeImport( IPackageImport pi )
+    {
+        imports.remove( pi );
+    }
+
+
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+
+    public void setVersion( Version version )
+    {
+        this.version = version;
+    }
 }

Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/eclipse/LibraryImport.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/eclipse/LibraryImport.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/eclipse/LibraryImport.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/eclipse/LibraryImport.java Tue Jul 21 18:51:33 2009
@@ -19,35 +19,48 @@
 
 package org.apache.felix.sigil.core.internal.model.eclipse;
 
+
 import org.apache.felix.sigil.model.AbstractModelElement;
 import org.apache.felix.sigil.model.common.VersionRange;
 import org.apache.felix.sigil.model.eclipse.ILibraryImport;
 
-public class LibraryImport extends AbstractModelElement implements ILibraryImport {
 
-	private static final long serialVersionUID = 1L;
+public class LibraryImport extends AbstractModelElement implements ILibraryImport
+{
+
+    private static final long serialVersionUID = 1L;
+
+
+    public LibraryImport()
+    {
+        super( "Library Import" );
+    }
+
+    private String libraryName;
+    private VersionRange range = VersionRange.ANY_VERSION;
+
+
+    public String getLibraryName()
+    {
+        return libraryName;
+    }
+
+
+    public VersionRange getVersions()
+    {
+        return range;
+    }
+
+
+    public void setLibraryName( String name )
+    {
+        this.libraryName = name;
+    }
+
 
-	public LibraryImport() {
-		super("Library Import");
-	}
-
-	private String libraryName;
-	private VersionRange range = VersionRange.ANY_VERSION;
-	
-	public String getLibraryName() {
-		return libraryName;
-	}
-
-	public VersionRange getVersions() {
-		return range;
-	}
-
-	public void setLibraryName(String name) {
-		this.libraryName = name;
-	}
-
-	public void setVersions(VersionRange range) {
-		this.range = range;
-	}
+    public void setVersions( VersionRange range )
+    {
+        this.range = range;
+    }
 
 }



Mime
View raw message