Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/RepositoryManifestIterable.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/RepositoryManifestIterable.java?rev=1553872&r1=1553871&r2=1553872&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/RepositoryManifestIterable.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/RepositoryManifestIterable.java Sat Dec 28 16:54:23 2013 @@ -30,7 +30,7 @@ import org.apache.ivy.plugins.repository import org.apache.ivy.plugins.repository.Resource; import org.apache.ivy.plugins.resolver.util.ResolverHelper; -public class RepositoryManifestIterable extends AbstractFSManifestIterable/* <String> */{ +public class RepositoryManifestIterable extends AbstractFSManifestIterable<String> { private final Repository repo; @@ -45,7 +45,7 @@ public class RepositoryManifestIterable this.repo = repo; } - protected URI buildBundleURI(Object/* String */location) throws IOException { + protected URI buildBundleURI(String location) throws IOException { Resource resource = repo.getResource((String) location); // We have a resource to transform into an URI, let's use some heuristics try { @@ -55,19 +55,19 @@ public class RepositoryManifestIterable } } - protected InputStream getInputStream(Object/* String */f) throws IOException { + protected InputStream getInputStream(String f) throws IOException { return repo.getResource((String) f).openStream(); } - protected List/* <String> */listBundleFiles(Object/* String */dir) throws IOException { + protected List<String> listBundleFiles(String dir) throws IOException { return asList(ResolverHelper.listAll(repo, (String) dir)); } - protected List/* <String> */listDirs(Object/* String */dir) throws IOException { + protected List<String> listDirs(String dir) throws IOException { return asList(ResolverHelper.listAll(repo, (String) dir)); } - private List/* <String> */asList(String[] array) { - return array == null ? Collections.EMPTY_LIST : Arrays./* <String> */asList(array); + private List<String> asList(String[] array) { + return array == null ? Collections.<String> emptyList() : Arrays.<String> asList(array); } }
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/ResolverManifestIterable.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/ResolverManifestIterable.java?rev=1553872&r1=1553871&r2=1553872&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/ResolverManifestIterable.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/ResolverManifestIterable.java Sat Dec 28 16:54:23 2013 @@ -44,7 +44,7 @@ import org.apache.ivy.plugins.resolver.B import org.apache.ivy.plugins.resolver.util.ResolvedResource; import org.apache.ivy.util.Message; -public class ResolverManifestIterable { //implements Iterable/* <ManifestAndLocation> */{ +public class ResolverManifestIterable implements Iterable<ManifestAndLocation> { // We should support the interface DependencyResolver, but the API is not convenient to get // references to artifact @@ -54,11 +54,11 @@ public class ResolverManifestIterable { this.resolver = resolver; } - public Iterator/* <ManifestAndLocation> */iterator() { + public Iterator<ManifestAndLocation> iterator() { return new ResolverManifestIterator(); } - class ResolverManifestIterator implements Iterator/* <ManifestAndLocation> */{ + class ResolverManifestIterator implements Iterator<ManifestAndLocation> { private OrganisationEntry[] organisations; @@ -188,7 +188,7 @@ public class ResolverManifestIterable { return true; } - public Object next() { + public ManifestAndLocation next() { if (!hasNext()) { throw new NoSuchElementException(); } Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/PluginAdapter.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/PluginAdapter.java?rev=1553872&r1=1553871&r2=1553872&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/PluginAdapter.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/PluginAdapter.java Sat Dec 28 16:54:23 2013 @@ -18,7 +18,6 @@ package org.apache.ivy.osgi.updatesite; import java.net.URI; -import java.util.Iterator; import org.apache.ivy.osgi.core.BundleInfo; import org.apache.ivy.osgi.core.BundleRequirement; @@ -42,17 +41,13 @@ public class PluginAdapter { b.setDescription(feature.getDescription()); b.setLicense(feature.getLicense()); - Iterator itPlugins = feature.getPlugins().iterator(); - while (itPlugins.hasNext()) { - EclipsePlugin plugin = (EclipsePlugin) itPlugins.next(); + for (EclipsePlugin plugin : feature.getPlugins()) { BundleRequirement r = new BundleRequirement(BundleInfo.BUNDLE_TYPE, plugin.getId(), new VersionRange(plugin.getVersion()), null); b.addRequirement(r); } - Iterator itRequires = feature.getRequires().iterator(); - while (itRequires.hasNext()) { - Require require = (Require) itRequires.next(); + for (Require require : feature.getRequires()) { String id; if (require.getPlugin() != null) { id = require.getPlugin(); Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/UpdateSiteDescriptor.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/UpdateSiteDescriptor.java?rev=1553872&r1=1553871&r2=1553872&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/UpdateSiteDescriptor.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/UpdateSiteDescriptor.java Sat Dec 28 16:54:23 2013 @@ -18,14 +18,13 @@ package org.apache.ivy.osgi.updatesite; import java.net.URI; -import java.util.Iterator; import org.apache.ivy.osgi.core.ExecutionEnvironmentProfileProvider; -import org.apache.ivy.osgi.repo.RepoDescriptor; +import org.apache.ivy.osgi.repo.EditableRepoDescriptor; import org.apache.ivy.osgi.updatesite.xml.EclipseFeature; import org.apache.ivy.osgi.updatesite.xml.EclipsePlugin; -public class UpdateSiteDescriptor extends RepoDescriptor { +public class UpdateSiteDescriptor extends EditableRepoDescriptor { public UpdateSiteDescriptor(URI baseUri, ExecutionEnvironmentProfileProvider profileProvider) { super(baseUri, profileProvider); @@ -34,9 +33,8 @@ public class UpdateSiteDescriptor extend public void addFeature(EclipseFeature feature) { addBundle(PluginAdapter.featureAsBundle(getBaseUri(), feature)); - Iterator itPlugins = feature.getPlugins().iterator(); - while (itPlugins.hasNext()) { - addBundle(PluginAdapter.pluginAsBundle(getBaseUri(), (EclipsePlugin) itPlugins.next())); + for (EclipsePlugin plugin : feature.getPlugins()) { + addBundle(PluginAdapter.pluginAsBundle(getBaseUri(), plugin)); } } Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/UpdateSiteLoader.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/UpdateSiteLoader.java?rev=1553872&r1=1553871&r2=1553872&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/UpdateSiteLoader.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/UpdateSiteLoader.java Sat Dec 28 16:54:23 2013 @@ -136,9 +136,7 @@ public class UpdateSiteLoader { P2CompositeParser p2CompositeParser = new P2CompositeParser(); boolean exist = readJarOrXml(repoUri, name, p2CompositeParser); if (exist) { - Iterator itChildLocation = p2CompositeParser.getChildLocations().iterator(); - while (itChildLocation.hasNext()) { - String childLocation = (String) itChildLocation.next(); + for (String childLocation : p2CompositeParser.getChildLocations()) { if (!childLocation.endsWith("/")) { childLocation += "/"; } Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/xml/EclipseFeature.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/xml/EclipseFeature.java?rev=1553872&r1=1553871&r2=1553872&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/xml/EclipseFeature.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/xml/EclipseFeature.java Sat Dec 28 16:54:23 2013 @@ -28,9 +28,9 @@ public class EclipseFeature { private Version version; - private List/* <EclipsePlugin> */plugins = new ArrayList(); + private List<EclipsePlugin> plugins = new ArrayList<EclipsePlugin>(); - private List/* <Require> */requires = new ArrayList(); + private List<Require> requires = new ArrayList<Require>(); private String url; @@ -123,7 +123,7 @@ public class EclipseFeature { plugins.add(plugin); } - public List getPlugins() { + public List<EclipsePlugin> getPlugins() { return plugins; } @@ -131,7 +131,7 @@ public class EclipseFeature { requires.add(require); } - public List getRequires() { + public List<Require> getRequires() { return requires; } Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/xml/EclipseUpdateSiteParser.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/xml/EclipseUpdateSiteParser.java?rev=1553872&r1=1553871&r2=1553872&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/xml/EclipseUpdateSiteParser.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/xml/EclipseUpdateSiteParser.java Sat Dec 28 16:54:23 2013 @@ -26,7 +26,7 @@ import java.text.ParseException; import javax.xml.parsers.ParserConfigurationException; -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.util.XMLHelper; import org.xml.sax.Attributes; @@ -44,7 +44,7 @@ public class EclipseUpdateSiteParser { return handler.updatesite; } - static class SiteHandler extends DelegetingHandler { + private static class SiteHandler extends DelegatingHandler { private static final String SITE = "site"; @@ -67,9 +67,9 @@ public class EclipseUpdateSiteParser { // updateSite.setDescription(child.getBufferedChars().trim()); // } // }); - addChild(new FeatureHandler(), new ChildElementHandler() { - public void childHanlded(DelegetingHandler child) { - updatesite.addFeature(((FeatureHandler) child).feature); + addChild(new FeatureHandler(), new ChildElementHandler<FeatureHandler>() { + public void childHanlded(FeatureHandler child) { + updatesite.addFeature(child.feature); } }); // addChild(new ArchiveHandler(), new ChildElementHandler() { @@ -125,23 +125,23 @@ public class EclipseUpdateSiteParser { } } - static class DescriptionHandler extends DelegetingHandler { + // private static class DescriptionHandler extends DelegetingHandler { + // + // private static final String DESCRIPTION = "description"; + // + // private static final String URL = "url"; + // + // public DescriptionHandler() { + // super(DESCRIPTION); + // setBufferingChar(true); + // } + // + // protected void handleAttributes(Attributes atts) { + // String url = atts.getValue(URL); + // } + // } - private static final String DESCRIPTION = "description"; - - private static final String URL = "url"; - - public DescriptionHandler() { - super(DESCRIPTION); - setBufferingChar(true); - } - - protected void handleAttributes(Attributes atts) { - String url = atts.getValue(URL); - } - } - - static class FeatureHandler extends DelegetingHandler { + private static class FeatureHandler extends DelegatingHandler { private static final String FEATURE = "feature"; @@ -169,9 +169,9 @@ public class EclipseUpdateSiteParser { public FeatureHandler() { super(FEATURE); - addChild(new CategoryHandler(), new ChildElementHandler() { - public void childHanlded(DelegetingHandler child) { - feature.addCategory(((CategoryHandler) child).name); + addChild(new CategoryHandler(), new ChildElementHandler<CategoryHandler>() { + public void childHanlded(CategoryHandler child) { + feature.addCategory(child.name); } }); } @@ -201,7 +201,7 @@ public class EclipseUpdateSiteParser { } - static class CategoryHandler extends DelegetingHandler { + private static class CategoryHandler extends DelegatingHandler { private static final String CATEGORY = "category"; @@ -218,60 +218,60 @@ public class EclipseUpdateSiteParser { } } - static class ArchiveHandler extends DelegetingHandler { - - private static final String ARCHIVE = "archive"; - - private static final String URL = "url"; - - private static final String PATH = "path"; - - private Archive archive; - - public ArchiveHandler() { - super(ARCHIVE); - } - - protected void handleAttributes(Attributes atts) throws SAXException { - archive = new Archive(); - - String path = atts.getValue(PATH); - archive.setPath(path); - - String url = atts.getValue(URL); - archive.setURL(url); - - } - } - - static class CategoryDefHandler extends DelegetingHandler { - - private static final String CATEGORY_DEF = "category-def"; - - private static final String NAME = "name"; - - private static final String LABEL = "label"; - - private CategoryDef categoryDef; - - public CategoryDefHandler() { - super(CATEGORY_DEF); - addChild(new DescriptionHandler(), new ChildElementHandler() { - public void childHanlded(DelegetingHandler child) { - categoryDef.setDescription(child.getBufferedChars().trim()); - } - }); - } - - protected void handleAttributes(Attributes atts) throws SAXException { - categoryDef = new CategoryDef(); - - String name = atts.getValue(NAME); - categoryDef.setName(name); - - String label = atts.getValue(LABEL); - categoryDef.setLabel(label); - } - } + // private static class ArchiveHandler extends DelegetingHandler { + // + // private static final String ARCHIVE = "archive"; + // + // private static final String URL = "url"; + // + // private static final String PATH = "path"; + // + // private Archive archive; + // + // public ArchiveHandler() { + // super(ARCHIVE); + // } + // + // protected void handleAttributes(Attributes atts) throws SAXException { + // archive = new Archive(); + // + // String path = atts.getValue(PATH); + // archive.setPath(path); + // + // String url = atts.getValue(URL); + // archive.setURL(url); + // + // } + // } + + // private static class CategoryDefHandler extends DelegetingHandler { + // + // private static final String CATEGORY_DEF = "category-def"; + // + // private static final String NAME = "name"; + // + // private static final String LABEL = "label"; + // + // private CategoryDef categoryDef; + // + // public CategoryDefHandler() { + // super(CATEGORY_DEF); + // addChild(new DescriptionHandler(), new ChildElementHandler<DescriptionHandler>() { + // public void childHanlded(DescriptionHandler child) { + // categoryDef.setDescription(child.getBufferedChars().trim()); + // } + // }); + // } + // + // protected void handleAttributes(Attributes atts) throws SAXException { + // categoryDef = new CategoryDef(); + // + // String name = atts.getValue(NAME); + // categoryDef.setName(name); + // + // String label = atts.getValue(LABEL); + // categoryDef.setLabel(label); + // } + // } } Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/xml/FeatureParser.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/xml/FeatureParser.java?rev=1553872&r1=1553871&r2=1553872&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/xml/FeatureParser.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/xml/FeatureParser.java Sat Dec 28 16:54:23 2013 @@ -21,12 +21,11 @@ import java.io.IOException; import java.io.InputStream; import java.text.ParseException; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import javax.xml.parsers.ParserConfigurationException; -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.util.XMLHelper; import org.xml.sax.Attributes; @@ -45,7 +44,7 @@ public class FeatureParser { return handler.feature; } - static class FeatureHandler extends DelegetingHandler { + static class FeatureHandler extends DelegatingHandler { private static final String FEATURE = "feature"; @@ -81,38 +80,37 @@ public class FeatureParser { public FeatureHandler() { super(FEATURE); - addChild(new DescriptionHandler(), new ChildElementHandler() { - public void childHanlded(DelegetingHandler child) { + addChild(new DescriptionHandler(), new ChildElementHandler<DescriptionHandler>() { + public void childHanlded(DescriptionHandler child) { feature.setDescription(child.getBufferedChars().trim()); } }); - addChild(new LicenseHandler(), new ChildElementHandler() { - public void childHanlded(DelegetingHandler child) { + addChild(new LicenseHandler(), new ChildElementHandler<LicenseHandler>() { + public void childHanlded(LicenseHandler child) { feature.setLicense(child.getBufferedChars().trim()); } }); - addChild(new CopyrightHandler(), new ChildElementHandler() { - public void childHanlded(DelegetingHandler child) { + addChild(new CopyrightHandler(), new ChildElementHandler<CopyrightHandler>() { + public void childHanlded(CopyrightHandler child) { feature.setCopyright(child.getBufferedChars().trim()); } }); - addChild(new PluginHandler(), new ChildElementHandler() { - public void childHanlded(DelegetingHandler child) { - feature.addPlugin(((PluginHandler) child).plugin); + addChild(new PluginHandler(), new ChildElementHandler<PluginHandler>() { + public void childHanlded(PluginHandler child) { + feature.addPlugin(child.plugin); } }); - addChild(new RequiresHandler(), new ChildElementHandler() { - public void childHanlded(DelegetingHandler child) { - Iterator itRequire = ((RequiresHandler) child).requires.iterator(); - while (itRequire.hasNext()) { - feature.addRequire((Require) itRequire.next()); + addChild(new RequiresHandler(), new ChildElementHandler<RequiresHandler>() { + public void childHanlded(RequiresHandler child) { + for (Require require : child.requires) { + feature.addRequire(require); } } }); - addChild(new UrlHandler(), new ChildElementHandler() { - public void childHanlded(DelegetingHandler child) { - } - }); + // addChild(new UrlHandler(), new ChildElementHandler<UrlHandler>() { + // public void childHanlded(UrlHandler child) { + // } + // }); } protected void handleAttributes(Attributes atts) throws SAXException { @@ -141,7 +139,7 @@ public class FeatureParser { } - static class PluginHandler extends DelegetingHandler { + private static class PluginHandler extends DelegatingHandler { private static final String PLUGIN = "plugin"; @@ -180,11 +178,11 @@ public class FeatureParser { } } - static class DescriptionHandler extends DelegetingHandler { + private static class DescriptionHandler extends DelegatingHandler { private static final String DESCRIPTION = "description"; - private static final String URL = "url"; + // private static final String URL = "url"; public DescriptionHandler() { super(DESCRIPTION); @@ -192,15 +190,15 @@ public class FeatureParser { } protected void handleAttributes(Attributes atts) throws SAXException { - String url = atts.getValue(URL); + // String url = atts.getValue(URL); } } - static class LicenseHandler extends DelegetingHandler { + private static class LicenseHandler extends DelegatingHandler { private static final String LICENSE = "license"; - private static final String URL = "url"; + // private static final String URL = "url"; public LicenseHandler() { super(LICENSE); @@ -208,16 +206,16 @@ public class FeatureParser { } protected void handleAttributes(Attributes atts) throws SAXException { - String url = atts.getValue(URL); + // String url = atts.getValue(URL); } } - static class CopyrightHandler extends DelegetingHandler { + private static class CopyrightHandler extends DelegatingHandler { private static final String COPYRIGHT = "copyright"; - private static final String URL = "url"; + // private static final String URL = "url"; public CopyrightHandler() { super(COPYRIGHT); @@ -225,27 +223,27 @@ public class FeatureParser { } protected void handleAttributes(Attributes atts) throws SAXException { - String url = atts.getValue(URL); + // String url = atts.getValue(URL); } } - static class RequiresHandler extends DelegetingHandler { + static class RequiresHandler extends DelegatingHandler { private static final String REQUIRES = "requires"; - List requires = new ArrayList(); + List<Require> requires = new ArrayList<Require>(); public RequiresHandler() { super(REQUIRES); - addChild(new ImportHandler(), new ChildElementHandler() { - public void childHanlded(DelegetingHandler child) { - requires.add(((ImportHandler) child).require); + addChild(new ImportHandler(), new ChildElementHandler<ImportHandler>() { + public void childHanlded(ImportHandler child) { + requires.add(child.require); } }); } } - static class ImportHandler extends DelegetingHandler { + private static class ImportHandler extends DelegatingHandler { Require require; @@ -283,110 +281,110 @@ public class FeatureParser { } } - static class IncludesHandler extends DelegetingHandler { - - private static final String INCLUDES = "includes"; - - private static final String FILTER = "filter"; - - private static final String OPTIONAL = "optional"; - - private static final String VERSION = "version"; - - private static final String ID = "id"; - - public IncludesHandler() { - super(INCLUDES); - } - - protected void handleAttributes(Attributes atts) throws SAXException { - String id = atts.getValue(ID); - String version = atts.getValue(VERSION); - String optional = atts.getValue(OPTIONAL); - String filter = atts.getValue(FILTER); - } - - } - - static class InstallHandlerHandler extends DelegetingHandler { - - private static final String INSTALL_HANDLER = "install-handler"; - - private static final String URL = "url"; - - private static final String LIBRARY = "library"; - - private static final String HANDLER = "handler"; - - public InstallHandlerHandler() { - super(INSTALL_HANDLER); - } - - protected void handleAttributes(Attributes atts) throws SAXException { - String handler = atts.getValue(HANDLER); - String library = atts.getValue(LIBRARY); - String url = atts.getValue(URL); - } - - } - - static class UrlHandler extends DelegetingHandler { - - private static final String URL = "url"; - - public UrlHandler() { - super(URL); - addChild(new UpdateHandler(), new ChildElementHandler() { - public void childHanlded(DelegetingHandler child) { - } - }); - addChild(new DiscoveryHandler(), new ChildElementHandler() { - public void childHanlded(DelegetingHandler child) { - } - }); - } - - } - - static class UpdateHandler extends DelegetingHandler { - - private static final String UPDATE = "update"; - - private static final String LABEL = "label"; - - private static final String URL = "url"; - - public UpdateHandler() { - super(UPDATE); - } - - protected void handleAttributes(Attributes atts) throws SAXException { - String label = atts.getValue(LABEL); - String url = atts.getValue(URL); - } - - } - - static class DiscoveryHandler extends DelegetingHandler { - - private static final String DISCOVERY = "discovery"; - - private static final String URL = "url"; - - private static final String LABEL = "label"; - - private static final String TYPE = "type"; - - public DiscoveryHandler() { - super(DISCOVERY); - } - - protected void handleAttributes(Attributes atts) throws SAXException { - String type = atts.getValue(TYPE); - String label = atts.getValue(LABEL); - String url = atts.getValue(URL); - } - - } + // private static class IncludesHandler extends DelegetingHandler { + // + // private static final String INCLUDES = "includes"; + // + // private static final String FILTER = "filter"; + // + // private static final String OPTIONAL = "optional"; + // + // private static final String VERSION = "version"; + // + // private static final String ID = "id"; + // + // public IncludesHandler() { + // super(INCLUDES); + // } + // + // protected void handleAttributes(Attributes atts) throws SAXException { + // String id = atts.getValue(ID); + // String version = atts.getValue(VERSION); + // String optional = atts.getValue(OPTIONAL); + // String filter = atts.getValue(FILTER); + // } + // + // } + + // private static class InstallHandlerHandler extends DelegetingHandler { + // + // private static final String INSTALL_HANDLER = "install-handler"; + // + // private static final String URL = "url"; + // + // private static final String LIBRARY = "library"; + // + // private static final String HANDLER = "handler"; + // + // public InstallHandlerHandler() { + // super(INSTALL_HANDLER); + // } + // + // protected void handleAttributes(Attributes atts) throws SAXException { + // String handler = atts.getValue(HANDLER); + // String library = atts.getValue(LIBRARY); + // String url = atts.getValue(URL); + // } + // + // } + + // private static class UrlHandler extends DelegetingHandler { + // + // private static final String URL = "url"; + // + // public UrlHandler() { + // super(URL); + // addChild(new UpdateHandler(), new ChildElementHandler<UpdateHandler>() { + // public void childHanlded(UpdateHandler child) { + // } + // }); + // addChild(new DiscoveryHandler(), new ChildElementHandler<DiscoveryHandler>() { + // public void childHanlded(DiscoveryHandler child) { + // } + // }); + // } + // + // } + + // private static class UpdateHandler extends DelegetingHandler { + // + // private static final String UPDATE = "update"; + // + // private static final String LABEL = "label"; + // + // private static final String URL = "url"; + // + // public UpdateHandler() { + // super(UPDATE); + // } + // + // protected void handleAttributes(Attributes atts) throws SAXException { + // String label = atts.getValue(LABEL); + // String url = atts.getValue(URL); + // } + // + // } + + // private static class DiscoveryHandler extends DelegetingHandler { + // + // private static final String DISCOVERY = "discovery"; + // + // private static final String URL = "url"; + // + // private static final String LABEL = "label"; + // + // private static final String TYPE = "type"; + // + // public DiscoveryHandler() { + // super(DISCOVERY); + // } + // + // protected void handleAttributes(Attributes atts) throws SAXException { + // String type = atts.getValue(TYPE); + // String label = atts.getValue(LABEL); + // String url = atts.getValue(URL); + // } + // + // } } Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/xml/UpdateSite.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/xml/UpdateSite.java?rev=1553872&r1=1553871&r2=1553872&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/xml/UpdateSite.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/xml/UpdateSite.java Sat Dec 28 16:54:23 2013 @@ -31,7 +31,7 @@ public class UpdateSite { private URI digestUri; - private List/* <EclipseFeature> */features = new ArrayList(); + private List<EclipseFeature> features = new ArrayList<EclipseFeature>(); public void setUri(URI uri) { this.uri = uri; @@ -61,7 +61,7 @@ public class UpdateSite { features.add(feature); } - public List getFeatures() { + public List<EclipseFeature> getFeatures() { return features; } Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/xml/UpdateSiteDigestParser.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/xml/UpdateSiteDigestParser.java?rev=1553872&r1=1553871&r2=1553872&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/xml/UpdateSiteDigestParser.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/xml/UpdateSiteDigestParser.java Sat Dec 28 16:54:23 2013 @@ -26,7 +26,7 @@ import javax.xml.parsers.ParserConfigura import org.apache.ivy.osgi.core.ExecutionEnvironmentProfileProvider; import org.apache.ivy.osgi.updatesite.UpdateSiteDescriptor; import org.apache.ivy.osgi.updatesite.xml.FeatureParser.FeatureHandler; -import org.apache.ivy.osgi.util.DelegetingHandler; +import org.apache.ivy.osgi.util.DelegatingHandler; import org.apache.ivy.util.XMLHelper; import org.xml.sax.SAXException; @@ -43,7 +43,7 @@ public class UpdateSiteDigestParser { return handler.repoDescriptor; } - static class DigestHandler extends DelegetingHandler { + static class DigestHandler extends DelegatingHandler { private static final String DIGEST = "digest"; @@ -53,9 +53,9 @@ public class UpdateSiteDigestParser { super(DIGEST); repoDescriptor = new UpdateSiteDescriptor(site.getUri(), ExecutionEnvironmentProfileProvider.getInstance()); - addChild(new FeatureHandler(), new ChildElementHandler() { - public void childHanlded(DelegetingHandler child) { - repoDescriptor.addFeature(((FeatureHandler) child).feature); + addChild(new FeatureHandler(), new ChildElementHandler<FeatureHandler>() { + public void childHanlded(FeatureHandler child) { + repoDescriptor.addFeature(child.feature); } }); } Copied: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/util/DelegatingHandler.java (from r1553741, ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/util/DelegetingHandler.java) URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/util/DelegatingHandler.java?p2=ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/util/DelegatingHandler.java&p1=ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/util/DelegetingHandler.java&r1=1553741&r2=1553872&rev=1553872&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/util/DelegetingHandler.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/util/DelegatingHandler.java Sat Dec 28 16:54:23 2013 @@ -18,7 +18,6 @@ package org.apache.ivy.osgi.util; import java.util.HashMap; -import java.util.Iterator; import java.util.Locale; import java.util.Map; @@ -32,16 +31,16 @@ import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; import org.xml.sax.helpers.DefaultHandler; -public class DelegetingHandler extends DefaultHandler implements DTDHandler, ContentHandler, +public class DelegatingHandler extends DefaultHandler implements DTDHandler, ContentHandler, ErrorHandler { - private DelegetingHandler/* <?> */delegate = null; + private DelegatingHandler delegate = null; - private DelegetingHandler/* <?> */parent; + DelegatingHandler parent; - private final Map/* <String, DelegetingHandler<?>> */saxHandlerMapping = new HashMap(); + private final Map<String, DelegatingHandler> saxHandlerMapping = new HashMap<String, DelegatingHandler>(); - private final Map/* <String, ChildElementHandler<?>> */childHandlerMapping = new HashMap(); + private final Map<String, ChildElementHandler<?>> childHandlerMapping = new HashMap<String, DelegatingHandler.ChildElementHandler<?>>(); private final String tagName; @@ -57,12 +56,13 @@ public class DelegetingHandler extends D private Locator locator; - public DelegetingHandler(String name) { + public DelegatingHandler(String name) { this.tagName = name; charBuffer.setLength(0); } - protected void addChild(DelegetingHandler saxHandler, ChildElementHandler elementHandler) { + protected <DH extends DelegatingHandler> void addChild(DH saxHandler, + ChildElementHandler<DH> elementHandler) { saxHandlerMapping.put(saxHandler.getName(), saxHandler); childHandlerMapping.put(saxHandler.getName(), elementHandler); saxHandler.parent = this; @@ -72,7 +72,7 @@ public class DelegetingHandler extends D return tagName; } - public DelegetingHandler getParent() { + public DelegatingHandler getParent() { return parent; } @@ -94,9 +94,7 @@ public class DelegetingHandler extends D public void setDocumentLocator(Locator locator) { this.locator = locator; - Iterator itHandler = saxHandlerMapping.values().iterator(); - while (itHandler.hasNext()) { - DelegetingHandler/* <?> */subHandler = (DelegetingHandler) itHandler.next(); + for (DelegatingHandler subHandler : saxHandlerMapping.values()) { subHandler.setDocumentLocator(locator); } } @@ -117,9 +115,7 @@ public class DelegetingHandler extends D public void skip() { skip = true; - Iterator itHandler = saxHandlerMapping.values().iterator(); - while (itHandler.hasNext()) { - DelegetingHandler/* <?> */subHandler = (DelegetingHandler) itHandler.next(); + for (DelegatingHandler subHandler : saxHandlerMapping.values()) { subHandler.stopDelegating(); } } @@ -128,9 +124,7 @@ public class DelegetingHandler extends D parent.delegate = null; skip = false; started = false; - Iterator itHandler = saxHandlerMapping.values().iterator(); - while (itHandler.hasNext()) { - DelegetingHandler/* <?> */subHandler = (DelegetingHandler) itHandler.next(); + for (DelegatingHandler/* <?> */subHandler : saxHandlerMapping.values()) { subHandler.stopDelegating(); } } @@ -220,7 +214,7 @@ public class DelegetingHandler extends D return; } // time now to delegate for a new element - delegate = (DelegetingHandler) saxHandlerMapping.get(localName); + delegate = (DelegatingHandler) saxHandlerMapping.get(localName); if (delegate != null) { skipOnError(new SkipOnErrorCallback() { public void call() throws SAXException { @@ -255,7 +249,7 @@ public class DelegetingHandler extends D public final void endElement(final String uri, final String localName, final String n) throws SAXException { if (delegate != null) { - final DelegetingHandler savedDelegate = delegate; + final DelegatingHandler savedDelegate = delegate; // we are already delegating, let's continue skipOnError(new SkipOnErrorCallback() { public void call() throws SAXException { @@ -264,12 +258,11 @@ public class DelegetingHandler extends D }); if (delegate == null) { // we just stopped delegating, it means that the child has ended - final ChildElementHandler childHandler = (ChildElementHandler) childHandlerMapping - .get(localName); + final ChildElementHandler<?> childHandler = childHandlerMapping.get(localName); if (childHandler != null) { skipOnError(new SkipOnErrorCallback() { public void call() throws SAXException { - childHandler.childHanlded(savedDelegate); + childHandler._childHanlded(savedDelegate); } }); } @@ -292,9 +285,15 @@ public class DelegetingHandler extends D // by default do nothing } - public static interface ChildElementHandler/* <DH extends DelegatingHandler> */{ + public static abstract class ChildElementHandler<DH extends DelegatingHandler> { - public void childHanlded(/* DH */DelegetingHandler child) throws SAXParseException; + public abstract void childHanlded(DH child) throws SAXParseException; + + // because we know what we're doing + @SuppressWarnings("unchecked") + private void _childHanlded(DelegatingHandler delegate) throws SAXParseException { + childHanlded((DH) delegate); + } } @@ -527,12 +526,9 @@ public class DelegetingHandler extends D return "[line " + locator.getLineNumber() + " col. " + locator.getColumnNumber() + "] "; } - private void skipOnError(DelegetingHandler/* <?> */currentHandler, Class/* - * <? extends - * delegatingHandler> - */handlerClassToSkip, - String message) { - DelegetingHandler/* <?> */handlerToSkip = currentHandler; + private void skipOnError(DelegatingHandler currentHandler, + Class<? extends DelegatingHandler> handlerClassToSkip, String message) { + DelegatingHandler handlerToSkip = currentHandler; while (!(handlerClassToSkip.isAssignableFrom(handlerToSkip.getClass()))) { handlerToSkip = handlerToSkip.getParent(); } Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/util/ParseUtil.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/util/ParseUtil.java?rev=1553872&r1=1553871&r2=1553872&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/util/ParseUtil.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/util/ParseUtil.java Sat Dec 28 16:54:23 2013 @@ -39,7 +39,7 @@ public class ParseUtil { value = ""; } - final List list = new ArrayList(); + final List<String> list = new ArrayList<String>(); final int CHAR = 1; final int DELIMITER = 2; Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/util/Version.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/util/Version.java?rev=1553872&r1=1553871&r2=1553872&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/util/Version.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/util/Version.java Sat Dec 28 16:54:23 2013 @@ -22,7 +22,7 @@ import java.text.ParseException; /** * Provides OSGi version support. */ -public class Version implements Comparable/* <Version> */{ +public class Version implements Comparable<Version> { private int major; @@ -88,17 +88,20 @@ public class Version implements Comparab try { major = Integer.parseInt(splits[0]); } catch (NumberFormatException e) { - throw new RuntimeException(new ParseException("Major part of an OSGi version should be an integer", 0)); + throw new RuntimeException(new ParseException( + "Major part of an OSGi version should be an integer", 0)); } try { minor = splits.length >= 2 ? Integer.parseInt(splits[1]) : 0; } catch (NumberFormatException e) { - throw new RuntimeException(new ParseException("Minor part of an OSGi version should be an integer", 0)); + throw new RuntimeException(new ParseException( + "Minor part of an OSGi version should be an integer", 0)); } try { patch = splits.length >= 3 ? Integer.parseInt(splits[2]) : 0; } catch (NumberFormatException e) { - throw new RuntimeException(new ParseException("Patch part of an OSGi version should be an integer", 0)); + throw new RuntimeException(new ParseException( + "Patch part of an OSGi version should be an integer", 0)); } qualifier = splits.length == 4 ? splits[3] : null; splitted = true; @@ -201,10 +204,6 @@ public class Version implements Comparab return 0; } - public int compareTo(Object obj) { - return compareTo((Version) obj); - } - public int compareTo(Version other) { ensureSplitted(); other.ensureSplitted(); Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/util/VersionComparator.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/util/VersionComparator.java?rev=1553872&r1=1553871&r2=1553872&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/util/VersionComparator.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/util/VersionComparator.java Sat Dec 28 16:54:23 2013 @@ -19,11 +19,11 @@ package org.apache.ivy.osgi.util; import java.util.Comparator; -public class VersionComparator implements Comparator/* <Version> */{ +public class VersionComparator implements Comparator<Version> { - public static final Comparator/* <Version> */ASCENDING = new VersionComparator(false); + public static final Comparator<Version> ASCENDING = new VersionComparator(false); - public static final Comparator/* <Version> */DESCENDING = new VersionComparator(true); + public static final Comparator<Version> DESCENDING = new VersionComparator(true); public final boolean reverse; @@ -31,10 +31,6 @@ public class VersionComparator implement this.reverse = reverse; } - public int compare(Object o1, Object o2) { - return compare((Version) o1, (Version) o1); - } - public int compare(Version objA, Version objB) { final int val = objA.compareTo(objB); return (reverse ? -val : val); Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/repo/BundleRepoTest.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/repo/BundleRepoTest.java?rev=1553872&r1=1553871&r2=1553872&view=diff ============================================================================== --- ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/repo/BundleRepoTest.java (original) +++ ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/repo/BundleRepoTest.java Sat Dec 28 16:54:23 2013 @@ -108,7 +108,7 @@ public class BundleRepoTest extends Test StreamResult stream = new StreamResult(out); hd.setResult(stream); - OBRXMLWriter.writeManifests(it.iterator(), hd, false); + OBRXMLWriter.writeManifests(it, hd, false); ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); BundleRepoDescriptor repo2 = OBRXMLParser.parse(bundlerepo.toURI(), in);
