You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by hi...@apache.org on 2013/12/28 17:54:24 UTC

svn commit: r1553872 [2/3] - in /ant/ivy/core/trunk: src/java/org/apache/ivy/ant/ src/java/org/apache/ivy/osgi/core/ src/java/org/apache/ivy/osgi/obr/filter/ src/java/org/apache/ivy/osgi/obr/xml/ src/java/org/apache/ivy/osgi/p2/ src/java/org/apache/ivy...

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/p2/P2MetadataParser.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/p2/P2MetadataParser.java?rev=1553872&r1=1553871&r2=1553872&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/p2/P2MetadataParser.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/p2/P2MetadataParser.java Sat Dec 28 16:54:23 2013
@@ -23,10 +23,7 @@ import java.net.URI;
 import java.net.URISyntaxException;
 import java.text.ParseException;
 import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
 
 import javax.xml.parsers.ParserConfigurationException;
 
@@ -36,7 +33,7 @@ import org.apache.ivy.osgi.core.BundleRe
 import org.apache.ivy.osgi.core.ExportPackage;
 import org.apache.ivy.osgi.core.ManifestParser;
 import org.apache.ivy.osgi.p2.PropertiesParser.PropertiesHandler;
-import org.apache.ivy.osgi.util.DelegetingHandler;
+import org.apache.ivy.osgi.util.DelegatingHandler;
 import org.apache.ivy.osgi.util.Version;
 import org.apache.ivy.osgi.util.VersionRange;
 import org.apache.ivy.util.Message;
@@ -68,89 +65,88 @@ public class P2MetadataParser implements
         }
     }
 
-    class RepositoryHandler extends DelegetingHandler {
+    private class RepositoryHandler extends DelegatingHandler {
 
         private static final String P2_TIMESTAMP = "p2.timestamp";
 
         private static final String REPOSITORY = "repository";
 
-        // private static final String NAME = "name";
+        //        private static final String NAME = "name";
         //
-        // private static final String TYPE = "type";
+        //        private static final String TYPE = "type";
         //
-        // private static final String VERSION = "version";
+        //        private static final String VERSION = "version";
         //
-        // private static final String DESCRIPTION = "description";
+        //        private static final String DESCRIPTION = "description";
         //
-        // private static final String PROVIDER = "provider";
+        //        private static final String PROVIDER = "provider";
 
         public RepositoryHandler(final P2Descriptor p2Descriptor) {
             super(REPOSITORY);
-            addChild(new PropertiesHandler(Arrays.asList(new String[] {P2_TIMESTAMP})),
-                new ChildElementHandler() {
-                    public void childHanlded(DelegetingHandler child) {
-                        Map properties = ((PropertiesHandler) child).properties;
-                        String timestamp = (String) properties.get(P2_TIMESTAMP);
+            addChild(new PropertiesHandler(P2_TIMESTAMP),
+                new ChildElementHandler<PropertiesHandler>() {
+                    public void childHanlded(PropertiesHandler child) {
+                        String timestamp = child.properties.get(P2_TIMESTAMP);
                         if (timestamp != null) {
                             p2Descriptor.setTimestamp(Long.parseLong(timestamp));
                         }
                     }
                 });
-            addChild(new UnitsHandler(), new ChildElementHandler() {
-                public void childHanlded(DelegetingHandler child) {
-                    Iterator it = ((UnitsHandler) child).bundles.iterator();
-                    while (it.hasNext()) {
-                        p2Descriptor.addBundle((BundleInfo) it.next());
+            addChild(new UnitsHandler(), new ChildElementHandler<UnitsHandler>() {
+                public void childHanlded(UnitsHandler child) {
+                    for (BundleInfo bundle : child.bundles) {
+                        p2Descriptor.addBundle(bundle);
                     }
                 }
             });
-            addChild(new ReferencesHandler(), new ChildElementHandler() {
-                public void childHanlded(DelegetingHandler child) {
+            addChild(new ReferencesHandler(), new ChildElementHandler<ReferencesHandler>() {
+                public void childHanlded(ReferencesHandler child) {
                 }
             });
         }
 
-        // protected void handleAttributes(Attributes atts) {
-        // String name = atts.getValue(NAME);
-        // String type = atts.getValue(TYPE);
-        // String version = atts.getValue(VERSION);
-        // String description = atts.getValue(DESCRIPTION);
-        // String provider = atts.getValue(PROVIDER);
-        // }
+        //        protected void handleAttributes(Attributes atts) {
+        //            String name = atts.getValue(NAME);
+        //            String type = atts.getValue(TYPE);
+        //            String version = atts.getValue(VERSION);
+        //            String description = atts.getValue(DESCRIPTION);
+        //            String provider = atts.getValue(PROVIDER);
+        //        }
     }
 
-    class ReferencesHandler extends DelegetingHandler {
+    private class ReferencesHandler extends DelegatingHandler {
 
         private static final String REFERENCES = "references";
 
         private static final String SIZE = "size";
 
-        List/* <URI> */repositoryUris;
+        List<URI> repositoryUris;
 
         public ReferencesHandler() {
             super(REFERENCES);
-            addChild(new RepositoryReferenceHandler(), new ChildElementHandler() {
-                public void childHanlded(DelegetingHandler child) {
-                    repositoryUris.add(((RepositoryReferenceHandler) child).uri);
-                }
-            });
+            addChild(new RepositoryReferenceHandler(),
+                new ChildElementHandler<RepositoryReferenceHandler>() {
+                    public void childHanlded(RepositoryReferenceHandler child) {
+                        repositoryUris.add(child.uri);
+                    }
+                });
         }
 
         protected void handleAttributes(Attributes atts) throws SAXException {
             int size = Integer.parseInt(atts.getValue(SIZE));
-            repositoryUris = new ArrayList(size);
+            repositoryUris = new ArrayList<URI>(size);
         }
     }
 
-    class RepositoryReferenceHandler extends DelegetingHandler {
+    private class RepositoryReferenceHandler extends DelegatingHandler {
 
         private static final String REPOSITORY = "repository";
 
-        private static final String TYPE = "type";
-
-        private static final String OPTIONS = "options";
-
-        private static final String NAME = "name";
+        //        private static final String TYPE = "type";
+        //
+        //        private static final String OPTIONS = "options";
+        //
+        //        private static final String NAME = "name";
 
         private static final String URI = "uri";
 
@@ -160,18 +156,18 @@ public class P2MetadataParser implements
             super(REPOSITORY);
         }
 
-        int type;
-
-        int options;
-
-        String name;
+        //        int type;
+        //
+        //        int options;
+        //
+        //        String name;
 
         URI uri;
 
         protected void handleAttributes(Attributes atts) throws SAXException {
-            type = Integer.parseInt(atts.getValue(TYPE));
-            options = Integer.parseInt(atts.getValue(OPTIONS));
-            name = atts.getValue(NAME);
+            //            type = Integer.parseInt(atts.getValue(TYPE));
+            //            options = Integer.parseInt(atts.getValue(OPTIONS));
+            //            name = atts.getValue(NAME);
 
             String uriAtt = atts.getValue(URI);
             String urlAtt = atts.getValue(URL);
@@ -195,21 +191,20 @@ public class P2MetadataParser implements
         }
     }
 
-    class UnitsHandler extends DelegetingHandler {
+    private class UnitsHandler extends DelegatingHandler {
 
         private static final String UNITS = "units";
 
         private static final String SIZE = "size";
 
-        List bundles;
+        List<BundleInfo> bundles;
 
         public UnitsHandler() {
             super(UNITS);
-            addChild(new UnitHandler(), new ChildElementHandler() {
-                public void childHanlded(DelegetingHandler child) {
-                    BundleInfo bundleInfo = ((UnitHandler) child).bundleInfo;
-                    if (bundleInfo != null && !bundleInfo.getCapabilities().isEmpty()) {
-                        bundles.add(bundleInfo);
+            addChild(new UnitHandler(), new ChildElementHandler<UnitHandler>() {
+                public void childHanlded(UnitHandler child) {
+                    if (child.bundleInfo != null && !child.bundleInfo.getCapabilities().isEmpty()) {
+                        bundles.add(child.bundleInfo);
                     }
                 }
             });
@@ -217,12 +212,12 @@ public class P2MetadataParser implements
 
         protected void handleAttributes(Attributes atts) {
             int size = Integer.parseInt(atts.getValue(SIZE));
-            bundles = new ArrayList(size);
+            bundles = new ArrayList<BundleInfo>(size);
         }
 
     }
 
-    class UnitHandler extends DelegetingHandler {
+    class UnitHandler extends DelegatingHandler {
 
         private static final String CATEGORY_PROPERTY = "org.eclipse.equinox.p2.type.category";
 
@@ -242,11 +237,10 @@ public class P2MetadataParser implements
             // public void childHanlded(DelegetingHandler child) {
             // }
             // });
-            addChild(new PropertiesHandler(Arrays.asList(new String[] {CATEGORY_PROPERTY})),
-                new ChildElementHandler() {
-                    public void childHanlded(DelegetingHandler child) {
-                        Map properties = ((PropertiesHandler) child).properties;
-                        String category = (String) properties.get(CATEGORY_PROPERTY);
+            addChild(new PropertiesHandler(CATEGORY_PROPERTY),
+                new ChildElementHandler<PropertiesHandler>() {
+                    public void childHanlded(PropertiesHandler child) {
+                        String category = child.properties.get(CATEGORY_PROPERTY);
                         if (category != null && Boolean.valueOf(category).booleanValue()) {
                             // this is a category definition, this is useless, skip this unit
                             child.getParent().skip();
@@ -254,10 +248,9 @@ public class P2MetadataParser implements
                         }
                     }
                 });
-            addChild(new ProvidesHandler(), new ChildElementHandler() {
-                public void childHanlded(DelegetingHandler child) {
-                    String eclipseType = ((ProvidesHandler) child).eclipseType;
-                    if ("source".equals(eclipseType)) {
+            addChild(new ProvidesHandler(), new ChildElementHandler<ProvidesHandler>() {
+                public void childHanlded(ProvidesHandler child) {
+                    if ("source".equals(child.eclipseType)) {
                         // this is some source of some bundle
                         bundleInfo.setSource(true);
                         // we need to parse the manifest in the toupointData to figure out the
@@ -271,54 +264,52 @@ public class P2MetadataParser implements
                             bundleInfo.setVersionTarget(bundleInfo.getVersion());
                         }
                     }
-                    Iterator it = ((ProvidesHandler) child).capabilities.iterator();
-                    while (it.hasNext()) {
-                        bundleInfo.addCapability((BundleCapability) it.next());
+                    for (BundleCapability capability : child.capabilities) {
+                        bundleInfo.addCapability(capability);
                     }
                 }
             });
-            addChild(new FilterHandler(), new ChildElementHandler() {
-                public void childHanlded(DelegetingHandler child) {
+            addChild(new FilterHandler(), new ChildElementHandler<FilterHandler>() {
+                public void childHanlded(FilterHandler child) {
                 }
             });
-            addChild(new RequiresHandler(), new ChildElementHandler() {
-                public void childHanlded(DelegetingHandler child) {
-                    Iterator it = ((RequiresHandler) child).requirements.iterator();
-                    while (it.hasNext()) {
-                        bundleInfo.addRequirement((BundleRequirement) it.next());
+            addChild(new RequiresHandler(), new ChildElementHandler<RequiresHandler>() {
+                public void childHanlded(RequiresHandler child) {
+                    for (BundleRequirement requirement : child.requirements) {
+                        bundleInfo.addRequirement(requirement);
                     }
                 }
             });
-            addChild(new HostRequirementsHandler(), new ChildElementHandler() {
-                public void childHanlded(DelegetingHandler child) {
-                }
-            });
-            addChild(new MetaRequirementsHandler(), new ChildElementHandler() {
-                public void childHanlded(DelegetingHandler child) {
-                }
-            });
-            addChild(new ArtifactsHandler(), new ChildElementHandler() {
-                public void childHanlded(DelegetingHandler child) {
+            addChild(new HostRequirementsHandler(),
+                new ChildElementHandler<HostRequirementsHandler>() {
+                    public void childHanlded(HostRequirementsHandler child) {
+                    }
+                });
+            addChild(new MetaRequirementsHandler(),
+                new ChildElementHandler<MetaRequirementsHandler>() {
+                    public void childHanlded(MetaRequirementsHandler child) {
+                    }
+                });
+            addChild(new ArtifactsHandler(), new ChildElementHandler<ArtifactsHandler>() {
+                public void childHanlded(ArtifactsHandler child) {
                 }
             });
             // addChild(new TouchpointHandler(), new ChildElementHandler() {
             // public void childHanlded(DelegetingHandler child) {
             // }
             // });
-            addChild(new TouchpointDataHandler(), new ChildElementHandler() {
-                public void childHanlded(DelegetingHandler child) throws SAXParseException {
-                    Boolean zipped = ((TouchpointDataHandler) child).zipped;
-                    if (zipped != null) {
-                        bundleInfo.setHasInnerClasspath(zipped.booleanValue());
+            addChild(new TouchpointDataHandler(), new ChildElementHandler<TouchpointDataHandler>() {
+                public void childHanlded(TouchpointDataHandler child) throws SAXParseException {
+                    if (child.zipped != null) {
+                        bundleInfo.setHasInnerClasspath(child.zipped.booleanValue());
                     }
                     if (!bundleInfo.isSource()) {
                         // we only care about parsing the manifest if it is a source
                         return;
                     }
-                    String manifest = ((TouchpointDataHandler) child).manifest;
-                    if (manifest != null) {
+                    if (child.manifest != null) {
                         // Eclipse may have serialized a little bit weirdly
-                        manifest = ManifestParser.formatLines(manifest.trim());
+                        String manifest = ManifestParser.formatLines(child.manifest.trim());
                         BundleInfo embeddedInfo;
                         try {
                             embeddedInfo = ManifestParser.parseManifest(manifest);
@@ -420,7 +411,7 @@ public class P2MetadataParser implements
     //
     // }
 
-    static class FilterHandler extends DelegetingHandler {
+    private static class FilterHandler extends DelegatingHandler {
 
         private static final String FILTER = "filter";
 
@@ -441,40 +432,36 @@ public class P2MetadataParser implements
         return null;
     }
 
-    class ProvidesHandler extends DelegetingHandler {
+    private class ProvidesHandler extends DelegatingHandler {
 
         private static final String PROVIDES = "provides";
 
         private static final String SIZE = "size";
 
-        List capabilities;
+        List<BundleCapability> capabilities;
 
         String eclipseType;
 
         public ProvidesHandler() {
             super(PROVIDES);
-            addChild(new ProvidedHandler(), new ChildElementHandler() {
-                public void childHanlded(DelegetingHandler child) {
-                    String name = ((ProvidedHandler) child).name;
-                    Version version = ((ProvidedHandler) child).version;
-                    String namespace = ((ProvidedHandler) child).namespace;
-                    if (namespace.equals("org.eclipse.equinox.p2.eclipse.type")) {
+            addChild(new ProvidedHandler(), new ChildElementHandler<ProvidedHandler>() {
+                public void childHanlded(ProvidedHandler child) {
+                    if (child.namespace.equals("org.eclipse.equinox.p2.eclipse.type")) {
                         eclipseType = ((ProvidedHandler) child).name;
                     } else {
-                        String type = namespace2Type(namespace);
+                        String type = namespace2Type(child.namespace);
                         if (type == null) {
                             if (logLevel >= Message.MSG_DEBUG) {
-                                Message.debug("Unsupported provided capability "
-                                        + ((ProvidedHandler) child).namespace + " " + name + " "
-                                        + version);
+                                Message.debug("Unsupported provided capability " + child.namespace
+                                        + " " + child.name + " " + child.version);
                             }
                             return;
                         }
                         BundleCapability capability;
                         if (type == BundleInfo.PACKAGE_TYPE) {
-                            capability = new ExportPackage(name, version);
+                            capability = new ExportPackage(child.name, child.version);
                         } else {
-                            capability = new BundleCapability(type, name, version);
+                            capability = new BundleCapability(type, child.name, child.version);
                         }
                         capabilities.add(capability);
                     }
@@ -484,12 +471,12 @@ public class P2MetadataParser implements
 
         protected void handleAttributes(Attributes atts) {
             int size = Integer.parseInt(atts.getValue(SIZE));
-            capabilities = new ArrayList(size);
+            capabilities = new ArrayList<BundleCapability>(size);
         }
 
     }
 
-    static class ProvidedHandler extends DelegetingHandler {
+    private static class ProvidedHandler extends DelegatingHandler {
 
         private static final String PROVIDED = "provided";
 
@@ -522,18 +509,18 @@ public class P2MetadataParser implements
 
     }
 
-    abstract class AbstractRequirementHandler extends DelegetingHandler {
+    abstract class AbstractRequirementHandler extends DelegatingHandler {
 
         private static final String SIZE = "size";
 
-        List requirements;
+        List<BundleRequirement> requirements;
 
         public AbstractRequirementHandler(String name) {
             super(name);
-            addChild(new RequiredHandler(), new ChildElementHandler() {
-                public void childHanlded(DelegetingHandler child) {
-                    String name = ((RequiredHandler) child).name;
-                    VersionRange range = ((RequiredHandler) child).range;
+            addChild(new RequiredHandler(), new ChildElementHandler<RequiredHandler>() {
+                public void childHanlded(RequiredHandler child) {
+                    String name = child.name;
+                    VersionRange range = child.range;
                     String type = namespace2Type(((RequiredHandler) child).namespace);
                     if (type == null) {
                         if (logLevel >= Message.MSG_DEBUG) {
@@ -542,7 +529,7 @@ public class P2MetadataParser implements
                                     + range);
                         }
                     } else {
-                        String resolution = ((RequiredHandler) child).optional ? "optional" : null;
+                        String resolution = child.optional ? "optional" : null;
                         requirements.add(new BundleRequirement(type, name, range, resolution));
                     }
                 }
@@ -551,12 +538,12 @@ public class P2MetadataParser implements
 
         protected void handleAttributes(Attributes atts) {
             int size = Integer.parseInt(atts.getValue(SIZE));
-            requirements = new ArrayList(size);
+            requirements = new ArrayList<BundleRequirement>(size);
         }
 
     }
 
-    class RequiresHandler extends AbstractRequirementHandler {
+    private class RequiresHandler extends AbstractRequirementHandler {
 
         private static final String REQUIRES = "requires";
 
@@ -566,7 +553,7 @@ public class P2MetadataParser implements
 
     }
 
-    class RequiredHandler extends DelegetingHandler {
+    private class RequiredHandler extends DelegatingHandler {
 
         private static final String REQUIRED = "required";
 
@@ -578,7 +565,7 @@ public class P2MetadataParser implements
 
         private static final String OPTIONAL = "optional";
 
-        private static final String GREEDY = "greedy";
+        //        private static final String GREEDY = "greedy";
 
         String namespace;
 
@@ -586,19 +573,19 @@ public class P2MetadataParser implements
 
         VersionRange range;
 
-        String filter;
-
-        boolean greedy;
+        //        String filter;
+        //
+        //        boolean greedy;
 
         boolean optional;
 
         public RequiredHandler() {
             super(REQUIRED);
-            addChild(new FilterHandler(), new ChildElementHandler() {
-                public void childHanlded(DelegetingHandler child) {
-                    filter = child.getBufferedChars().trim();
-                }
-            });
+            //            addChild(new FilterHandler(), new ChildElementHandler<FilterHandler>() {
+            //                public void childHanlded(FilterHandler child) {
+            //                    filter = child.getBufferedChars().trim();
+            //                }
+            //            });
         }
 
         protected void handleAttributes(Attributes atts) throws SAXParseException {
@@ -609,13 +596,13 @@ public class P2MetadataParser implements
             } catch (ParseException e) {
                 throw new RuntimeException(e);
             }
-            greedy = getOptionalBooleanAttribute(atts, GREEDY, Boolean.TRUE).booleanValue();
+            //            greedy = getOptionalBooleanAttribute(atts, GREEDY, Boolean.TRUE).booleanValue();
             optional = getOptionalBooleanAttribute(atts, OPTIONAL, Boolean.FALSE).booleanValue();
         }
 
     }
 
-    class HostRequirementsHandler extends AbstractRequirementHandler {
+    private class HostRequirementsHandler extends AbstractRequirementHandler {
 
         private static final String HOST_REQUIREMENTS = "hostRequirements";
 
@@ -625,7 +612,7 @@ public class P2MetadataParser implements
 
     }
 
-    class MetaRequirementsHandler extends AbstractRequirementHandler {
+    private class MetaRequirementsHandler extends AbstractRequirementHandler {
 
         private static final String META_REQUIREMENTS = "metaRequirements";
 
@@ -635,31 +622,31 @@ public class P2MetadataParser implements
 
     }
 
-    class ArtifactsHandler extends DelegetingHandler {
+    private class ArtifactsHandler extends DelegatingHandler {
 
         private static final String ARTIFACTS = "artifacts";
 
         private static final String SIZE = "size";
 
-        List artifacts;
+        List<P2Artifact> artifacts;
 
         public ArtifactsHandler() {
             super(ARTIFACTS);
-            addChild(new ArtifactHandler(), new ChildElementHandler() {
-                public void childHanlded(DelegetingHandler child) {
-                    artifacts.add(((ArtifactHandler) child).artifact);
+            addChild(new ArtifactHandler(), new ChildElementHandler<ArtifactHandler>() {
+                public void childHanlded(ArtifactHandler child) {
+                    artifacts.add(child.artifact);
                 }
             });
         }
 
         protected void handleAttributes(Attributes atts) {
             int size = Integer.parseInt(atts.getValue(SIZE));
-            artifacts = new ArrayList(size);
+            artifacts = new ArrayList<P2Artifact>(size);
         }
 
     }
 
-    class ArtifactHandler extends DelegetingHandler/* <ArtifactsHandler> */{
+    private class ArtifactHandler extends DelegatingHandler {
 
         private static final String ARTIFACT = "artifact";
 
@@ -689,27 +676,26 @@ public class P2MetadataParser implements
 
     }
 
+    //    private static class TouchpointHandler extends DelegetingHandler {
     //
-    // static class TouchpointHandler extends DelegetingHandler {
-    //
-    // private static final String TOUCHPOINT = "touchpoint";
+    //        private static final String TOUCHPOINT = "touchpoint";
     //
-    // private static final String ID = "id";
+    //        private static final String ID = "id";
     //
-    // private static final String VERSION = "version";
+    //        private static final String VERSION = "version";
     //
-    // public TouchpointHandler() {
-    // super(TOUCHPOINT);
-    // }
+    //        public TouchpointHandler() {
+    //            super(TOUCHPOINT);
+    //        }
     //
-    // protected void handleAttributes(Attributes atts) {
-    // String id = atts.getValue(ID);
-    // String version = atts.getValue(VERSION);
-    // }
+    //        protected void handleAttributes(Attributes atts) {
+    //            String id = atts.getValue(ID);
+    //            String version = atts.getValue(VERSION);
+    //        }
     //
-    // }
+    //    }
 
-    class TouchpointDataHandler extends DelegetingHandler {
+    private class TouchpointDataHandler extends DelegatingHandler {
 
         private static final String TOUCHPOINTDATA = "touchpointData";
 
@@ -721,10 +707,10 @@ public class P2MetadataParser implements
 
         public TouchpointDataHandler() {
             super(TOUCHPOINTDATA);
-            addChild(new InstructionsHandler(), new ChildElementHandler() {
-                public void childHanlded(DelegetingHandler child) {
-                    manifest = ((InstructionsHandler) child).manifest;
-                    zipped = ((InstructionsHandler) child).zipped;
+            addChild(new InstructionsHandler(), new ChildElementHandler<InstructionsHandler>() {
+                public void childHanlded(InstructionsHandler child) {
+                    manifest = child.manifest;
+                    zipped = child.zipped;
                 }
             });
         }
@@ -735,7 +721,7 @@ public class P2MetadataParser implements
 
     }
 
-    class InstructionsHandler extends DelegetingHandler {
+    private class InstructionsHandler extends DelegatingHandler {
 
         private static final String INSTRUCTIONS = "instructions";
 
@@ -747,15 +733,14 @@ public class P2MetadataParser implements
 
         public InstructionsHandler() {
             super(INSTRUCTIONS);
-            addChild(new InstructionHandler(), new ChildElementHandler() {
-                public void childHanlded(DelegetingHandler child) {
+            addChild(new InstructionHandler(), new ChildElementHandler<InstructionHandler>() {
+                public void childHanlded(InstructionHandler child) {
                     manifest = null;
                     zipped = null;
-                    String buffer = ((InstructionHandler) child).getBufferedChars().trim();
-                    String key = ((InstructionHandler) child).key;
-                    if ("manifest".equals(key)) {
+                    String buffer = child.getBufferedChars().trim();
+                    if ("manifest".equals(child.key)) {
                         manifest = buffer;
-                    } else if ("zipped".equals(key) && buffer.length() != 0) {
+                    } else if ("zipped".equals(child.key) && buffer.length() != 0) {
                         zipped = Boolean.valueOf(buffer);
                     }
                 }
@@ -768,7 +753,7 @@ public class P2MetadataParser implements
 
     }
 
-    class InstructionHandler extends DelegetingHandler {
+    private class InstructionHandler extends DelegatingHandler {
 
         private static final String INSTRUCTION = "instruction";
 
@@ -787,152 +772,152 @@ public class P2MetadataParser implements
 
     }
 
-    // static class LicensesHandler extends DelegetingHandler {
+    //    private static class LicensesHandler extends DelegetingHandler {
     //
-    // private static final String LICENSES = "licenses";
+    //        private static final String LICENSES = "licenses";
     //
-    // private static final String SIZE = "size";
+    //        private static final String SIZE = "size";
     //
-    // public LicensesHandler() {
-    // super(LICENSES);
-    // addChild(new LicenseHandler(), new ChildElementHandler() {
-    // public void childHanlded(DelegetingHandler child) {
-    // }
-    // });
-    // }
+    //        public LicensesHandler() {
+    //            super(LICENSES);
+    //            addChild(new LicenseHandler(), new ChildElementHandler() {
+    //                public void childHanlded(DelegetingHandler child) {
+    //                }
+    //            });
+    //        }
     //
-    // protected void handleAttributes(Attributes atts) {
-    // String size = atts.getValue(SIZE);
-    // }
+    //        protected void handleAttributes(Attributes atts) {
+    //            String size = atts.getValue(SIZE);
+    //        }
     //
-    // }
+    //    }
+
+    //    private static class LicenseHandler extends DelegetingHandler {
     //
-    // static class LicenseHandler extends DelegetingHandler {
+    //        private static final String LICENSE = "license";
     //
-    // private static final String LICENSE = "license";
+    //        private static final String URI = "uri";
     //
-    // private static final String URI = "uri";
+    //        private static final String URL = "url";
     //
-    // private static final String URL = "url";
+    //        public LicenseHandler() {
+    //            super(LICENSE);
+    //            setBufferingChar(true);
+    //        }
     //
-    // public LicenseHandler() {
-    // super(LICENSE);
-    // setBufferingChar(true);
-    // }
+    //        protected void handleAttributes(Attributes atts) {
+    //            String uri = atts.getValue(URI);
+    //            String url = atts.getValue(URL);
+    //        }
     //
-    // protected void handleAttributes(Attributes atts) {
-    // String uri = atts.getValue(URI);
-    // String url = atts.getValue(URL);
-    // }
+    //    }
+
+    //    private static class CopyrightHandler extends DelegetingHandler {
     //
-    // }
+    //        private static final String COPYRIGHT = "copyright";
     //
-    // static class CopyrightHandler extends DelegetingHandler {
+    //        private static final String URI = "uri";
     //
-    // private static final String COPYRIGHT = "copyright";
+    //        private static final String URL = "url";
     //
-    // private static final String URI = "uri";
+    //        public CopyrightHandler() {
+    //            super(COPYRIGHT);
+    //        }
     //
-    // private static final String URL = "url";
+    //        protected void handleAttributes(Attributes atts) {
+    //            String uri = atts.getValue(URI);
+    //            String url = atts.getValue(URL);
+    //        }
     //
-    // public CopyrightHandler() {
-    // super(COPYRIGHT);
-    // }
+    //    }
+
+    //    private class ChangesHandler extends DelegetingHandler {
     //
-    // protected void handleAttributes(Attributes atts) {
-    // String uri = atts.getValue(URI);
-    // String url = atts.getValue(URL);
-    // }
+    //        private static final String CHANGES = "changes";
     //
-    // }
-
-    class ChangesHandler extends DelegetingHandler {
-
-        private static final String CHANGES = "changes";
-
-        // private static final String SIZE = "size";
-
-        public ChangesHandler() {
-            super(CHANGES);
-            addChild(new ChangeHandler(), new ChildElementHandler() {
-                public void childHanlded(DelegetingHandler child) {
-                }
-            });
-        }
-
-        protected void handleAttributes(Attributes atts) {
-            // int size = Integer.parseInt(atts.getValue(SIZE));
-        }
-    }
-
-    class ChangeHandler extends DelegetingHandler {
-
-        private static final String CHANGE = "change";
-
-        public ChangeHandler() {
-            super(CHANGE);
-        }
-    }
-
-    class FromHandler extends AbstractRequirementHandler {
-
-        private static final String FROM = "from";
-
-        public FromHandler() {
-            super(FROM);
-        }
-
-    }
-
-    class ToHandler extends AbstractRequirementHandler {
-
-        private static final String TO = "to";
-
-        public ToHandler() {
-            super(TO);
-        }
-
-    }
-
-    class PatchScopeHandler extends DelegetingHandler {
-
-        private static final String PATCH_SCOPE = "patchScope";
-
-        // private static final String SIZE = "size";
-
-        public PatchScopeHandler() {
-            super(PATCH_SCOPE);
-            addChild(new PatchScopeHandler(), new ChildElementHandler() {
-                public void childHanlded(DelegetingHandler child) {
-                }
-            });
-        }
-
-        protected void handleAttributes(Attributes atts) {
-            // int size = Integer.parseInt(atts.getValue(SIZE));
-        }
-    }
+    //        private static final String SIZE = "size";
+    //
+    //        public ChangesHandler() {
+    //            super(CHANGES);
+    //            addChild(new ChangeHandler(), new ChildElementHandler<ChangeHandler>() {
+    //                public void childHanlded(ChangeHandler child) {
+    //                }
+    //            });
+    //        }
+    //
+    //        protected void handleAttributes(Attributes atts) {
+    //            int size = Integer.parseInt(atts.getValue(SIZE));
+    //        }
+    //    }
 
-    class ScopeHandler extends DelegetingHandler {
+    //    private class ChangeHandler extends DelegetingHandler {
+    //
+    //        private static final String CHANGE = "change";
+    //
+    //        public ChangeHandler() {
+    //            super(CHANGE);
+    //        }
+    //    }
 
-        private static final String SCOPE = "scope";
+    //    private class FromHandler extends AbstractRequirementHandler {
+    //
+    //        private static final String FROM = "from";
+    //
+    //        public FromHandler() {
+    //            super(FROM);
+    //        }
+    //
+    //    }
 
-        public ScopeHandler() {
-            super(SCOPE);
-            addChild(new RequiresHandler(), new ChildElementHandler() {
-                public void childHanlded(DelegetingHandler child) {
-                }
-            });
-        }
-    }
+    //    private class ToHandler extends AbstractRequirementHandler {
+    //
+    //        private static final String TO = "to";
+    //
+    //        public ToHandler() {
+    //            super(TO);
+    //        }
+    //
+    //    }
 
-    class LifeCycleHandler extends AbstractRequirementHandler {
+    //    private class PatchScopeHandler extends DelegetingHandler {
+    //
+    //        private static final String PATCH_SCOPE = "patchScope";
+    //
+    //        private static final String SIZE = "size";
+    //
+    //        public PatchScopeHandler() {
+    //            super(PATCH_SCOPE);
+    //            addChild(new PatchScopeHandler(), new ChildElementHandler<PatchScopeHandler>() {
+    //                public void childHanlded(PatchScopeHandler child) {
+    //                }
+    //            });
+    //        }
+    //
+    //        protected void handleAttributes(Attributes atts) {
+    //            int size = Integer.parseInt(atts.getValue(SIZE));
+    //        }
+    //    }
 
-        private static final String LIFE_CYCLE = "lifeCycle";
+    //    private class ScopeHandler extends DelegetingHandler {
+    //
+    //        private static final String SCOPE = "scope";
+    //
+    //        public ScopeHandler() {
+    //            super(SCOPE);
+    //            addChild(new RequiresHandler(), new ChildElementHandler<RequiresHandler>() {
+    //                public void childHanlded(RequiresHandler child) {
+    //                }
+    //            });
+    //        }
+    //    }
 
-        public LifeCycleHandler() {
-            super(LIFE_CYCLE);
-        }
-    }
+    //    private  class LifeCycleHandler extends AbstractRequirementHandler {
+    //
+    //        private static final String LIFE_CYCLE = "lifeCycle";
+    //
+    //        public LifeCycleHandler() {
+    //            super(LIFE_CYCLE);
+    //        }
+    //    }
 
 }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/p2/PropertiesParser.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/p2/PropertiesParser.java?rev=1553872&r1=1553871&r2=1553872&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/p2/PropertiesParser.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/p2/PropertiesParser.java Sat Dec 28 16:54:23 2013
@@ -17,31 +17,31 @@
  */
 package org.apache.ivy.osgi.p2;
 
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.ivy.osgi.util.DelegetingHandler;
+import org.apache.ivy.osgi.util.DelegatingHandler;
 import org.xml.sax.Attributes;
 
 public class PropertiesParser {
 
-    static class PropertiesHandler extends DelegetingHandler {
+    static class PropertiesHandler extends DelegatingHandler {
 
         private static final String PROPERTIES = "properties";
 
         private static final String SIZE = "size";
 
-        Map properties;
+        Map<String, String> properties;
 
-
-        public PropertiesHandler(final List/*<String>*/ props) {
+        public PropertiesHandler(String... props) {
             super(PROPERTIES);
-            addChild(new PropertyHandler(), new ChildElementHandler() {
-                public void childHanlded(DelegetingHandler child) {
-                    String name = ((PropertyHandler) child).name;
-                    if (props == null || props.contains(name)) {
-                        properties.put(name, ((PropertyHandler) child).value);
+            final List<String> propList = Arrays.asList(props);
+            addChild(new PropertyHandler(), new ChildElementHandler<PropertyHandler>() {
+                public void childHanlded(PropertyHandler child) {
+                    if (propList.isEmpty() || propList.contains(child.name)) {
+                        properties.put(child.name, child.value);
                     }
                 }
             });
@@ -49,12 +49,12 @@ public class PropertiesParser {
 
         protected void handleAttributes(Attributes atts) {
             int size = Integer.parseInt(atts.getValue(SIZE));
-            properties = new HashMap(size);
+            properties = new HashMap<String, String>(size);
         }
 
     }
 
-    static class PropertyHandler extends DelegetingHandler {
+    static class PropertyHandler extends DelegatingHandler {
 
         private static final String PROPERTY = "property";
 

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/AbstractFSManifestIterable.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/AbstractFSManifestIterable.java?rev=1553872&r1=1553871&r2=1553872&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/AbstractFSManifestIterable.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/AbstractFSManifestIterable.java Sat Dec 28 16:54:23 2013
@@ -32,27 +32,27 @@ import java.util.jar.Manifest;
 import org.apache.ivy.util.Message;
 
 // T is the type of the resource "path"
-public abstract class AbstractFSManifestIterable /* <T> implements Iterable/* <ManifestAndLocation> */{
+public abstract class AbstractFSManifestIterable<T> implements Iterable<ManifestAndLocation> {
 
-    private final Object/* T */root;
+    private final T root;
 
-    public AbstractFSManifestIterable(Object /* T */root) {
+    public AbstractFSManifestIterable(T root) {
         this.root = root;
     }
 
-    public Iterator/* <ManifestAndLocation> */iterator() {
+    public Iterator<ManifestAndLocation> iterator() {
         return new FSManifestIterator();
     }
 
-    abstract protected List/* <T> */listBundleFiles(Object/* T */dir) throws IOException;
+    abstract protected List<T> listBundleFiles(T dir) throws IOException;
 
-    abstract protected List/* <T> */listDirs(Object/* T */dir) throws IOException;
+    abstract protected List<T> listDirs(T dir) throws IOException;
 
-    abstract protected InputStream getInputStream(Object/* T */f) throws IOException;
+    abstract protected InputStream getInputStream(T f) throws IOException;
 
-    abstract protected URI buildBundleURI(Object/* T */location) throws IOException;
+    abstract protected URI buildBundleURI(T location) throws IOException;
 
-    class FSManifestIterator implements Iterator/* <ManifestAndLocation> */{
+    class FSManifestIterator implements Iterator<ManifestAndLocation> {
 
         private ManifestAndLocation next = null;
 
@@ -62,17 +62,17 @@ public abstract class AbstractFSManifest
          * the stack is an iterator on the children on the root. The last iterator in the stack
          * points to {@link #currentDir}.
          */
-        private Stack/* <Iterator<T>> */dirs = new Stack/* <Iterator<T>> */();
+        private Stack<Iterator<T>> dirs = new Stack<Iterator<T>>();
 
         /**
          * The bundles files being lookup.
          */
-        private Iterator/* <T> */bundleCandidates = null;
+        private Iterator<T> bundleCandidates = null;
 
-        private Object/* T */currentDir = null;
+        private T currentDir = null;
 
         FSManifestIterator() {
-            dirs.add(Collections.singleton(root).iterator());
+            dirs.add(Collections.<T>singleton(root).iterator());
         }
 
         /**
@@ -84,8 +84,8 @@ public abstract class AbstractFSManifest
                 // no current directory
                 if (currentDir == null) {
                     // so get the next one
-                    if (((Iterator) dirs.peek()).hasNext()) {
-                        currentDir = ((Iterator) dirs.peek()).next();
+                    if (dirs.peek().hasNext()) {
+                        currentDir = dirs.peek().next();
                         try {
                             bundleCandidates = listBundleFiles(currentDir).iterator();
                         } catch (IOException e) {
@@ -100,7 +100,7 @@ public abstract class AbstractFSManifest
                         dirs.pop();
                     }
                 } else if (bundleCandidates.hasNext()) {
-                    Object/* T */bundleCandidate = bundleCandidates.next();
+                    T bundleCandidate = bundleCandidates.next();
                     JarInputStream in = null;
                     try {
                         in = new JarInputStream(getInputStream(bundleCandidate));
@@ -131,7 +131,7 @@ public abstract class AbstractFSManifest
                         dirs.add(listDirs(currentDir).iterator());
                     } catch (IOException e) {
                         Message.warn("Unlistable dir: " + currentDir + " (" + e + ")");
-                        dirs.add(Collections.EMPTY_LIST.iterator());
+                        dirs.add(Collections.<T> emptyList().iterator());
                     }
                     currentDir = null;
                 }
@@ -139,7 +139,7 @@ public abstract class AbstractFSManifest
             return true;
         }
 
-        public Object next() {
+        public ManifestAndLocation next() {
             if (!hasNext()) {
                 throw new NoSuchElementException();
             }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/AbstractOSGiResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/AbstractOSGiResolver.java?rev=1553872&r1=1553871&r2=1553872&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/AbstractOSGiResolver.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/AbstractOSGiResolver.java Sat Dec 28 16:54:23 2013
@@ -63,7 +63,8 @@ public abstract class AbstractOSGiResolv
 
     private static final String CAPABILITY_EXTRA_ATTR = "osgi_bundle";
 
-    protected static final RepoDescriptor FAILING_REPO_DESCRIPTOR = new RepoDescriptor(null, null);
+    protected static final RepoDescriptor FAILING_REPO_DESCRIPTOR = new EditableRepoDescriptor(
+            null, null);
 
     private RepoDescriptor repoDescriptor = null;
 
@@ -115,11 +116,12 @@ public abstract class AbstractOSGiResolv
 
     abstract protected void init();
 
-    private RepoDescriptor getRepoDescriptor() {
+    public RepoDescriptor getRepoDescriptor() {
         ensureInit();
         return repoDescriptor;
     }
 
+    @Override
     public boolean isAllownomd() {
         // this a repo based resolver, we always have md
         return false;
@@ -133,7 +135,7 @@ public abstract class AbstractOSGiResolv
             throw new RuntimeException("Unsupported OSGi module Id: " + mrid.getModuleId());
         }
         String id = mrid.getName();
-        Collection/* <ModuleDescriptor> */mds = ModuleDescriptorWrapper.unwrap(getRepoDescriptor()
+        Collection<ModuleDescriptor> mds = ModuleDescriptorWrapper.unwrap(getRepoDescriptor()
                 .findModule(osgiType, id));
         if (mds == null || mds.isEmpty()) {
             Message.verbose("\t " + id + " not found.");
@@ -156,12 +158,10 @@ public abstract class AbstractOSGiResolv
     }
 
     public ResolvedResource[] findBundle(DependencyDescriptor dd, ResolveData data,
-            Collection/* < ModuleDescriptor > */mds) {
+            Collection<ModuleDescriptor> mds) {
         ResolvedResource[] ret = new ResolvedResource[mds.size()];
         int i = 0;
-        Iterator itMd = mds.iterator();
-        while (itMd.hasNext()) {
-            ModuleDescriptor md = (ModuleDescriptor) itMd.next();
+        for (ModuleDescriptor md : mds) {
             MetadataArtifactDownloadReport report = new MetadataArtifactDownloadReport(null);
             report.setDownloadStatus(DownloadStatus.NO);
             report.setSearched(true);
@@ -173,12 +173,10 @@ public abstract class AbstractOSGiResolv
     }
 
     public ResolvedResource[] findCapability(DependencyDescriptor dd, ResolveData data,
-            Collection/* < ModuleDescriptor > */mds) {
+            Collection<ModuleDescriptor> mds) {
         ResolvedResource[] ret = new ResolvedResource[mds.size()];
         int i = 0;
-        Iterator itMd = mds.iterator();
-        while (itMd.hasNext()) {
-            ModuleDescriptor md = (ModuleDescriptor) itMd.next();
+        for (ModuleDescriptor md : mds) {
             IvyNode node = data.getNode(md.getModuleRevisionId());
             if (node != null && node.getDescriptor() != null) {
                 // already resolved import, no need to go further
@@ -226,6 +224,7 @@ public abstract class AbstractOSGiResolv
         return new MDResolvedResource(null, capabilityMd.getRevision(), rmr);
     }
 
+    @Override
     public ResolvedResource findResource(ResolvedResource[] rress, ResourceMDParser rmdparser,
             ModuleRevisionId mrid, Date date) {
         ResolvedResource found = super.findResource(rress, rmdparser, mrid, date);
@@ -236,29 +235,24 @@ public abstract class AbstractOSGiResolv
             // several candidates with different symbolic name : make an warning about the ambiguity
             if (rress.length != 1) {
                 // several candidates with different symbolic name ?
-                Map/* <String, List<MDResolvedResource>> */matching = new HashMap();
+                Map<String, List<MDResolvedResource>> matching = new HashMap<String, List<MDResolvedResource>>();
                 for (int i = 0; i < rress.length; i++) {
                     String name = ((MDResolvedResource) rress[i]).getResolvedModuleRevision()
                             .getDescriptor().getExtraAttribute(CAPABILITY_EXTRA_ATTR);
-                    List/* <MDResolvedResource> */list = (List) matching.get(name);
+                    List<MDResolvedResource> list = matching.get(name);
                     if (list == null) {
-                        list = new ArrayList/* <MDResolvedResource> */();
+                        list = new ArrayList<MDResolvedResource>();
                         matching.put(name, list);
                     }
-                    list.add(rress[i]);
+                    list.add((MDResolvedResource) rress[i]);
                 }
                 if (matching.keySet().size() != 1) {
                     if (requirementStrategy == RequirementStrategy.first) {
                         Message.warn("Ambiguity for the '" + osgiType + "' requirement "
                                 + mrid.getName() + ";version=" + mrid.getRevision());
-                        Iterator itMatching = matching.entrySet().iterator();
-                        while (itMatching.hasNext()) {
-                            Entry/* <String, List<MDResolvedResource>> */entry = (Entry) itMatching
-                                    .next();
+                        for (Entry<String, List<MDResolvedResource>> entry : matching.entrySet()) {
                             Message.warn("\t" + entry.getKey());
-                            Iterator itB = ((List) entry.getValue()).iterator();
-                            while (itB.hasNext()) {
-                                MDResolvedResource c = (MDResolvedResource) itB.next();
+                            for (MDResolvedResource c : entry.getValue()) {
                                 Message.warn("\t\t" + c.getRevision()
                                         + (found == c ? " (selected)" : ""));
                             }
@@ -266,14 +260,9 @@ public abstract class AbstractOSGiResolv
                     } else if (requirementStrategy == RequirementStrategy.noambiguity) {
                         Message.error("Ambiguity for the '" + osgiType + "' requirement "
                                 + mrid.getName() + ";version=" + mrid.getRevision());
-                        Iterator itMatching = matching.entrySet().iterator();
-                        while (itMatching.hasNext()) {
-                            Entry/* <String, List<MDResolvedResource>> */entry = (Entry) itMatching
-                                    .next();
+                        for (Entry<String, List<MDResolvedResource>> entry : matching.entrySet()) {
                             Message.error("\t" + entry.getKey());
-                            Iterator itB = ((List) entry.getValue()).iterator();
-                            while (itB.hasNext()) {
-                                MDResolvedResource c = (MDResolvedResource) itB.next();
+                            for (MDResolvedResource c : entry.getValue()) {
                                 Message.error("\t\t" + c.getRevision()
                                         + (found == c ? " (best match)" : ""));
                             }
@@ -303,6 +292,7 @@ public abstract class AbstractOSGiResolv
         return new ResolvedResource(resource, artifact.getModuleRevisionId().getRevision());
     }
 
+    @Override
     protected void checkModuleDescriptorRevision(ModuleDescriptor systemMd,
             ModuleRevisionId systemMrid) {
         String osgiType = systemMrid.getOrganisation();
@@ -313,11 +303,13 @@ public abstract class AbstractOSGiResolv
         }
     }
 
+    @Override
     protected Collection/* <String> */filterNames(Collection/* <String> */names) {
         getSettings().filterIgnore(names);
         return names;
     }
 
+    @Override
     protected Collection findNames(Map tokenValues, String token) {
         if (IvyPatternHelper.ORGANISATION_KEY.equals(token)) {
             return getRepoDescriptor().getCapabilities();
@@ -334,12 +326,10 @@ public abstract class AbstractOSGiResolv
 
         if (IvyPatternHelper.REVISION_KEY.equals(token)) {
             String name = (String) tokenValues.get(IvyPatternHelper.MODULE_KEY);
-            List/* <String> */versions = new ArrayList/* <String> */();
-            Set/* <ModuleDescriptorWrapper> */mds = getRepoDescriptor().findModule(osgiType, name);
+            List<String> versions = new ArrayList<String>();
+            Set<ModuleDescriptorWrapper> mds = getRepoDescriptor().findModule(osgiType, name);
             if (mds != null) {
-                Iterator itMd = mds.iterator();
-                while (itMd.hasNext()) {
-                    ModuleDescriptorWrapper md = (ModuleDescriptorWrapper) itMd.next();
+                for (ModuleDescriptorWrapper md : mds) {
                     versions.add(md.getBundleInfo().getVersion().toString());
                 }
             }
@@ -354,8 +344,8 @@ public abstract class AbstractOSGiResolv
             if (osgiType.equals(BundleInfo.PACKAGE_TYPE)) {
                 return Collections.singletonList(BundleInfoAdapter.CONF_USE_PREFIX + name);
             }
-            Collection/* <ModuleDescriptor> */mds = ModuleDescriptorWrapper
-                    .unwrap(getRepoDescriptor().findModule(osgiType, name));
+            Collection<ModuleDescriptor> mds = ModuleDescriptorWrapper.unwrap(getRepoDescriptor()
+                    .findModule(osgiType, name));
             if (mds == null) {
                 return Collections.EMPTY_LIST;
             }
@@ -364,9 +354,7 @@ public abstract class AbstractOSGiResolv
                 return Collections.EMPTY_LIST;
             }
             ModuleDescriptor found = null;
-            Iterator itBundle = mds.iterator();
-            while (itBundle.hasNext()) {
-                ModuleDescriptor md = (ModuleDescriptor) itBundle.next();
+            for (ModuleDescriptor md : mds) {
                 if (md.getRevision().equals(version)) {
                     found = md;
                 }
@@ -374,7 +362,7 @@ public abstract class AbstractOSGiResolv
             if (found == null) {
                 return Collections.EMPTY_LIST;
             }
-            List/* <String> */confs = Arrays.asList(found.getConfigurationsNames());
+            List<String> confs = Arrays.asList(found.getConfigurationsNames());
             return confs;
         }
         return Collections.EMPTY_LIST;
@@ -384,18 +372,15 @@ public abstract class AbstractOSGiResolv
      * Populate capabilityValues with capability values for which at least one module match the
      * expected revision
      */
-    private void filterCapabilityValues(Set/* <String> */capabilityValues,
-            Map/* <String, Set<ModuleDescriptor>> */moduleByCapbilityValue,
-            Map/* <String, String */tokenValues, String rev) {
+    private void filterCapabilityValues(Set<String> capabilityValues,
+            Map<String, Set<ModuleDescriptor>> moduleByCapbilityValue,
+            Map<String, String> tokenValues, String rev) {
         if (rev == null) {
             // no revision, all match then
             capabilityValues.addAll(moduleByCapbilityValue.keySet());
         } else {
-            Iterator/* <Entry<String, Set<ModuleDescriptor>>> */it = moduleByCapbilityValue
-                    .entrySet().iterator();
-            while (it.hasNext()) {
-                Entry/* <String, Set<ModuleDescriptor>> */entry = (Entry) it.next();
-                Iterator/* <ModuleDescriptor> */itModules = ((Set) entry.getValue()).iterator();
+            for (Entry<String, Set<ModuleDescriptor>> entry : moduleByCapbilityValue.entrySet()) {
+                Iterator<ModuleDescriptor> itModules = entry.getValue().iterator();
                 boolean moduleMatchRev = false;
                 while (!moduleMatchRev && itModules.hasNext()) {
                     ModuleDescriptor md = (ModuleDescriptor) itModules.next();
@@ -409,121 +394,111 @@ public abstract class AbstractOSGiResolv
         }
     }
 
+    @Override
     public Map[] listTokenValues(String[] tokens, Map criteria) {
-        Set/* <String> */tokenSet = new HashSet/* <String> */(Arrays.asList(tokens));
-        Set/* <Map<String, String>> */listTokenValues = listTokenValues(tokenSet, criteria);
+        Set<String> tokenSet = new HashSet<String>(Arrays.asList(tokens));
+        Set<Map<String, String>> listTokenValues = listTokenValues(tokenSet, criteria);
         return (Map[]) listTokenValues.toArray(new Map[listTokenValues.size()]);
     }
 
-    private Set/* <Map<String, String>> */listTokenValues(Set/* <String> */tokens, Map/*
-                                                                                       * <String,
-                                                                                       * String>
-                                                                                       */criteria) {
+    private Set<Map<String, String>> listTokenValues(Set<String> tokens,
+            Map<String, String> criteria) {
         if (tokens.isEmpty()) {
-            return Collections./* <Map<String, String>> */singleton(criteria);
+            return Collections.singleton(criteria);
         }
 
-        Set/* <String> */tokenSet = new HashSet/* <String> */(tokens);
+        Set<String> remainingTokens = new HashSet<String>(tokens);
 
-        Map/* <String, String> */values = new HashMap/* <String, String> */();
+        Map<String, String> values = new HashMap<String, String>();
 
-        tokenSet.remove(IvyPatternHelper.ORGANISATION_KEY);
-        String osgiType = (String) criteria.get(IvyPatternHelper.ORGANISATION_KEY);
+        remainingTokens.remove(IvyPatternHelper.ORGANISATION_KEY);
+        String osgiType = criteria.get(IvyPatternHelper.ORGANISATION_KEY);
         if (osgiType == null || osgiType.length() == 0) {
-            return Collections.EMPTY_SET;
+            return Collections.emptySet();
         }
         values.put(IvyPatternHelper.ORGANISATION_KEY, osgiType);
 
         if (osgiType == null) {
-            Set/* <Map<String, String>> */tokenValues = new HashSet/* <Map<String, String>> */();
-            Map/* <String, String> */newCriteria = new HashMap/* <String, String> */(criteria);
+            Set<Map<String, String>> tokenValues = new HashSet<Map<String, String>>();
+            Map<String, String> newCriteria = new HashMap<String, String>(criteria);
             newCriteria.put(IvyPatternHelper.ORGANISATION_KEY, BundleInfo.BUNDLE_TYPE);
-            tokenValues.addAll(listTokenValues(tokenSet, newCriteria));
-            newCriteria = new HashMap/* <String, String> */(criteria);
+            tokenValues.addAll(listTokenValues(remainingTokens, newCriteria));
+            newCriteria = new HashMap<String, String>(criteria);
             newCriteria.put(IvyPatternHelper.ORGANISATION_KEY, BundleInfo.PACKAGE_TYPE);
-            tokenValues.addAll(listTokenValues(tokenSet, newCriteria));
-            newCriteria = new HashMap/* <String, String> */(criteria);
+            tokenValues.addAll(listTokenValues(remainingTokens, newCriteria));
+            newCriteria = new HashMap<String, String>(criteria);
             newCriteria.put(IvyPatternHelper.ORGANISATION_KEY, BundleInfo.SERVICE_TYPE);
-            tokenValues.addAll(listTokenValues(tokenSet, newCriteria));
+            tokenValues.addAll(listTokenValues(remainingTokens, newCriteria));
             return tokenValues;
         }
 
-        Set/* <String> */capabilities = getRepoDescriptor().getCapabilityValues(osgiType);
+        Set<String> capabilities = getRepoDescriptor().getCapabilityValues(osgiType);
         if (capabilities == null || capabilities.isEmpty()) {
-            return Collections.EMPTY_SET;
+            return Collections.emptySet();
         }
 
-        tokenSet.remove(IvyPatternHelper.MODULE_KEY);
-        String module = (String) criteria.get(IvyPatternHelper.MODULE_KEY);
+        remainingTokens.remove(IvyPatternHelper.MODULE_KEY);
+        String module = criteria.get(IvyPatternHelper.MODULE_KEY);
         if (module == null) {
-            Set/* <Map<String, String>> */tokenValues = new HashSet/* <Map<String, String>> */();
-            Iterator itNames = capabilities.iterator();
-            while (itNames.hasNext()) {
-                String name = (String) itNames.next();
-                Map/* <String, String> */newCriteria = new HashMap/* <String, String> */(criteria);
+            Set<Map<String, String>> tokenValues = new HashSet<Map<String, String>>();
+            for (String name : capabilities) {
+                Map<String, String> newCriteria = new HashMap<String, String>(criteria);
                 newCriteria.put(IvyPatternHelper.MODULE_KEY, name);
-                tokenValues.addAll(listTokenValues(tokenSet, newCriteria));
+                tokenValues.addAll(listTokenValues(remainingTokens, newCriteria));
             }
             return tokenValues;
         }
         values.put(IvyPatternHelper.MODULE_KEY, module);
 
-        tokenSet.remove(IvyPatternHelper.REVISION_KEY);
-        String rev = (String) criteria.get(IvyPatternHelper.REVISION_KEY);
+        remainingTokens.remove(IvyPatternHelper.REVISION_KEY);
+        String rev = criteria.get(IvyPatternHelper.REVISION_KEY);
         if (rev == null) {
-            Set/* <ModuleDescriptorWrapper> */mdws = getRepoDescriptor().findModule(osgiType,
-                module);
+            Set<ModuleDescriptorWrapper> mdws = getRepoDescriptor().findModule(osgiType, module);
             if (mdws == null || mdws.isEmpty()) {
-                return Collections.EMPTY_SET;
+                return Collections.emptySet();
             }
-            Set/* <Map<String, String>> */tokenValues = new HashSet/* <Map<String, String>> */();
-            Iterator itBundle = mdws.iterator();
-            while (itBundle.hasNext()) {
-                ModuleDescriptorWrapper mdw = (ModuleDescriptorWrapper) itBundle.next();
-                Map/* <String, String> */newCriteria = new HashMap/* <String, String> */(criteria);
+            Set<Map<String, String>> tokenValues = new HashSet<Map<String, String>>();
+            for (ModuleDescriptorWrapper mdw : mdws) {
+                Map<String, String> newCriteria = new HashMap<String, String>(criteria);
                 newCriteria.put(IvyPatternHelper.REVISION_KEY, mdw.getBundleInfo().getVersion()
                         .toString());
-                tokenValues.addAll(listTokenValues(tokenSet, newCriteria));
+                tokenValues.addAll(listTokenValues(remainingTokens, newCriteria));
             }
             return tokenValues;
         }
         values.put(IvyPatternHelper.REVISION_KEY, rev);
 
-        tokenSet.remove(IvyPatternHelper.CONF_KEY);
-        String conf = (String) criteria.get(IvyPatternHelper.CONF_KEY);
+        remainingTokens.remove(IvyPatternHelper.CONF_KEY);
+        String conf = criteria.get(IvyPatternHelper.CONF_KEY);
         if (conf == null) {
             if (osgiType.equals(BundleInfo.PACKAGE_TYPE)) {
                 values.put(IvyPatternHelper.CONF_KEY, BundleInfoAdapter.CONF_USE_PREFIX + module);
-                return Collections./* <Map<String, String>> */singleton(values);
+                return Collections.singleton(values);
             }
-            Set/* <BundleCapabilityAndLocation> */bundleCapabilities = getRepoDescriptor()
-                    .findModule(osgiType, module);
-            if (bundleCapabilities == null) {
-                return Collections.EMPTY_SET;
+            Set<ModuleDescriptorWrapper> bundles = getRepoDescriptor().findModule(osgiType, module);
+            if (bundles == null) {
+                return Collections.emptySet();
             }
             Version v;
             try {
                 v = new Version(rev);
             } catch (ParseException e) {
-                return Collections.EMPTY_SET;
+                return Collections.emptySet();
             }
-            BundleCapabilityAndLocation found = null;
-            Iterator itBundle = bundleCapabilities.iterator();
-            while (itBundle.hasNext()) {
-                BundleCapabilityAndLocation bundleCapability = (BundleCapabilityAndLocation) itBundle
-                        .next();
-                if (bundleCapability.getVersion().equals(v)) {
-                    found = bundleCapability;
+            ModuleDescriptorWrapper found = null;
+            for (ModuleDescriptorWrapper bundle : bundles) {
+                if (bundle.getBundleInfo().getVersion().equals(v)) {
+                    found = bundle;
                 }
             }
             if (found == null) {
-                return Collections.EMPTY_SET;
+                return Collections.emptySet();
             }
-            Set/* <Map<String, String>> */tokenValues = new HashSet/* <Map<String, String>> */();
-            List/* <String> */configurations = BundleInfoAdapter.getConfigurations(found
-                    .getBundleInfo());
+            Set<Map<String, String>> tokenValues = new HashSet<Map<String, String>>();
+            List<String> configurations = BundleInfoAdapter
+                    .getConfigurations(found.getBundleInfo());
             for (int i = 0; i < configurations.size(); i++) {
-                Map/* <String, String> */newCriteria = new HashMap/* <String, String> */(criteria);
+                Map<String, String> newCriteria = new HashMap<String, String>(criteria);
                 newCriteria.put(IvyPatternHelper.CONF_KEY, configurations.get(i));
                 tokenValues.add(newCriteria);
             }
@@ -531,7 +506,7 @@ public abstract class AbstractOSGiResolv
         }
         values.put(IvyPatternHelper.CONF_KEY, conf);
 
-        return Collections./* <Map<String, String>> */singleton(values);
+        return Collections.singleton(values);
     }
 
     protected long get(Resource resource, File dest) throws IOException {

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/ArtifactReportManifestIterable.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/ArtifactReportManifestIterable.java?rev=1553872&r1=1553871&r2=1553872&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/ArtifactReportManifestIterable.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/ArtifactReportManifestIterable.java Sat Dec 28 16:54:23 2013
@@ -30,23 +30,23 @@ import java.util.jar.Manifest;
 import org.apache.ivy.core.report.ArtifactDownloadReport;
 import org.apache.ivy.util.Message;
 
-public class ArtifactReportManifestIterable /* implements Iterable<ManifestAndLocation> */{
+public class ArtifactReportManifestIterable implements Iterable<ManifestAndLocation> {
 
-    private final List/* <ArtifactDownloadReport> */artifactReports;
+    private final List<ArtifactDownloadReport> artifactReports;
 
-    public ArtifactReportManifestIterable(List/* <ArtifactDownloadReport> */artifactReports) {
+    public ArtifactReportManifestIterable(List<ArtifactDownloadReport> artifactReports) {
         this.artifactReports = artifactReports;
     }
 
-    public Iterator/* <ManifestAndLocation> */iterator() {
+    public Iterator<ManifestAndLocation> iterator() {
         return new ArtifactReportManifestIterator();
     }
 
-    class ArtifactReportManifestIterator implements Iterator/* <ManifestAndLocation> */{
+    class ArtifactReportManifestIterator implements Iterator<ManifestAndLocation> {
 
         private ManifestAndLocation next = null;
 
-        private Iterator it;
+        private Iterator<ArtifactDownloadReport> it;
 
         public ArtifactReportManifestIterator() {
             it = artifactReports.iterator();
@@ -85,7 +85,7 @@ public class ArtifactReportManifestItera
             return true;
         }
 
-        public Object next() {
+        public ManifestAndLocation next() {
             if (!hasNext()) {
                 throw new NoSuchElementException();
             }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/BundleRepoDescriptor.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/BundleRepoDescriptor.java?rev=1553872&r1=1553871&r2=1553872&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/BundleRepoDescriptor.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/BundleRepoDescriptor.java Sat Dec 28 16:54:23 2013
@@ -26,7 +26,7 @@ import org.apache.ivy.osgi.core.Executio
 import org.apache.ivy.osgi.core.ManifestParser;
 import org.apache.ivy.util.Message;
 
-public class BundleRepoDescriptor extends RepoDescriptor {
+public class BundleRepoDescriptor extends EditableRepoDescriptor {
 
     private String name;
 
@@ -52,9 +52,9 @@ public class BundleRepoDescriptor extend
         return lastModified;
     }
 
-    public void populate(Iterator/* <ManifestAndLocation> */it) {
+    public void populate(Iterator<ManifestAndLocation> it) {
         while (it.hasNext()) {
-            ManifestAndLocation manifestAndLocation = (ManifestAndLocation) it.next();
+            ManifestAndLocation manifestAndLocation = it.next();
             try {
                 BundleInfo bundleInfo = ManifestParser.parseManifest(manifestAndLocation
                         .getManifest());

Added: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/EditableRepoDescriptor.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/EditableRepoDescriptor.java?rev=1553872&view=auto
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/EditableRepoDescriptor.java (added)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/EditableRepoDescriptor.java Sat Dec 28 16:54:23 2013
@@ -0,0 +1,152 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.ivy.osgi.repo;
+
+import java.net.URI;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.ivy.osgi.core.BundleCapability;
+import org.apache.ivy.osgi.core.BundleInfo;
+import org.apache.ivy.osgi.core.ExecutionEnvironmentProfileProvider;
+import org.apache.ivy.util.Message;
+
+public class EditableRepoDescriptor extends RepoDescriptor {
+
+    private final Map<String, Map<String, Set<ModuleDescriptorWrapper>>> moduleByCapabilities = new HashMap<String, Map<String, Set<ModuleDescriptorWrapper>>>();
+
+    private final Set<ModuleDescriptorWrapper> modules = new HashSet<ModuleDescriptorWrapper>();
+
+    private final ExecutionEnvironmentProfileProvider profileProvider;
+
+    private final URI baseUri;
+
+    private int logLevel = Message.MSG_INFO;
+
+    public EditableRepoDescriptor(URI baseUri, ExecutionEnvironmentProfileProvider profileProvider) {
+        this.baseUri = baseUri;
+        this.profileProvider = profileProvider;
+    }
+
+    public void setLogLevel(int logLevel) {
+        this.logLevel = logLevel;
+    }
+
+    public int getLogLevel() {
+        return logLevel;
+    }
+
+    public URI getBaseUri() {
+        return baseUri;
+    }
+
+    public Iterator<ModuleDescriptorWrapper> getModules() {
+        return modules.iterator();
+    }
+
+    public Set<String> getCapabilities() {
+        return moduleByCapabilities.keySet();
+    }
+
+    public Set<ModuleDescriptorWrapper> findModule(String requirement, String value) {
+        Map<String, Set<ModuleDescriptorWrapper>> modules = moduleByCapabilities.get(requirement);
+        if (modules == null) {
+            return null;
+        }
+        return modules.get(value);
+    }
+
+    public Set<String> getCapabilityValues(String capabilityName) {
+        Map<String, Set<ModuleDescriptorWrapper>> modules = moduleByCapabilities
+                .get(capabilityName);
+        if (modules == null) {
+            return Collections.emptySet();
+        }
+        return modules.keySet();
+    }
+
+    public void add(String type, String value, ModuleDescriptorWrapper md) {
+        modules.add(md);
+        Map<String, Set<ModuleDescriptorWrapper>> map = moduleByCapabilities.get(type);
+        if (map == null) {
+            map = new HashMap<String, Set<ModuleDescriptorWrapper>>();
+            moduleByCapabilities.put(type, map);
+        }
+        Set<ModuleDescriptorWrapper> bundleReferences = map.get(value);
+        if (bundleReferences == null) {
+            bundleReferences = new HashSet<ModuleDescriptorWrapper>();
+            map.put(value, bundleReferences);
+        }
+        if (!bundleReferences.add(md)) {
+            if (logLevel <= Message.MSG_DEBUG) {
+                Message.debug("Duplicate module in the repo " + baseUri + " for " + type + " "
+                        + value + ": " + md.getBundleInfo().getSymbolicName() + "#"
+                        + md.getBundleInfo().getVersion());
+            }
+        }
+    }
+
+    public void addBundle(BundleInfo bundleInfo) {
+        ModuleDescriptorWrapper md = new ModuleDescriptorWrapper(bundleInfo, baseUri,
+                profileProvider);
+        add(BundleInfo.BUNDLE_TYPE, bundleInfo.getSymbolicName(), md);
+        for (BundleCapability capability : bundleInfo.getCapabilities()) {
+            add(capability.getType(), capability.getName(), md);
+        }
+    }
+
+    @Override
+    public String toString() {
+        return modules.toString();
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((modules == null) ? 0 : modules.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        EditableRepoDescriptor other = (EditableRepoDescriptor) obj;
+        if (modules == null) {
+            if (other.modules != null) {
+                return false;
+            }
+        } else if (!modules.equals(other.modules)) {
+            return false;
+        }
+        return true;
+    }
+
+}

Propchange: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/EditableRepoDescriptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/EditableRepoDescriptor.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/EditableRepoDescriptor.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/FSManifestIterable.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/FSManifestIterable.java?rev=1553872&r1=1553871&r2=1553872&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/FSManifestIterable.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/FSManifestIterable.java Sat Dec 28 16:54:23 2013
@@ -31,13 +31,13 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
-public class FSManifestIterable extends AbstractFSManifestIterable/* <File> */{
+public class FSManifestIterable extends AbstractFSManifestIterable<File> {
 
     /**
      * List of directory name that usually contains jars but are not bundles
      */
-    public static final Set/* <String> */NON_BUNDLE_DIRS = new HashSet/* <String> */(
-            Arrays.asList(new String[] {"source", "sources", "javadoc", "javadocs", "doc", "docs"}));
+    public static final Set<String> NON_BUNDLE_DIRS = new HashSet<String>(Arrays.asList("source",
+        "sources", "javadoc", "javadocs", "doc", "docs"));
 
     /**
      * Default directory filter that doesn't select .svn directories, neither the directories that
@@ -88,9 +88,9 @@ public class FSManifestIterable extends 
         this.bundleFilter = bundleFilter;
     }
 
-    protected URI buildBundleURI(Object/* File */location) {
+    protected URI buildBundleURI(File location) {
         try {
-            return new URI(((File) location).toURI().toURL().toExternalForm());
+            return new URI(location.toURI().toURL().toExternalForm());
         } catch (MalformedURLException e) {
             throw new RuntimeException("Unexpected file to url conversion error", e);
         } catch (URISyntaxException e) {
@@ -98,12 +98,12 @@ public class FSManifestIterable extends 
         }
     }
 
-    protected InputStream getInputStream(Object/* File */f) throws FileNotFoundException {
+    protected InputStream getInputStream(File f) throws FileNotFoundException {
         return new FileInputStream((File) f);
     }
 
-    protected List/* <File> */listBundleFiles(Object/* File */dir) {
-        return Arrays.asList(((File) dir).listFiles(new FileFilter() {
+    protected List<File> listBundleFiles(File dir) {
+        return Arrays.asList(dir.listFiles(new FileFilter() {
             public boolean accept(File f) {
                 if (!f.isFile()) {
                     return false;
@@ -113,8 +113,8 @@ public class FSManifestIterable extends 
         }));
     }
 
-    protected List/* <File> */listDirs(Object/* File */dir) {
-        return Arrays.asList(((File) dir).listFiles(new FileFilter() {
+    protected List<File> listDirs(File dir) {
+        return Arrays.asList(dir.listFiles(new FileFilter() {
             public boolean accept(File f) {
                 if (!f.isDirectory()) {
                     return false;

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/ModuleDescriptorWrapper.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/ModuleDescriptorWrapper.java?rev=1553872&r1=1553871&r2=1553872&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/ModuleDescriptorWrapper.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/ModuleDescriptorWrapper.java Sat Dec 28 16:54:23 2013
@@ -21,11 +21,11 @@ import java.net.URI;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.Iterator;
 import java.util.List;
 
 import org.apache.ivy.core.module.descriptor.DefaultArtifact;
 import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor;
+import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
 import org.apache.ivy.osgi.core.BundleInfo;
 import org.apache.ivy.osgi.core.BundleInfoAdapter;
 import org.apache.ivy.osgi.core.ExecutionEnvironmentProfileProvider;
@@ -77,28 +77,26 @@ public class ModuleDescriptorWrapper {
         return md;
     }
 
-    public static Collection/* <DefaultModuleDescriptor> */unwrap(Collection/*
-                                                                             * <ModuleDescriptorWrapper
-                                                                             * >
-                                                                             */collection) {
+    public static Collection<ModuleDescriptor> unwrap(Collection<ModuleDescriptorWrapper> collection) {
         if (collection == null) {
             return null;
         }
         if (collection.isEmpty()) {
-            return Collections.EMPTY_LIST;
+            return Collections.emptyList();
         }
-        List/* <DefaultModuleDescriptor> */unwrapped = new ArrayList();
-        Iterator itWrapped = collection.iterator();
-        while (itWrapped.hasNext()) {
-            unwrapped.add(((ModuleDescriptorWrapper) itWrapped.next()).getModuleDescriptor());
+        List<ModuleDescriptor> unwrapped = new ArrayList<ModuleDescriptor>();
+        for (ModuleDescriptorWrapper wrapped : collection) {
+            unwrapped.add(wrapped.getModuleDescriptor());
         }
         return unwrapped;
     }
 
+    @Override
     public int hashCode() {
         return bundleInfo.hashCode();
     }
 
+    @Override
     public boolean equals(Object obj) {
         if (obj == null || !(obj instanceof ModuleDescriptorWrapper)) {
             return false;

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/RelativeURLRepository.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/RelativeURLRepository.java?rev=1553872&r1=1553871&r2=1553872&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/RelativeURLRepository.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/RelativeURLRepository.java Sat Dec 28 16:54:23 2013
@@ -42,7 +42,7 @@ public class RelativeURLRepository exten
         this.baseUrl = baseUrl;
     }
 
-    private Map/* <String, Resource> */resourcesCache = new HashMap/* <String, Resource> */();
+    private Map<String, Resource> resourcesCache = new HashMap<String, Resource>();
 
     public Resource getResource(String source) throws IOException {
         source = encode(source);

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/RepoDescriptor.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/RepoDescriptor.java?rev=1553872&r1=1553871&r2=1553872&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/RepoDescriptor.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/RepoDescriptor.java Sat Dec 28 16:54:23 2013
@@ -17,136 +17,17 @@
  */
 package org.apache.ivy.osgi.repo;
 
-import java.net.URI;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
 import java.util.Iterator;
-import java.util.Map;
 import java.util.Set;
 
-import org.apache.ivy.osgi.core.BundleCapability;
-import org.apache.ivy.osgi.core.BundleInfo;
-import org.apache.ivy.osgi.core.ExecutionEnvironmentProfileProvider;
-import org.apache.ivy.util.Message;
-
-public class RepoDescriptor {
-
-    private final Map/* <String, Map<String, Set<ModuleDescriptor>>> */moduleByCapabilities = new HashMap();
-
-    private final Set/* <ModuleDescriptor> */modules = new HashSet();
-
-    private final ExecutionEnvironmentProfileProvider profileProvider;
-
-    private final URI baseUri;
-
-    private int logLevel = Message.MSG_INFO;
-
-    public RepoDescriptor(URI baseUri, ExecutionEnvironmentProfileProvider profileProvider) {
-        this.baseUri = baseUri;
-        this.profileProvider = profileProvider;
-    }
-
-    public void setLogLevel(int logLevel) {
-        this.logLevel = logLevel;
-    }
-
-    public int getLogLevel() {
-        return logLevel;
-    }
-
-    public URI getBaseUri() {
-        return baseUri;
-    }
-
-    public Iterator/* <ModuleDescriptorWrapper> */getModules() {
-        return modules.iterator();
-    }
-
-    public Set/* <String> */getCapabilities() {
-        return moduleByCapabilities.keySet();
-    }
-
-    public Set/* <ModuleDescriptorWrapper> */findModule(String requirement, String value) {
-        Map/* <String, Set<ModuleDescriptorWrapper>> */modules = (Map) moduleByCapabilities
-                .get(requirement);
-        if (modules == null) {
-            return null;
-        }
-        return (Set) modules.get(value);
-    }
-
-    public Set/* <String> */getCapabilityValues(String capabilityName) {
-        Map/* <String, Set<ModuleDescriptorWrapper>> */modules = (Map) moduleByCapabilities
-                .get(capabilityName);
-        if (modules == null) {
-            return Collections.EMPTY_SET;
-        }
-        return modules.keySet();
-    }
-
-    public void add(String type, String value, ModuleDescriptorWrapper md) {
-        modules.add(md);
-        Map/* <String, Set<ModuleDescriptorWrapper>> */map = (Map) moduleByCapabilities.get(type);
-        if (map == null) {
-            map = new HashMap/* <String, Set<ModuleDescriptorWrapper>> */();
-            moduleByCapabilities.put(type, map);
-        }
-        Set/* <ModuleDescriptorWrapper> */bundleReferences = (Set) map.get(value);
-        if (bundleReferences == null) {
-            bundleReferences = new HashSet/* <ModuleDescriptorWrapper> */();
-            map.put(value, bundleReferences);
-        }
-        if (!bundleReferences.add(md)) {
-            if (logLevel <= Message.MSG_DEBUG) {
-                Message.debug("Duplicate module in the repo " + baseUri + " for " + type + " "
-                        + value + ": " + md.getBundleInfo().getSymbolicName() + "#"
-                        + md.getBundleInfo().getVersion());
-            }
-        }
-    }
-
-    public void addBundle(BundleInfo bundleInfo) {
-        ModuleDescriptorWrapper md = new ModuleDescriptorWrapper(bundleInfo, baseUri,
-                profileProvider);
-        add(BundleInfo.BUNDLE_TYPE, bundleInfo.getSymbolicName(), md);
-        Iterator itCapability = bundleInfo.getCapabilities().iterator();
-        while (itCapability.hasNext()) {
-            BundleCapability capability = (BundleCapability) itCapability.next();
-            add(capability.getType(), capability.getName(), md);
-        }
-    }
-
-    public String toString() {
-        return modules.toString();
-    }
-
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + ((modules == null) ? 0 : modules.hashCode());
-        return result;
-    }
-
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        RepoDescriptor other = (RepoDescriptor) obj;
-        if (modules == null) {
-            if (other.modules != null) {
-                return false;
-            }
-        } else if (!modules.equals(other.modules)) {
-            return false;
-        }
-        return true;
-    }
+public abstract class RepoDescriptor {
+
+    abstract public Iterator<ModuleDescriptorWrapper> getModules();
+
+    abstract public Set<String> getCapabilities();
+
+    abstract public Set<ModuleDescriptorWrapper> findModule(String requirement, String value);
+
+    abstract public Set<String> getCapabilityValues(String capabilityName);
 
 }