|
What this is
Other links
The source code/* * 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-2003 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.nbbuild; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.taskdefs.MatchingTask; import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.Project; import java.io.File; import java.util.Vector; /** Makes an XML file representing update information from NBMs. * * @author Jesse Glick */ public class MakeUpdateDesc extends MatchingTask { protected boolean usedMatchingTask = false; /** Set of NBMs presented as a folder in the Update Center. */ public /*static*/ class Group { public Vector nbms = new Vector (); public Vector filesets = new Vector (); public Vector scanners = new Vector (); public String name; /** Displayed name of the group. */ public void setName (String s) { name = s; } /** Add fileset to the group of NetBeans modules **/ public void addFileSet (FileSet set) { filesets.add(set); } } /** pointer to another xml entity to include **/ public class Entityinclude { public String file; /** Path to the entity file. * It included as an xml-entity pointer in master .xml file. */ public void setFile (String f) { file = f; } } private Vector entityincludes = new Vector(); private Vector groups = new Vector (); private Vector filesets = new Vector (); private String desc_name; private File desc; private File desc_ent; /** Description file to create. */ public void setDesc (String d) { desc_name = d; desc = new File (desc_name); } /** Module group to create **/ public Group createGroup () { Group g = new Group (); groups.add (g); return g; } /** External XML entity include **/ public Entityinclude createEntityinclude () { Entityinclude i = new Entityinclude (); entityincludes.add (i); return i; } /** * Adds a set of files (nested fileset attribute). */ public void addFileset(FileSet set) { filesets.addElement(set); } private String dist_base; /** * Set distribution base, which will be enforced */ public void setDistBase(String dbase) { dist_base = dbase; } // Similar to org.openide.xml.XMLUtil methods. private static String xmlEscape(String s) { int max = s.length(); StringBuffer s2 = new StringBuffer((int)(max * 1.1 + 1)); for (int i = 0; i < max; i++) { char c = s.charAt(i); switch (c) { case '<': s2.append("<"); //NOI18N break; case '>': s2.append(">"); //NOI18N break; case '&': s2.append("&"); //NOI18N break; case '"': s2.append("""); //NOI18N break; default: s2.append(c); break; } } return s2.toString(); } public void execute () throws BuildException { Group root = new Group(); root.setName("root"); //NOI18N for (int i=0; i < filesets.size(); i++) { root.addFileSet((FileSet) filesets.elementAt(i)); } groups.addElement(root); if (desc.exists ()) { // Simple up-to-date check. long time = desc.lastModified (); boolean uptodate = true; CHECK: for (int i=0; i |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.