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/08/03 18:07:16 UTC

svn commit: r800445 - in /felix/trunk/sigil/common/core/src/org/apache/felix/sigil: bnd/BundleBuilder.java config/BldAttr.java config/BldConfig.java config/BldConverter.java config/BldProject.java config/IBldProject.java model/eclipse/ISigilBundle.java

Author: dsavage
Date: Mon Aug  3 16:07:15 2009
New Revision: 800445

URL: http://svn.apache.org/viewvc?rev=800445&view=rev
Log:
delete osgi extensions - dl jars, publish files and composites

Modified:
    felix/trunk/sigil/common/core/src/org/apache/felix/sigil/bnd/BundleBuilder.java
    felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/BldAttr.java
    felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/BldConfig.java
    felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/BldConverter.java
    felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/BldProject.java
    felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/IBldProject.java
    felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/ISigilBundle.java

Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/bnd/BundleBuilder.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/bnd/BundleBuilder.java?rev=800445&r1=800444&r2=800445&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/bnd/BundleBuilder.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/bnd/BundleBuilder.java Mon Aug  3 16:07:15 2009
@@ -20,14 +20,10 @@
 package org.apache.felix.sigil.bnd;
 
 
-import static java.lang.String.format;
-
 import java.io.File;
 import java.io.FileOutputStream;
-import java.io.FileWriter;
 import java.io.IOException;
 import java.io.OutputStream;
-import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -67,8 +63,6 @@
 
     private boolean addMissingImports;
     private boolean omitUnusedImports;
-    private String defaultPubtype;
-    private String codebaseFormat;
     private Set<String> systemPkgs;
 
     public interface Log
@@ -104,10 +98,6 @@
         omitUnusedImports = options.containsKey( BldAttr.OPTION_OMIT_IMPORTS )
             && Boolean.parseBoolean( options.getProperty( BldAttr.OPTION_OMIT_IMPORTS ) );
 
-        defaultPubtype = options.getProperty( BldAttr.PUBTYPE_ATTRIBUTE, "rmi.codebase" );
-
-        codebaseFormat = options.getProperty( "codebaseFormat", "cds://%1$s?bundle.symbolic.name=%2$s&type=%3$s" );
-
         for ( IBldBundle b : project.getBundles() )
         {
             lastBundle = b.getId();
@@ -198,50 +188,6 @@
         errors.clear();
         warnings.clear();
 
-        if ( !bundle.getDownloadContents().isEmpty() )
-        {
-            // create dljar
-            Properties dlspec = new Properties();
-            StringBuilder sb = new StringBuilder();
-
-            for ( String pkg : bundle.getDownloadContents() )
-            {
-                if ( sb.length() > 0 )
-                    sb.append( "," );
-                sb.append( pkg );
-            }
-
-            dlspec.setProperty( Constants.PRIVATE_PACKAGE, sb.toString() );
-            dlspec.setProperty( Constants.BUNDLE_NAME, "Newton download jar" );
-            dlspec.setProperty( Constants.NOEXTRAHEADERS, "true" );
-            // stop it being a bundle, so cds doesn't scan it
-            dlspec.setProperty( Constants.REMOVE_HEADERS, Constants.BUNDLE_SYMBOLICNAME );
-
-            Builder builder = new Builder();
-            builder.setProperties( dlspec );
-            builder.setClasspath( classpath );
-
-            Jar dljar = builder.build();
-            convertErrors( "BND (dljar): ", builder.getErrors() );
-            convertWarnings( "BND (dljar): ", builder.getWarnings() );
-
-            String dldest = dest.replaceFirst( "\\.jar$", "-dl.jar" );
-            File dloutput = new File( dldest );
-            if ( !dloutput.exists() || dloutput.lastModified() <= dljar.lastModified() || force )
-            {
-                // jar.write(dldest) catches and ignores IOException
-                OutputStream out = new FileOutputStream( dldest );
-                dljar.write( out );
-                out.close();
-                dljar.close();
-                // XXX deleting dljar causes it to be rebuilt each time
-                // XXX but leaving it mean it may be installed where it's not
-                // wanted/needed.
-                dloutput.deleteOnExit();
-            }
-            builder.close();
-        }
-
         Properties spec = getBndSpec( bundle, dest );
 
         if ( log != null )
@@ -483,9 +429,8 @@
             }
         }
 
-        List<String> srcPkgs = addLibs( bundle, dest, spec );
+        addLibs( bundle, dest, spec );
 
-        contents.addAll( srcPkgs );
         addContents( contents, spec );
 
         IRequiredBundle fh = bundle.getFragmentHost();
@@ -534,38 +479,17 @@
     }
 
 
-    private List<String> addLibs( IBldBundle bundle, String dest, Properties spec ) throws IOException
+    private void addLibs( IBldBundle bundle, String dest, Properties spec ) throws IOException
     {
         // final String cleanVersion =
         // Builder.cleanupVersion(bundle.getVersion());
-        final String name = bundle.getSymbolicName();
-
-        ArrayList<String> srcPkgs = new ArrayList<String>();
+        
         Map<String, Map<String, String>> libs = bundle.getLibs();
 
-        if ( !bundle.getDownloadContents().isEmpty() )
-        {
-            // implicitly add dljar
-            File fdest = new File( dest );
-            String dlname = fdest.getName().replaceFirst( "\\.jar$", "-dl.jar" );
-
-            HashMap<String, String> attr = new HashMap<String, String>();
-            attr.put( BldAttr.KIND_ATTRIBUTE, "codebase" );
-            attr.put( BldAttr.PUBLISH_ATTRIBUTE, dlname );
-
-            HashMap<String, Map<String, String>> lib2 = new HashMap<String, Map<String, String>>();
-            lib2.putAll( libs );
-            lib2.put( dlname, attr );
-            libs = lib2;
-        }
-
-        StringBuilder items = new StringBuilder();
-
         for ( String jarpath : libs.keySet() )
         {
             Map<String, String> attr = libs.get( jarpath );
             String kind = attr.get( BldAttr.KIND_ATTRIBUTE );
-            String publish = attr.get( BldAttr.PUBLISH_ATTRIBUTE );
 
             // first find the lib ..
             String path = attr.get( BldAttr.PATH_ATTRIBUTE );
@@ -605,45 +529,7 @@
                     spec.setProperty( Constants.BUNDLE_CLASSPATH, "." );
                 appendProperty( Constants.BUNDLE_CLASSPATH, jarpath, spec );
             }
-
-            if ( publish != null )
-            {
-                String pubtype = attr.get( BldAttr.PUBTYPE_ATTRIBUTE );
-                if ( pubtype == null )
-                    pubtype = defaultPubtype;
-
-                if ( "codebase".equals( kind ) )
-                {
-                    String codebase = format( codebaseFormat, publish, name, pubtype );
-                    String zone = attr.get( BldAttr.ZONE_ATTRIBUTE );
-                    if ( zone != null )
-                        codebase += "&zone=" + zone;
-                    appendProperty( "RMI-Codebase", codebase, spec );
-                }
-
-                // add item to publish xml
-                items.append( format( "<item name=\"%s\" path=\"%s\">\n", publish, jarpath ) );
-                items.append( format( "<attribute name=\"type\" value=\"%s\"/>\n", pubtype ) );
-                items.append( "</item>\n" );
-            }
-        }
-
-        if ( items.length() > 0 )
-        {
-            File publishFile = new File( dest.replaceFirst( "\\.jar$", "-publish.xml" ) );
-            publishFile.deleteOnExit();
-            PrintWriter writer = new PrintWriter( new FileWriter( publishFile ) );
-
-            writer.println( "<publish>" );
-            writer.println( format( "<attribute name=\"bundle.symbolic.name\" value=\"%s\"/>", name ) );
-            writer.print( items.toString() );
-            writer.println( "</publish>" );
-            writer.close();
-
-            appendProperty( Constants.INCLUDE_RESOURCE, "publish.xml=" + publishFile, spec );
         }
-
-        return srcPkgs;
     }
 
 

Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/BldAttr.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/BldAttr.java?rev=800445&r1=800444&r2=800445&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/BldAttr.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/BldAttr.java Mon Aug  3 16:07:15 2009
@@ -32,10 +32,7 @@
     public static final String RESOLVE_RUNTIME = "runtime";
     public static final String RESOLVE_IGNORE = "ignore";
 
-    public static final String PUBLISH_ATTRIBUTE = "publish";
-    public static final String PUBTYPE_ATTRIBUTE = "type";
     public static final String PATH_ATTRIBUTE = "path";
-    public static final Object ZONE_ATTRIBUTE = "zone";
 
     // Sigil options
 

Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/BldConfig.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/BldConfig.java?rev=800445&r1=800444&r2=800445&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/BldConfig.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/BldConfig.java Mon Aug  3 16:07:15 2009
@@ -51,13 +51,11 @@
         { S_ACTIVATOR, S_DEFAULTS, S_ID, S_SYM_NAME, S_VERSION, S_SINGLETON };
 
     // list properties
-    public static final String L_COMPOSITES = "-composites";
     public static final String L_CONTENTS = "-contents";
-    public static final String L_DL_CONTENTS = "-downloads";
     public static final String L_SRC_CONTENTS = "-sourcedirs";
     public static final String L_RESOURCES = "-resources";
     public static final String[] LIST_KEYS =
-        { L_COMPOSITES, L_CONTENTS, L_DL_CONTENTS, L_SRC_CONTENTS, L_RESOURCES };
+        { L_CONTENTS, L_SRC_CONTENTS, L_RESOURCES };
 
     // map properties
     public static final String M_EXPORTS = "-exports";

Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/BldConverter.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/BldConverter.java?rev=800445&r1=800444&r2=800445&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/BldConverter.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/config/BldConverter.java Mon Aug  3 16:07:15 2009
@@ -113,12 +113,6 @@
             sigilBundle.addPackage( pkg );
         }
 
-        // downloads
-        for ( String pkg : bundle.getDownloadContents() )
-        {
-            sigilBundle.addDownloadPackage( pkg );
-        }
-
         // sources
         for ( String source : config.getList( null, BldConfig.L_SRC_CONTENTS ) )
         {
@@ -132,15 +126,7 @@
         {
             Map<String, String> attr = libs.get( path );
             String kind = attr.get( BldAttr.KIND_ATTRIBUTE );
-            String publish = attr.get( BldAttr.PUBLISH_ATTRIBUTE );
-
-            if ( publish != null )
-            {
-                // FIXME: UI doesn't understand publish=name
-                BldCore.error( "Can't convert -libs publish=" + publish );
-                continue;
-            }
-
+            
             if ( "classpath".equals( kind ) )
             {
                 sigilBundle.addClasspathEntry( String.format( classpathFormat, "lib", path ) );

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=800445&r1=800444&r2=800445&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 Mon Aug  3 16:07:15 2009
@@ -1003,24 +1003,6 @@
         }
 
 
-        public List<String> getDownloadContents()
-        {
-            return getList( BldConfig.L_DL_CONTENTS );
-        }
-
-
-        public List<String> getComposites()
-        {
-            ArrayList<String> list = new ArrayList<String>();
-            for ( String composite : getList( BldConfig.L_COMPOSITES ) )
-            {
-                list.add( composite );
-            }
-
-            return list;
-        }
-
-
         public Map<String, String> getResources()
         {
             HashMap<String, String> map = new HashMap<String, String>();

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=800445&r1=800444&r2=800445&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 Mon Aug  3 16:07:15 2009
@@ -207,15 +207,6 @@
 
 
         /**
-         * 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 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.

Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/ISigilBundle.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/ISigilBundle.java?rev=800445&r1=800444&r2=800445&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/ISigilBundle.java (original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/ISigilBundle.java Mon Aug  3 16:07:15 2009
@@ -142,25 +142,6 @@
 
 
     /**
-     * get package names included in download jar.
-     * Can contain wildcards e.g. org.foo.*
-     */
-    Set<String> getDownloadPackages();
-
-
-    /**
-     * remove package name from those included in download jar.
-     */
-    boolean removeDownloadPackage( String pkg );
-
-
-    /**
-     * add package name to be included in download jar.
-     */
-    void addDownloadPackage( String pkg );
-
-
-    /**
      * Attempt to find a package export that matches the given name or return null if none specified
      * 
      * @param elementName