# This patch file was generated by NetBeans IDE # Following Index: paths are relative to: /doma/jarda/netbeans-src # This patch can be applied using context Tools: Patch action on respective folder. # It uses platform neutral UTF-8 encoding and \n newlines. # Above lines and this line are ignored by the patching process. Index: ant/test/unit/src/org/apache/tools/ant/module/spi/AutomaticExtraClasspathTest.xml *** /doma/jarda/netbeans-src/ant/test/unit/src/org/apache/tools/ant/module/spi/AutomaticExtraClasspathTest.xml No Base Revision --- /doma/jarda/netbeans-src/ant/test/unit/src/org/apache/tools/ant/module/spi/AutomaticExtraClasspathTest.xml Locally New *************** *** 1,0 **** --- 1,23 ---- + + + + + + + + + + + + Index: libs/jsch/manifest.mf *** /doma/jarda/netbeans-src/libs/jsch/manifest.mf Base (1.6) --- /doma/jarda/netbeans-src/libs/jsch/manifest.mf Locally Modified (Based On 1.6) *************** *** 3,6 **** --- 3,7 ---- OpenIDE-Module-Localizing-Bundle: org/netbeans/libs/jsch/Bundle.properties OpenIDE-Module-Specification-Version: 1.5 OpenIDE-Module-Implementation-Version: 0.1.24 + OpenIDE-Module-Layer: org/netbeans/libs/jsch/mf-layer.xml Index: libs/jsch/nbproject/project.xml *** /doma/jarda/netbeans-src/libs/jsch/nbproject/project.xml Base (1.3) --- /doma/jarda/netbeans-src/libs/jsch/nbproject/project.xml Locally Modified (Based On 1.3) *************** *** 18,32 **** org.netbeans.libs.jsch - org.apache.tools.ant.module - - - - 3 - 3.22 - - - org.openide.modules --- 18,23 ---- Index: ant/api/doc/changes/apichanges.xml *** /doma/jarda/netbeans-src/ant/api/doc/changes/apichanges.xml Base (1.19) --- /doma/jarda/netbeans-src/ant/api/doc/changes/apichanges.xml Locally Modified (Based On 1.19) *************** *** 77,82 **** --- 77,101 ---- + + + Factory method to create AutomaticExtraClasspathProvider + + + + + +

+ AutomaticExtraClasspathProvider can now be + created in a declarative way. So libraries that wish to + provide such Ant extension may just do it in declarative + way without depending on AutomaticExtraClasspathProvider + class. +

+
+ + +
Index: ant/src/org/apache/tools/ant/module/spi/AutomaticExtraClasspathProvider.java *** /doma/jarda/netbeans-src/ant/src/org/apache/tools/ant/module/spi/AutomaticExtraClasspathProvider.java Base (1.3) --- /doma/jarda/netbeans-src/ant/src/org/apache/tools/ant/module/spi/AutomaticExtraClasspathProvider.java Locally Modified (Based On 1.3) *************** *** 22,27 **** --- 22,44 ---- * standard "optional" tasks that ship with Ant - e.g. junit.jar * as needed by the <junit> task. * Register instances to default lookup. + *

+ * Since version org.apache.tools.ant.module/3 3.18 there is a + * way to register a library declaratively: + *

+  * <filesystems>
+  *   <folder name="Services">
+  *     <folder name="Hidden">
+  *       <file name="org-your-lib-Ant-Registration.instance">
+  *         <attr name="instanceCreate" methodvalue="org.apache.tools.ant.module.spi.AutomaticExtraClasspath.url"/>
+  *         <attr name="url" urlvalue="nbinst:/modules/ext/org-your-lib.jar"/>
+  *       </file>
+  *     </folder>
+  *   </folder>
+  * </filesystems>
+  * 
+ * + * * @since org.apache.tools.ant.module/3 3.8 * @author Jesse Glick */ Index: ant/test/unit/src/org/apache/tools/ant/module/spi/AutomaticExtraClasspathTest.java *** /doma/jarda/netbeans-src/ant/test/unit/src/org/apache/tools/ant/module/spi/AutomaticExtraClasspathTest.java No Base Revision --- /doma/jarda/netbeans-src/ant/test/unit/src/org/apache/tools/ant/module/spi/AutomaticExtraClasspathTest.java Locally New *************** *** 1,0 **** --- 1,72 ---- + /* + * Sun Public License Notice + * + * The contents of this file are subject to the Sun Public License + * Version 1.0 (the "License"). You may not use this file except in + * compliance with the License. A copy of the License is available at + * http://www.sun.com/ + * + * The Original Code is NetBeans. The Initial Developer of the Original + * Code is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + */ + + package org.apache.tools.ant.module.spi; + + import junit.framework.TestCase; + import junit.framework.*; + import java.io.File; + import java.io.IOException; + import java.net.URL; + import java.util.Map; + import org.netbeans.junit.NbTestCase; + import org.openide.filesystems.FileObject; + import org.openide.filesystems.FileSystem; + import org.openide.filesystems.FileUtil; + import org.openide.filesystems.MultiFileSystem; + import org.openide.filesystems.URLMapper; + import org.openide.filesystems.XMLFileSystem; + + /** + * + * @author jarda + */ + public class AutomaticExtraClasspathTest extends NbTestCase { + private static URL wd; + + + FileObject fo; + + public AutomaticExtraClasspathTest(String testName) { + super(testName); + } + + protected void setUp() throws Exception { + URL u = getClass().getResource("AutomaticExtraClasspathTest.xml"); + FileSystem fs = new XMLFileSystem(u); + fo = fs.findResource("testAutoProvider"); + assertNotNull("There is the resource", fo); + } + + protected void tearDown() throws Exception { + } + + public static URL getWD() { + return wd; + } + + public void testReadWorkDir() throws Exception { + URL u = getWorkDir().toURI().toURL(); + wd = u; + + Object value = fo.getAttribute("instanceCreate"); + assertTrue("provider created: " + value, value instanceof AutomaticExtraClasspathProvider); + + AutomaticExtraClasspathProvider auto = (AutomaticExtraClasspathProvider)value; + File[] arr = auto.getClasspathItems(); + assertNotNull(arr); + assertEquals("One item", 1, arr.length); + assertEquals("It is our work dir", getWorkDir(), arr[0]); + } + + } Index: ant/src/org/apache/tools/ant/module/spi/AutomaticExtraClasspath.java *** /doma/jarda/netbeans-src/ant/src/org/apache/tools/ant/module/spi/AutomaticExtraClasspath.java No Base Revision --- /doma/jarda/netbeans-src/ant/src/org/apache/tools/ant/module/spi/AutomaticExtraClasspath.java Locally New *************** *** 1,0 **** --- 1,51 ---- + /* + * Sun Public License Notice + * + * The contents of this file are subject to the Sun Public License + * Version 1.0 (the "License"). You may not use this file except in + * compliance with the License. A copy of the License is available at + * http://www.sun.com/ + * + * The Original Code is NetBeans. The Initial Developer of the Original + * Code is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + */ + + package org.apache.tools.ant.module.spi; + + import java.io.File; + import java.io.IOException; + import java.net.URL; + import java.util.Map; + import org.openide.filesystems.FileObject; + import org.openide.filesystems.FileUtil; + import org.openide.filesystems.URLMapper; + + /** Factory method for urls. + * + * @author Jaroslav Tulach + */ + final class AutomaticExtraClasspath implements AutomaticExtraClasspathProvider { + private URL url; + + + private AutomaticExtraClasspath(URL url) { + this.url = url; + } + + public static AutomaticExtraClasspathProvider url(Map map) throws Exception { + Object obj = map.get("url"); // NOI18N + if (obj instanceof URL) { + return new AutomaticExtraClasspath((URL)obj); + } else { + throw new IOException("url arg is not URL: " + obj); // NOI18N + } + } + + public File[] getClasspathItems() { + FileObject fo = URLMapper.findFileObject(url); + File f = fo != null ? FileUtil.toFile(fo) : null; + + return f == null ? new File[0] : new File[] { f }; + } + } Index: libs/jsch/src/org/netbeans/libs/jsch/mf-layer.xml *** /doma/jarda/netbeans-src/libs/jsch/src/org/netbeans/libs/jsch/mf-layer.xml No Base Revision --- /doma/jarda/netbeans-src/libs/jsch/src/org/netbeans/libs/jsch/mf-layer.xml Locally New *************** *** 1,0 **** --- 1,27 ---- + + + + + + + + + + + + + + + +