From 237907b410edfdae12de8696677504ca7d578c05 Mon Sep 17 00:00:00 2001 From: Maxime Sinclair Date: Wed, 30 Mar 2011 17:53:11 +0200 Subject: [PATCH] Javadoc and source headers. --- .../plantuml/servlet/DiagramResponse.java | 29 +++++++++++++- .../plantuml/servlet/ImgServlet.java | 27 ++++++++++++- .../plantuml/servlet/PlantUmlServlet.java | 24 ++++++++++++ .../plantuml/servlet/SvgServlet.java | 23 +++++++++++ .../plantuml/servlet/UmlDiagramService.java | 38 +++++++++++++++++++ .../sourceforge/plantuml/servlet/Welcome.java | 24 ++++++++++++ .../sourceforge/plantuml/servlet/package.html | 12 ++++++ 7 files changed, 174 insertions(+), 3 deletions(-) create mode 100644 src/net/sourceforge/plantuml/servlet/package.html diff --git a/src/net/sourceforge/plantuml/servlet/DiagramResponse.java b/src/net/sourceforge/plantuml/servlet/DiagramResponse.java index 889187d..7e4451c 100644 --- a/src/net/sourceforge/plantuml/servlet/DiagramResponse.java +++ b/src/net/sourceforge/plantuml/servlet/DiagramResponse.java @@ -1,3 +1,26 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * Project Info: http://plantuml.sourceforge.net + * + * This file is part of PlantUML. + * + * PlantUML is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PlantUML distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + */ package net.sourceforge.plantuml.servlet; import java.io.IOException; @@ -12,7 +35,11 @@ import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.SourceStringReader; import net.sourceforge.plantuml.StringUtils; - +/** + * Delegates the diagram generation from the UML source and + * the filling of the HTTP response with the diagram in the right format. + * Its own responsibility is to produce the right HTTP headers. + */ class DiagramResponse { private HttpServletResponse response; private FileFormat format; diff --git a/src/net/sourceforge/plantuml/servlet/ImgServlet.java b/src/net/sourceforge/plantuml/servlet/ImgServlet.java index 8587b72..c5dea84 100644 --- a/src/net/sourceforge/plantuml/servlet/ImgServlet.java +++ b/src/net/sourceforge/plantuml/servlet/ImgServlet.java @@ -1,10 +1,33 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * Project Info: http://plantuml.sourceforge.net + * + * This file is part of PlantUML. + * + * PlantUML is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PlantUML distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + */ package net.sourceforge.plantuml.servlet; import net.sourceforge.plantuml.FileFormat; /* - * SVG servlet of the webapp. - * TODO. + * Image servlet of the webapp. + * This servlet produces the UML diagram in PNG format. */ @SuppressWarnings("serial") public class ImgServlet extends UmlDiagramService { diff --git a/src/net/sourceforge/plantuml/servlet/PlantUmlServlet.java b/src/net/sourceforge/plantuml/servlet/PlantUmlServlet.java index 104890e..9334dae 100644 --- a/src/net/sourceforge/plantuml/servlet/PlantUmlServlet.java +++ b/src/net/sourceforge/plantuml/servlet/PlantUmlServlet.java @@ -1,3 +1,26 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * Project Info: http://plantuml.sourceforge.net + * + * This file is part of PlantUML. + * + * PlantUML is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PlantUML distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + */ package net.sourceforge.plantuml.servlet; import java.io.IOException; @@ -33,6 +56,7 @@ import HTTPClient.ParseException; * Packaged by Maxime Sinclair * */ +@SuppressWarnings("serial") public class PlantUmlServlet extends HttpServlet { private static final Pattern startumlPattern = Pattern.compile("/\\w+/start/(.*)"); diff --git a/src/net/sourceforge/plantuml/servlet/SvgServlet.java b/src/net/sourceforge/plantuml/servlet/SvgServlet.java index cad7317..044d4f4 100644 --- a/src/net/sourceforge/plantuml/servlet/SvgServlet.java +++ b/src/net/sourceforge/plantuml/servlet/SvgServlet.java @@ -1,3 +1,26 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * Project Info: http://plantuml.sourceforge.net + * + * This file is part of PlantUML. + * + * PlantUML is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PlantUML distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + */ package net.sourceforge.plantuml.servlet; import net.sourceforge.plantuml.FileFormat; diff --git a/src/net/sourceforge/plantuml/servlet/UmlDiagramService.java b/src/net/sourceforge/plantuml/servlet/UmlDiagramService.java index 764fa65..9f5d182 100644 --- a/src/net/sourceforge/plantuml/servlet/UmlDiagramService.java +++ b/src/net/sourceforge/plantuml/servlet/UmlDiagramService.java @@ -1,3 +1,26 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * Project Info: http://plantuml.sourceforge.net + * + * This file is part of PlantUML. + * + * PlantUML is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PlantUML distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + */ package net.sourceforge.plantuml.servlet; import java.io.IOException; @@ -12,6 +35,9 @@ import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.code.Transcoder; import net.sourceforge.plantuml.code.TranscoderUtil; +/** + * Common service servlet to produce diagram from compressed UML source. + */ @SuppressWarnings("serial") public abstract class UmlDiagramService extends HttpServlet { @@ -35,9 +61,21 @@ public abstract class UmlDiagramService extends HttpServlet { // generate the response DiagramResponse dr = new DiagramResponse( response, getOutputFormat()); dr.sendDiagram( uml); + dr = null; } + /** + * Extracts the compressed UML source from the HTTP URI. + * @param uri the complete URI as returned by request.getRequestURI() + * @return the compressed UML source + */ abstract public String getSource( String uri); + + /** + * Gives the wished output format of the diagram. + * This value is used by the DiagramResponse class. + * @return the format + */ abstract FileFormat getOutputFormat(); private Transcoder getTranscoder() { diff --git a/src/net/sourceforge/plantuml/servlet/Welcome.java b/src/net/sourceforge/plantuml/servlet/Welcome.java index 0b1cc84..eae09b7 100644 --- a/src/net/sourceforge/plantuml/servlet/Welcome.java +++ b/src/net/sourceforge/plantuml/servlet/Welcome.java @@ -1,3 +1,26 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * Project Info: http://plantuml.sourceforge.net + * + * This file is part of PlantUML. + * + * PlantUML is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PlantUML distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + */ package net.sourceforge.plantuml.servlet; import java.io.IOException; @@ -12,6 +35,7 @@ import javax.servlet.http.HttpServletResponse; * Welcome servlet of the webapp. * Displays the sample Bob and Alice sequence diagram. */ +@SuppressWarnings("serial") public class Welcome extends HttpServlet { @Override diff --git a/src/net/sourceforge/plantuml/servlet/package.html b/src/net/sourceforge/plantuml/servlet/package.html new file mode 100644 index 0000000..b286d4c --- /dev/null +++ b/src/net/sourceforge/plantuml/servlet/package.html @@ -0,0 +1,12 @@ + + +

This package is in charge of the JEE PlantUml Server.

+

there are 2 kind of servlets in this package :
+- Interactive servlets : Welcome, PlantUmlServlet that are in charge of the web pages dedicated to human users.
+- Service servlets : ImgServlet, SvgServlet that only produce a diagram as output.
+
+Structure of the service part of the PlantUmlServer:
+ +

+ + \ No newline at end of file