delete osgi extensions - dl jars, publish files and composites
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@800445 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/sigil/common/core/src/org/apache/felix/sigil/bnd/BundleBuilder.java b/sigil/common/core/src/org/apache/felix/sigil/bnd/BundleBuilder.java
index 806a74d..296d34d 100644
--- a/sigil/common/core/src/org/apache/felix/sigil/bnd/BundleBuilder.java
+++ b/sigil/common/core/src/org/apache/felix/sigil/bnd/BundleBuilder.java
@@ -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;
}
diff --git a/sigil/common/core/src/org/apache/felix/sigil/config/BldAttr.java b/sigil/common/core/src/org/apache/felix/sigil/config/BldAttr.java
index 1a6da37..7e4f52b 100644
--- a/sigil/common/core/src/org/apache/felix/sigil/config/BldAttr.java
+++ b/sigil/common/core/src/org/apache/felix/sigil/config/BldAttr.java
@@ -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
diff --git a/sigil/common/core/src/org/apache/felix/sigil/config/BldConfig.java b/sigil/common/core/src/org/apache/felix/sigil/config/BldConfig.java
index 08d4cca..a79a00f 100644
--- a/sigil/common/core/src/org/apache/felix/sigil/config/BldConfig.java
+++ b/sigil/common/core/src/org/apache/felix/sigil/config/BldConfig.java
@@ -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";
diff --git a/sigil/common/core/src/org/apache/felix/sigil/config/BldConverter.java b/sigil/common/core/src/org/apache/felix/sigil/config/BldConverter.java
index 88a30c0..7a26cb7 100644
--- a/sigil/common/core/src/org/apache/felix/sigil/config/BldConverter.java
+++ b/sigil/common/core/src/org/apache/felix/sigil/config/BldConverter.java
@@ -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 ) );
diff --git a/sigil/common/core/src/org/apache/felix/sigil/config/BldProject.java b/sigil/common/core/src/org/apache/felix/sigil/config/BldProject.java
index 4501d7a..05aaf5c 100644
--- a/sigil/common/core/src/org/apache/felix/sigil/config/BldProject.java
+++ b/sigil/common/core/src/org/apache/felix/sigil/config/BldProject.java
@@ -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>();
diff --git a/sigil/common/core/src/org/apache/felix/sigil/config/IBldProject.java b/sigil/common/core/src/org/apache/felix/sigil/config/IBldProject.java
index e6cd340..47b1e58 100644
--- a/sigil/common/core/src/org/apache/felix/sigil/config/IBldProject.java
+++ b/sigil/common/core/src/org/apache/felix/sigil/config/IBldProject.java
@@ -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.
diff --git a/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/ISigilBundle.java b/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/ISigilBundle.java
index d75c162..e0f61f3 100644
--- a/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/ISigilBundle.java
+++ b/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/ISigilBundle.java
@@ -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