ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hi...@apache.org
Subject svn commit: r1164098 - in /ant/ivy/core/trunk: doc/ doc/resolver/ doc/settings/ src/java/org/apache/ivy/core/settings/ src/java/org/apache/ivy/osgi/obr/ src/java/org/apache/ivy/osgi/updatesite/
Date Thu, 01 Sep 2011 14:53:41 GMT
Author: hibou
Date: Thu Sep  1 14:53:40 2011
New Revision: 1164098

URL: http://svn.apache.org/viewvc?rev=1164098&view=rev
Log:
Add a resolver to get modules from an Eclipse updatesite

Added:
    ant/ivy/core/trunk/doc/resolver/updatesite.html   (with props)
    ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/UpdateSiteResolver.java   (with
props)
Modified:
    ant/ivy/core/trunk/doc/resolver/obr.html
    ant/ivy/core/trunk/doc/settings/resolvers.html
    ant/ivy/core/trunk/doc/toc.json
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/typedef.properties
    ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/OBRResolver.java

Modified: ant/ivy/core/trunk/doc/resolver/obr.html
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/doc/resolver/obr.html?rev=1164098&r1=1164097&r2=1164098&view=diff
==============================================================================
--- ant/ivy/core/trunk/doc/resolver/obr.html (original)
+++ ant/ivy/core/trunk/doc/resolver/obr.html Thu Sep  1 14:53:40 2011
@@ -47,6 +47,10 @@ This resolver shares the <a href="../set
         <td>Yes</td></tr>
     <tr><td>requirementStrategy</td><td>defines how strict should
be the OSGi resolution. Can be one of <tt>first</tt> or <tt>noambiguity</tt></td>
         <td>No, default to <tt>noambiguity</tt></td></tr>
+    <tr><td>metadataTtl</td><td>the time in milliseconds the obr.xml
is considered up to date</td>
+        <td>No, default to 3600000 (1 hour)</td></tr>
+    <tr><td>forceMetadataUpdate</td><td>force the update of the obr.xml
without checking its freshness</td>
+        <td>No, default to false</td></tr>
 </tbody>
 </table>
 

Added: ant/ivy/core/trunk/doc/resolver/updatesite.html
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/doc/resolver/updatesite.html?rev=1164098&view=auto
==============================================================================
--- ant/ivy/core/trunk/doc/resolver/updatesite.html (added)
+++ ant/ivy/core/trunk/doc/resolver/updatesite.html Thu Sep  1 14:53:40 2011
@@ -0,0 +1,72 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<!--
+   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.    
+-->
+<html>
+<head>
+	<script type="text/javascript">var xookiConfig = {level: 1};</script>	
+	<script type="text/javascript" src="../xooki/xooki.js"></script>
+</head>
+<body>
+	<textarea id="xooki-source">
+<table class="resolver">
+<tr><td class="title">Tag</td><td class="value">updatesite</td></tr>
+<tr><td class="title">Handle latest</td><td class="value">yes</td></tr>
+<tr><td class="title">Handle publish</td><td class="value">no</td></tr>
+</table>
+
+<span class="since">since 2.3</span>
+
+<span class="tagdoc" id="ivysettings.resolvers.updatesite">This resolver is one of
the resolver which supports <a href="../osgi.html">OSGi&#153;</a> dependencies.
+It resolves modules (OSGi bundles) which are hosted in an Eclipse&#153; update site.
+
+This resolver supports old style Eclipse updatesite, based on simply a site.xml. It also
supports Eclipse P2 repositories.
+
+<h1>Attributes</h1>
+This resolver shares the <a href="../settings/resolvers.html#common">common attributes</a>
of composite resolvers.
+<table class="ivy-attributes">
+<thead>
+    <tr><th class="ivy-att">Attribute</th><th class="ivy-att-desc">Description</th><th
class="ivy-att-req">Required</th></tr>
+</thead>
+<tbody>
+    <tr><td>url</td><td>the URL of the Eclipse updatesite</td>
+        <td>Yes</td></tr>
+    <tr><td>requirementStrategy</td><td>defines how strict should
be the OSGi resolution. Can be one of <tt>first</tt> or <tt>noambiguity</tt></td>
+        <td>No, default to <tt>noambiguity</tt></td></tr>
+    <tr><td>metadataTtl</td><td>the time in milliseconds the updatesite
metadata are considered up to date</td>
+        <td>No, default to 3600000 (1 hour)</td></tr>
+    <tr><td>forceMetadataUpdate</td><td>force the update of the updatesite
metadata without checking their freshness</td>
+        <td>No, default to false</td></tr>
+</tbody>
+</table>
+
+The requirement strategy is defining how the resolver should behave in front of several choices.
In the OSGi dependency model, an <tt>Import-Package</tt> requirement can be satisfied
by several different bundles. So when resolving such requirement, Ivy will first look into
the already resolved bundles if one provides that package. If it fails to find one, then two
behaviours can occur:
+<ul>
+<li>if the requirement strategy is <tt>first</tt>, among the bundles statifying
the requirement, it will shoose the first one. A warn will be logged ahout the choice Ivy
has to arbitrarily do.</li>
+<li>if the requirement strategy is <tt>noambiguity</tt>, Ivy will make
the resolution fail.</li>
+</ul>
+
+<h1>Examples</h1>
+<code type="xml">
+<updatesite name="ivyde-updatesite" url="http://www.apache.org/dist/ant/ivyde/updatesite"
/>
+</code>
+A simple repository configured to load the Apache IvyDE Eclipse update site.
+	</textarea>
+<script type="text/javascript">xooki.postProcess();</script>
+</body>
+</html>

Propchange: ant/ivy/core/trunk/doc/resolver/updatesite.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/core/trunk/doc/resolver/updatesite.html
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: ant/ivy/core/trunk/doc/resolver/updatesite.html
------------------------------------------------------------------------------
    svn:mime-type = text/html

Modified: ant/ivy/core/trunk/doc/settings/resolvers.html
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/doc/settings/resolvers.html?rev=1164098&r1=1164097&r2=1164098&view=diff
==============================================================================
--- ant/ivy/core/trunk/doc/settings/resolvers.html (original)
+++ ant/ivy/core/trunk/doc/settings/resolvers.html Thu Sep  1 14:53:40 2011
@@ -70,6 +70,8 @@ Here is the list of built-in resolvers:
 <tr><td><a href="../resolver/sftp.html">sftp</a></td><td>Standard</td><td>Finds
ivy files and artifacts in any repository accessible with sftp.</td></tr>
 <tr><td><a href="../resolver/chain.html">Chain</a></td><td>Composite</td><td>Delegates
the finding to a chain of sub resolvers.</td></tr>
 <tr><td><a href="../resolver/dual.html">Dual</a></td><td>Composite</td><td>Delegates
the finding of ivy files to one resolver and of artifacts to another.</td></tr>
+<tr><td><a href="../resolver/obr.html">OBR</a></td><td>Standard</td><td>Resolve
modules as OSGi bundles listed by an OSGi obr.xml.</td></tr>
+<tr><td><a href="../resolver/updatesite.html">Eclipse updatesite</a></td><td>Standard</td><td>Resolve
modules as OSGi bundles which are hosted on an Eclipse update site.</td></tr>
 </tbody>
 </table>
 

Modified: ant/ivy/core/trunk/doc/toc.json
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/doc/toc.json?rev=1164098&r1=1164097&r2=1164098&view=diff
==============================================================================
--- ant/ivy/core/trunk/doc/toc.json (original)
+++ ant/ivy/core/trunk/doc/toc.json Thu Sep  1 14:53:40 2011
@@ -372,6 +372,13 @@
                                   ]
                               },
                               {
+                                "id":"resolver/updatesite",
+                                "title":"Eclipse updatesite",
+                                "children": [
+
+                                  ]
+                              },
+                              {
                                 "id":"resolver/mirrored",
                                 "title":"Mirrored Resolver",
                                 "children": [

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/typedef.properties
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/typedef.properties?rev=1164098&r1=1164097&r2=1164098&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/typedef.properties (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/typedef.properties Thu Sep  1
14:53:40 2011
@@ -30,6 +30,7 @@ cache		= org.apache.ivy.plugins.resolver
 packager	= org.apache.ivy.plugins.resolver.packager.PackagerResolver
 obr         = org.apache.ivy.osgi.obr.OBRResolver
 mirroredurl = org.apache.ivy.plugins.resolver.MirroredURLResolver
+updatesite  = org.apache.ivy.osgi.updatesite.UpdateSiteResolver
 
 latest-revision = org.apache.ivy.plugins.latest.LatestRevisionStrategy
 latest-lexico   = org.apache.ivy.plugins.latest.LatestLexicographicStrategy

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/OBRResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/OBRResolver.java?rev=1164098&r1=1164097&r2=1164098&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/OBRResolver.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/OBRResolver.java Thu Sep  1 14:53:40
2011
@@ -42,6 +42,10 @@ public class OBRResolver extends RepoDes
 
     private String repoXmlFile;
 
+    private Long metadataTtl;
+
+    private Boolean forceMetadataUpdate;
+
     public void setRepoXmlFile(String repositoryXmlFile) {
         this.repoXmlFile = repositoryXmlFile;
     }
@@ -50,6 +54,14 @@ public class OBRResolver extends RepoDes
         this.repoXmlURL = repositoryXmlURL;
     }
 
+    public void setMetadataTtl(Long metadataTtl) {
+        this.metadataTtl = metadataTtl;
+    }
+
+    public void setForceMetadataUpdate(Boolean forceMetadataUpdate) {
+        this.forceMetadataUpdate = forceMetadataUpdate;
+    }
+
     protected void init() {
         if (repoXmlFile != null && repoXmlURL != null) {
             throw new RuntimeException("The OBR repository resolver " + getName()
@@ -95,6 +107,12 @@ public class OBRResolver extends RepoDes
                 }
                 Resource obrResource = new URLResource(url);
                 CacheResourceOptions options = new CacheResourceOptions();
+                if (metadataTtl != null) {
+                    options.setTtl(metadataTtl.longValue());
+                }
+                if (forceMetadataUpdate != null) {
+                    options.setForce(forceMetadataUpdate.booleanValue());
+                }
                 report = getRepositoryCacheManager().downloadRepositoryResource(obrResource,
"obr",
                     "obr", "xml", options, repo);
             } finally {

Added: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/UpdateSiteResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/UpdateSiteResolver.java?rev=1164098&view=auto
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/UpdateSiteResolver.java (added)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/UpdateSiteResolver.java Thu
Sep  1 14:53:40 2011
@@ -0,0 +1,72 @@
+/*
+ *  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.updatesite;
+
+import java.io.IOException;
+import java.text.ParseException;
+
+import org.apache.ivy.core.cache.CacheResourceOptions;
+import org.apache.ivy.osgi.repo.RepoDescriptorBasedResolver;
+import org.xml.sax.SAXException;
+
+public class UpdateSiteResolver extends RepoDescriptorBasedResolver {
+
+    private String url;
+
+    private Long metadataTtl;
+
+    private Boolean forceMetadataUpdate;
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    public void setMetadataTtl(Long metadataTtl) {
+        this.metadataTtl = metadataTtl;
+    }
+
+    public void setForceMetadataUpdate(Boolean forceMetadataUpdate) {
+        this.forceMetadataUpdate = forceMetadataUpdate;
+    }
+
+    protected void init() {
+        if (url == null) {
+            throw new RuntimeException("Missing url");
+        }
+        CacheResourceOptions options = new CacheResourceOptions();
+        if (metadataTtl != null) {
+            options.setTtl(metadataTtl.longValue());
+        }
+        if (forceMetadataUpdate != null) {
+            options.setForce(forceMetadataUpdate.booleanValue());
+        }
+        UpdateSiteLoader loader = new UpdateSiteLoader(getRepositoryCacheManager(),
+                getEventManager(), options);
+        String u = url.endsWith("/") ? url : (url + "/");
+        try {
+            loader.load(u);
+        } catch (IOException e) {
+            throw new RuntimeException("IO issue while trying to read the update site ("
+                    + e.getMessage() + ")");
+        } catch (ParseException e) {
+            throw new RuntimeException("Failed to parse the updatesite (" + e.getMessage()
+ ")");
+        } catch (SAXException e) {
+            throw new RuntimeException("Illformed updatesite (" + e.getMessage() + ")");
+        }
+    }
+}

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

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

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



Mime
View raw message