From: <ox-...@us...> - 2003-01-17 22:43:17
|
Update of /cvsroot/sheets/sheets In directory sc8-pr-cvs1:/tmp/cvs-serv19415 Modified Files: Sheets.sheets build.xml todo.txt Log Message: Fixed the bytecode support so that it handles jar classpaths Updated version of bcel.jar Fixed import and export of DocDocument fragments to/from the dump file Documents now export proper xml headers, and import public references properly. Greatly improved performance of deleting large number of fragments Index: Sheets.sheets =================================================================== RCS file: /cvsroot/sheets/sheets/Sheets.sheets,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** Sheets.sheets 23 Dec 2002 13:39:31 -0000 1.30 --- Sheets.sheets 17 Jan 2003 22:42:33 -0000 1.31 *************** *** 1128,1135 **** g.setColor(new Color(c.getRed(), c.getGreen(), c.getBlue(), 80)); g.drawRect(0, 1, width(), baseHeight() - 1); ! g.setColor(new Color(c.getRed(), c.getGreen(), c.getBlue(), 60)); g.drawRect(1, 2, width() - 1, baseHeight() - 2); - g.setColor(new Color(c.getRed(), c.getGreen(), c.getBlue(), 20)); - g.drawRect(2, 3, width() - 2, baseHeight() - 3); } object nkramer:92 --- 1128,1133 ---- g.setColor(new Color(c.getRed(), c.getGreen(), c.getBlue(), 80)); g.drawRect(0, 1, width(), baseHeight() - 1); ! g.setColor(new Color(c.getRed(), c.getGreen(), c.getBlue(), 40)); g.drawRect(1, 2, width() - 1, baseHeight() - 2); } object nkramer:92 *************** *** 5164,5167 **** --- 5162,5166 ---- import javax.swing.*; import java.util.*; + import java.util.jar.*; import java.io.*; import java.util.regex.*; *************** *** 10336,10340 **** } ! Vector results = sortResults(doFullSearch(possibilities)); Fragment[] res = new Fragment[results.size()]; --- 10335,10341 ---- } ! Vector results = possibilities.size() == 0 ? possibilities : doFullSearch(possibilities); ! if (results.size() > 1) ! results = sortResults(results); Fragment[] res = new Fragment[results.size()]; *************** *** 15542,15552 **** Font oldFont = g.getFont(); - // The oldClip stuff should do the right thing, and would be much more efficient - // than creating and disposing Graphics objects. Alas, at least one VM (SDK2.0) - // seems to do the wrong thing. Bummer. - // NOTE: Putting back the oldClip stuff to try it out... if this works, delete these comments Shape oldClip = null; if (leftSide > 0) { - // g = (Graphics2D)g.create(); oldClip = g.getClip(); g.setClip(0, 0, width(), height()); --- 15543,15548 ---- *************** *** 15571,15575 **** g.translate(leftSide, 0); g.setClip(oldClip); - // g.dispose(); } } --- 15567,15570 ---- *************** *** 31512,31516 **** return DocSource.loadSource(reader); else if (type.equals("doc-document")) ! return DocSection.loadSection(reader); else if (type.equals("doc-section")) return DocSection.loadSection(reader); --- 31507,31511 ---- return DocSource.loadSource(reader); else if (type.equals("doc-document")) ! return DocDocument.loadDocument(reader); else if (type.equals("doc-section")) return DocSection.loadSection(reader); *************** *** 32474,32480 **** throws IOException { - writer.putAttribute("type", getArchivalType()); writer.putAttribute("ordered", (isOrdered) ? "true" : "false"); ! writeText(writer); } object nkramer:30835 --- 32469,32474 ---- throws IOException { writer.putAttribute("ordered", (isOrdered) ? "true" : "false"); ! super.saveCoreInfo(writer); } object nkramer:30835 *************** *** 32600,32603 **** --- 32594,32602 ---- throws IOException { + // write the XML header + file.println("<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>"); + file.println("<!DOCTYPE document PUBLIC \\"-//APACHE//DTD Documentation V1.1//EN\\">"); + file.println(""); + file.beginFragment(this, extraIndentation); file.println("<document" + DocHelper.attributeList(this) + ">"); *************** *** 48797,48800 **** --- 48796,48800 ---- protected Vector JavaFragmentUsesQuery.quickSearch () { + Vector result = null; int searchFor = JSTNode.ANYTHING_REFERENCED; if (target instanceof JavaMethodFragment) *************** *** 48803,48807 **** searchFor = JSTNode.FIELDS_REFERENCED; else if (target instanceof JavaClassFragment) { ! Vector result = new Vector(); VectorUtils.append(result, JavaSentinel.lookup(target.simpleName(), JSTNode.CLASSES_REFERENCED)); --- 48803,48807 ---- searchFor = JSTNode.FIELDS_REFERENCED; else if (target instanceof JavaClassFragment) { ! result = new Vector(); VectorUtils.append(result, JavaSentinel.lookup(target.simpleName(), JSTNode.CLASSES_REFERENCED)); *************** *** 48809,48816 **** JavaSentinel.lookup(target.simpleName(), JSTNode.CONSTRUCTORS_REFERENCED)); - return result; } else if (target instanceof JavaConstructorFragment) { // We have to deal with the weird "super()" and "this()" constructs ! Vector result = new Vector(); VectorUtils.append(result, JavaSentinel.lookup(target.simpleName(), JSTNode.CONSTRUCTORS_REFERENCED)); --- 48809,48815 ---- JavaSentinel.lookup(target.simpleName(), JSTNode.CONSTRUCTORS_REFERENCED)); } else if (target instanceof JavaConstructorFragment) { // We have to deal with the weird "super()" and "this()" constructs ! result = new Vector(); VectorUtils.append(result, JavaSentinel.lookup(target.simpleName(), JSTNode.CONSTRUCTORS_REFERENCED)); *************** *** 48833,48839 **** } } - return result; } ! return JavaSentinel.lookup(target.simpleName(), searchFor); } object rgs:2256 --- 48832,48839 ---- } } } ! if (result == null) ! result = JavaSentinel.lookup(target.simpleName(), searchFor); ! return result; } object rgs:2256 *************** *** 52346,52351 **** mayBeDeadFrags.setSize(0); ! for (int i = 0; i < sentinels.size(); i++) ((Sentinel)sentinels.get(i)).finalizeEvents(); // Hack: Calling "displayBatchedMessages" is not logically part of our job, --- 52346,52352 ---- mayBeDeadFrags.setSize(0); ! for (int i = 0; i < sentinels.size(); i++) { ((Sentinel)sentinels.get(i)).finalizeEvents(); + } // Hack: Calling "displayBatchedMessages" is not logically part of our job, *************** *** 59035,59038 **** --- 59036,59042 ---- static boolean JavaFragmentUsesQuery.fragmentUses (JavaFragment comp, JavaFragment target) { + // huge optimization on deleting large number of fragments together + if (target.planeOfExistence() < Fragment.IN_THE_PROGRAM) return false; + String name = target.simpleName(); JavaClassInterface context = comp.enclosingClass(); *************** *** 62006,62010 **** for (int i = deleted.size() - 1; i >= 0; i--) { Fragment oldFrag = (Fragment)deleted.elementAt(i); ! Fragment newFrag = oldFrag.sameInterface(added); if (newFrag != null) { pairedReplacements.addElement(oldFrag); --- 62010,62014 ---- for (int i = deleted.size() - 1; i >= 0; i--) { Fragment oldFrag = (Fragment)deleted.elementAt(i); ! Fragment newFrag = added.size() == 0 ? null : oldFrag.sameInterface(added); if (newFrag != null) { pairedReplacements.addElement(oldFrag); *************** *** 62015,62019 **** Vector possibilities = oldFrag.affectedBy(); int count = 0; ! if (possibilities != null) for (int j = 0; j < possibilities.size(); j++) { if (onlyReportAffectedIfModifiedSinceUpdate --- 62019,62023 ---- Vector possibilities = oldFrag.affectedBy(); int count = 0; ! if (possibilities != null) { for (int j = 0; j < possibilities.size(); j++) { if (onlyReportAffectedIfModifiedSinceUpdate *************** *** 62028,62031 **** --- 62032,62036 ---- affected.addElement(possibilities.elementAt(j)); } + } } } *************** *** 62151,62155 **** ((JavaClassFragment)cls).setClassDirty(); } ! return VectorUtils.make(calls); } object rgs:12187 --- 62156,62161 ---- ((JavaClassFragment)cls).setClassDirty(); } ! Vector result = VectorUtils.make(calls); ! return result; } object rgs:12187 *************** *** 62182,62186 **** ((JavaClassFragment)cls).setClassDirty(); } ! return VectorUtils.make(calls); } object rgs:12189 --- 62188,62193 ---- ((JavaClassFragment)cls).setClassDirty(); } ! Vector result = VectorUtils.make(calls); ! return result; } object rgs:12189 *************** *** 72041,72047 **** try { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - // turn this back on later? - dbf.setValidating(false); builder = dbf.newDocumentBuilder(); } catch (ParserConfigurationException e) { Console.internalError(e); --- 72048,72061 ---- try { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); builder = dbf.newDocumentBuilder(); + // need to generalize this to select different language experts + builder.setEntityResolver(new org.xml.sax.EntityResolver() { + public org.xml.sax.InputSource resolveEntity(String publicId, String systemId) { + if (publicId.equals("-//APACHE//DTD Documentation V1.1//EN")) { + return new org.xml.sax.InputSource(this.getClass().getResourceAsStream("dtd/document-v11.dtd")); + } + return null; + } + }); } catch (ParserConfigurationException e) { Console.internalError(e); *************** *** 81476,81479 **** --- 81490,81498 ---- section exports schin:1057 schin:1060 + schin:1207 + schin:1208 + schin:1209 + schin:1210 + schin:1211 schin:1058 object schin:1058 *************** *** 81483,81490 **** public static JavaRepositoryHelper JavaRepositorySet.getRepositoryHelper (String classpath) { ! // note: this is not 100% accurate since the bootstrap classloader should always be prepended ! String systemClassPath = ClassPath.getClassPath(); ! classpath = systemClassPath + File.pathSeparator + classpath; ! System.out.println("classpath is: " + classpath); for (Iterator i=repositories.iterator(); i.hasNext(); ) { --- 81502,81508 ---- public static JavaRepositoryHelper JavaRepositorySet.getRepositoryHelper (String classpath) { ! String bootstrapClasspath = getBootstrapClasspath(); ! classpath = bootstrapClasspath + File.pathSeparator + classpath; ! classpath = expandManifestClasspaths(classpath); for (Iterator i=repositories.iterator(); i.hasNext(); ) { *************** *** 81815,81818 **** --- 81833,81837 ---- schin:1108 schin:1109 + schin:1212 schin:1105 schin:1106 *************** *** 81876,81880 **** type=java section text schin:1109 ! static Fragment DocDocument.loadSection (FragmentReader reader) throws IOException { --- 81895,81899 ---- type=java section text schin:1109 ! static Fragment DocDocument.loadDocument (FragmentReader reader) throws IOException { *************** *** 81885,81889 **** } catch (Error e) { } String title = reader.getAttribute("title"); ! return new DocDocument(State.getObjectDatabase(), title, null, null); } object schin:1110 --- 81904,81910 ---- } catch (Error e) { } String title = reader.getAttribute("title"); ! DocDocument document = new DocDocument(State.getObjectDatabase(), title, null, null); ! document.filename = reader.getAttribute("filename"); ! return document; } object schin:1110 *************** *** 82818,82821 **** --- 82839,82953 ---- section text schin:1206 public static boolean Profile.graphicsAntialiasing; + object schin:1207 + pkg=org.browsecode.javaStuff + type=java + section text schin:1207 + // Converts a single path string into a list of strings by breaking it apart on the + // path separators. If a null list is passed in, a new one will be created. + static ArrayList JavaRepositorySet.pathToList (String path, ArrayList list) { + if (list == null) + list = new ArrayList(); + StringTokenizer st = new StringTokenizer(path, File.pathSeparator); + while (st.hasMoreTokens()) { + String fileName = st.nextToken(); + if (new File(fileName).exists()) + list.add(fileName); + } + return list; + } + object schin:1208 + pkg=org.browsecode.javaStuff + type=java + section text schin:1208 + // Converts a list of strings to a single path string by concatenating the list + // using the path separator. If a null StringBuffer is passed in, a new one will be created. + static StringBuffer JavaRepositorySet.listToPath (ArrayList list, StringBuffer result) { + if (result == null) + result = new StringBuffer(); + for (Iterator i = list.iterator(); i.hasNext(); ) { + if (result.length() > 0) + result.append(File.pathSeparatorChar); + result.append((String)i.next()); + } + return result; + } + object schin:1209 + pkg=org.browsecode.javaStuff + type=java + section text schin:1209 + // Recursively traverses from the given directory and adds all files with a + // *.jar or *.zip extension to the given list. + private static void JavaRepositorySet.extractJarsAndZips(File directory, ArrayList jarsAndZips) { + File[] files = directory.listFiles(); + for (int i=0; i<files.length; i++) { + if (files[i].isDirectory()) { + extractJarsAndZips(directory, jarsAndZips); + continue; + } + String name = files[i].getAbsolutePath(); + if (name.endsWith(".zip") || name.endsWith(".jar")) + jarsAndZips.add(name); + } + } + object schin:1210 + pkg=org.browsecode.javaStuff + type=java + section text schin:1210 + // Returns the bootstrap classpath with the ext.dirs properly expanded + static String JavaRepositorySet.getBootstrapClasspath () { + String extPath = System.getProperty("java.ext.dirs"); + String bootPath = System.getProperty("sun.boot.class.path"); + + ArrayList pathEntries = new ArrayList(); + ArrayList extDirs = pathToList(extPath, null); + for (Iterator i = extDirs.iterator(); i.hasNext(); ) { + File extDir = new File((String)i.next()); + extractJarsAndZips(extDir, pathEntries); + } + pathToList(bootPath, pathEntries); + + return listToPath(pathEntries, null).toString(); + } + object schin:1211 + pkg=org.browsecode.javaStuff + type=java + section text schin:1211 + // Work around a bug in BCEL where the manifest classpath is never searched + static String JavaRepositorySet.expandManifestClasspaths (String classpath) { + StringBuffer newClasspath = new StringBuffer(classpath); + ArrayList list = pathToList(classpath, null); + for (Iterator i=list.iterator(); i.hasNext(); ) { + String file = (String)i.next(); + if (file.endsWith(".zip") || file.endsWith(".jar")) try { + Manifest manifest = new JarFile(file).getManifest(); + Attributes attributes = manifest.getMainAttributes(); + if (attributes.containsKey(Attributes.Name.CLASS_PATH)) { + String rawPath = attributes.getValue(Attributes.Name.CLASS_PATH); + StringTokenizer st = new StringTokenizer(rawPath, " "); + while (st.hasMoreTokens()) { + File dep = new File(new File(file).getParent(), st.nextToken()); + if (dep.exists()) { + newClasspath.append(File.pathSeparatorChar); + newClasspath.append(dep.getAbsolutePath()); + } + } + } + } catch (IOException e) { + // ignore any exceptions + e.printStackTrace(); + } + } + return newClasspath.toString(); + } + object schin:1212 + pkg=org.browsecode.xml + type=java + section text schin:1212 + protected void DocDocument.saveCoreInfo (FragmentWriter writer) + throws IOException + { + writer.putAttribute("filename", filename); + super.saveCoreInfo(writer); + } object sjc:1 pkg=org.browsecode.sheets.dicer *************** *** 88156,88161 **** // Do the actual removing ! for (int i = 0; i < comps.length; i++) comps[i].getFragment().destroy(); } object wlott:812 --- 88288,88294 ---- // Do the actual removing ! for (int i = 0; i < comps.length; i++) { comps[i].getFragment().destroy(); + } } object wlott:812 *************** *** 88659,88663 **** // Also called by CC.unlinkedFromRoot. // ! // Remeber that a fragment can be in a list more than once, so being // removed from a list doesn't always mean that it can't still be our link // to root. --- 88792,88796 ---- // Also called by CC.unlinkedFromRoot. // ! // Remember that a fragment can be in a list more than once, so being // removed from a list doesn't always mean that it can't still be our link // to root. *************** *** 88756,88767 **** } } ! // If we didn't make it all the way to the root, then the parent's ! // claim to have a linkToRoot is dubious, but might still be correct ! // even if the current value no longer works. ! if (container.getOwner().considerAlternateLinks(unusable)) { ! linkToRootID = container.getArchivalReference(); ! stateChanged(); ! return true; ! } } } --- 88889,88894 ---- } } ! // We used to ask the owner as well, however, this was dubious ! // and lead to exponentially bad performance on large deletions. } } *************** *** 100824,100827 **** --- 100951,100955 ---- schin:1108 schin:1109 + schin:1212 ram:2244 schin:1105 *************** *** 102067,102071 **** nkramer:28438 object ram:2144 ! classpath=${classpath} project=Sheets root=src/java --- 102195,102199 ---- nkramer:28438 object ram:2144 ! classpath=${java.class.path} project=Sheets root=src/java *************** *** 102164,102167 **** --- 102292,102296 ---- ram:2490 object ram:2493 + filename=../documentation/content/xdocs/reference.xml title=Reference Manual type=doc-document *************** *** 103318,103321 **** --- 103447,103451 ---- ram:2881 object ram:2895 + filename=../documentation/content/xdocs/versioning.xml title=Versioning and the Repository type=doc-document *************** *** 105389,105392 **** --- 105519,105523 ---- rgs:13568 object rgs:13583 + filename=../documentation/content/xdocs/architecture.xml title=Architectural Overview type=doc-document *************** *** 106567,106570 **** --- 106698,106706 ---- schin:1057 schin:1060 + schin:1207 + schin:1208 + schin:1209 + schin:1210 + schin:1211 schin:1058 lightWeight:separator Index: build.xml =================================================================== RCS file: /cvsroot/sheets/sheets/build.xml,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** build.xml 16 Dec 2002 11:38:15 -0000 1.15 --- build.xml 17 Jan 2003 22:42:39 -0000 1.16 *************** *** 6,9 **** --- 6,10 ---- <property name="lib" value="lib"/> <property name="graphics" value="graphics"/> + <property name="dtd" value="src/dtd"/> <property name="build" value="build"/> <property name="classes" value="${build}/sheets/classes"/> *************** *** 71,74 **** --- 72,80 ---- <copy todir="${classes}/graphics"> <fileset dir="${graphics}"/> + </copy> + + <!-- Copy over the dtds --> + <copy todir="${classes}/dtd"> + <fileset dir="${dtd}"/> </copy> </target> Index: todo.txt =================================================================== RCS file: /cvsroot/sheets/sheets/todo.txt,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** todo.txt 23 Dec 2002 13:39:34 -0000 1.7 --- todo.txt 17 Jan 2003 22:42:39 -0000 1.8 *************** *** 1,6 **** --- 1,23 ---- Fixed in this snapshot so far: + Fixed the bytecode support so that it handles jar classpaths + Updated version of bcel.jar + Fixed import and export of DocDocument fragments to/from the dump file + Documents now export proper xml headers, and import public references properly. + Greatly improved performance of deleting large number of fragments + + Check-in Todo: + Add dtds to cvs + + Currently Working On: + Trying to get the basic document export and forrest generation working. + In the process of trying to get the basic header export working... + Next thing is to get forrest to run against the test directory so I don't have to bootstrap to test it out. Stuff I Want to do: + Fix the language expert so that it can lookup the right xml expert by public identifier. + Create a package/class-lookup routine for the bytecode support (modeled after the ClassPath.java bcel class) + Explore the possibility of using a ClassPathRepository instead of a Synthetic Repository (looks like it isn't worth the trouble, and probably won't work for a completely unrelated classpath) -- if the answer is no, mail the bcel group about the fix/workaround XML-ize this todo list so that it can be rendered on the web page by forrest, and create a sheets mode for editing it. + Add a status dialog on deletion of 100+ fragments to show progress release criteria: *************** *** 8,12 **** move graphics to org.browsecode.graphics fix docbook support - Fixed tab key for JDK1.4.1 new bugs: --- 25,28 ---- *************** *** 196,199 **** --- 212,216 ---- *) theserverside.com *) freshmeat.net + *) jsurfer.org *) www.javaworld.com *) www.javalobby.com |