private void extractFile(String relativeClasspath) throws IOException { InputStream resourceStream = this.getClass().getResourceAsStream(relativeClasspath); if (resourceStream == null) { rootDoc.printWarning("Cannot found internal resource \"" + relativeClasspath + "\""); } rootDoc.printNotice("Extracting resource \"" + relativeClasspath + "\"..."); File outputFile = new File(this.outputDir, relativeClasspath); File directory = outputFile.getParentFile(); if (!directory.isDirectory()) { rootDoc.printWarning("Cannot write file \"" + outputFile.getAbsolutePath() + "\""); return; } if (!directory.exists() && !directory.mkdirs()) { rootDoc.printWarning("Cannot create directory \"" + directory.getAbsolutePath() + "\n"); return; } FileOutputStream fileOutputStream = new FileOutputStream(outputFile); try { byte[] buffer = new byte[512]; int nbRead = 0; while ((nbRead = resourceStream.read(buffer)) != -1) { fileOutputStream.write(buffer, 0, nbRead); } } finally { fileOutputStream.close(); } }
/** Entry point through javadoc */ public static boolean start(RootDoc root) throws IOException { Options opt = buildOptions(root); root.printNotice("UMLGraph doclet version " + Version.VERSION + " started"); View[] views = buildViews(opt, root, root); if (views == null) return false; if (views.length == 0) buildGraph(root, opt, null); else for (int i = 0; i < views.length; i++) buildGraph(root, views[i], null); return true; }
public List<StepClassDoc> filterStepClassDocs() throws QuoteTailNotFoundException { List<StepClassDoc> stepClassDocs = new ArrayList<StepClassDoc>(); int classId = 1; for (ClassDoc classDoc : rootDoc.classes()) { if (isCandidateClassDoc(classDoc)) { StepClassDoc stepClassDoc = new StepClassDoc(classId, classDoc); if (stepClassDoc.isStepClassDoc()) { rootDoc.printNotice("Step class found: " + classDoc); stepClassDocs.add(stepClassDoc); classId++; } } } return stepClassDocs; }
/** Builds and outputs a single graph according to the view overrides */ public static void buildGraph(RootDoc root, OptionProvider op, Doc contextDoc) throws IOException { if (getCommentOptions() == null) buildOptions(root); Options opt = op.getGlobalOptions(); root.printNotice("Building " + op.getDisplayName()); ClassDoc[] classes = root.classes(); ClassGraph c = new ClassGraph(root, op, contextDoc); c.prologue(); for (int i = 0; i < classes.length; i++) c.printClass(classes[i], true); for (int i = 0; i < classes.length; i++) c.printRelations(classes[i]); if (opt.inferRelationships) c.printInferredRelations(classes); if (opt.inferDependencies) c.printInferredDependencies(classes); c.printExtraClasses(root); c.epilogue(); }
protected void printNotice(String message) { root.printNotice(message); }