You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nutch.apache.org by je...@apache.org on 2005/09/05 18:57:32 UTC

svn commit: r278797 - /lucene/nutch/trunk/src/java/org/apache/nutch/plugin/PluginManifestParser.java

Author: jerome
Date: Mon Sep  5 09:57:27 2005
New Revision: 278797

URL: http://svn.apache.org/viewcvs?rev=278797&view=rev
Log:
Add support for runtime inter plugin dependencies (using requires section)

Modified:
    lucene/nutch/trunk/src/java/org/apache/nutch/plugin/PluginManifestParser.java

Modified: lucene/nutch/trunk/src/java/org/apache/nutch/plugin/PluginManifestParser.java
URL: http://svn.apache.org/viewcvs/lucene/nutch/trunk/src/java/org/apache/nutch/plugin/PluginManifestParser.java?rev=278797&r1=278796&r2=278797&view=diff
==============================================================================
--- lucene/nutch/trunk/src/java/org/apache/nutch/plugin/PluginManifestParser.java (original)
+++ lucene/nutch/trunk/src/java/org/apache/nutch/plugin/PluginManifestParser.java Mon Sep  5 09:57:27 2005
@@ -189,7 +189,33 @@
         parseExtension(rootElement, pluginDescriptor);
         parseExtensionPoints(rootElement, pluginDescriptor);
         parseLibraries(rootElement, pluginDescriptor);
+        parseRequires(rootElement, pluginDescriptor);
         return pluginDescriptor;
+    }
+
+    /**
+     * @param pRootElement
+     * @param pDescriptor
+     * @throws MalformedURLException
+     */
+    private static void parseRequires(Element pRootElement,
+                                      PluginDescriptor pDescriptor)
+        throws MalformedURLException {
+      
+        NodeList nodelist = pRootElement.getElementsByTagName("requires");
+        if (nodelist.getLength() > 0) {
+
+            Element requires = (Element) nodelist.item(0);
+
+            NodeList imports = requires.getElementsByTagName("import");
+            for (int i=0; i<imports.getLength(); i++) {
+                Element anImport = (Element) imports.item(i);
+                String plugin = anImport.getAttribute("plugin");
+                if (plugin != null) {
+                  pDescriptor.addDependency(plugin);
+                }
+            }
+        }
     }
 
     /**