23
23
import java .util .Arrays ;
24
24
import java .util .Map .Entry ;
25
25
import java .util .Set ;
26
+ import java .util .function .Consumer ;
26
27
import java .util .jar .Attributes ;
27
28
import java .util .jar .Manifest ;
28
29
import java .util .stream .Stream ;
@@ -57,14 +58,14 @@ public static Stream<IInstallableUnit> generateInstallableUnits(TargetBundle[] b
57
58
return Stream .concat (generateInstallableUnits (bundles ), generateInstallableUnits (features ));
58
59
}
59
60
60
- public static Stream <IInstallableUnit > generateInstallableUnits (TargetBundle [] bundles ) {
61
+ private static Stream <IInstallableUnit > generateInstallableUnits (TargetBundle [] bundles ) {
61
62
if (bundles == null || bundles .length == 0 ) {
62
63
return Stream .empty ();
63
64
}
64
- return Arrays .stream (bundles ).flatMap (InstallableUnitGenerator ::generateInstallableUnits );
65
+ return Arrays .stream (bundles ).mapMulti (InstallableUnitGenerator ::generateInstallableUnits );
65
66
}
66
67
67
- public static Stream < IInstallableUnit > generateInstallableUnits (TargetBundle targetBundle ) {
68
+ private static void generateInstallableUnits (TargetBundle targetBundle , Consumer < IInstallableUnit > downStream ) {
68
69
BundleInfo bundleInfo = targetBundle .getBundleInfo ();
69
70
if (bundleInfo != null ) {
70
71
String manifest = bundleInfo .getManifest ();
@@ -87,24 +88,23 @@ public static Stream<IInstallableUnit> generateInstallableUnits(TargetBundle tar
87
88
BundlesAction .createBundleArtifactKey (bundleDescription .getSymbolicName (),
88
89
bundleDescription .getVersion ().toString ()),
89
90
publisherInfo );
90
- return Stream . of (iu );
91
+ downStream . accept (iu );
91
92
}
92
93
} catch (IOException e ) {
93
94
// can't use it then...
94
95
}
95
96
}
96
97
}
97
- return Stream .empty ();
98
98
}
99
99
100
- public static Stream <IInstallableUnit > generateInstallableUnits (TargetFeature [] features ) {
100
+ private static Stream <IInstallableUnit > generateInstallableUnits (TargetFeature [] features ) {
101
101
if (features == null || features .length == 0 ) {
102
102
return Stream .empty ();
103
103
}
104
104
return Arrays .stream (features ).flatMap (InstallableUnitGenerator ::generateInstallableUnits );
105
105
}
106
106
107
- public static Stream <IInstallableUnit > generateInstallableUnits (TargetFeature targetFeature ) {
107
+ private static Stream <IInstallableUnit > generateInstallableUnits (TargetFeature targetFeature ) {
108
108
String location = targetFeature .getLocation ();
109
109
if (location != null ) {
110
110
Feature feature = new FeatureParser ().parse (new File (location ));
0 commit comments