ignite-133 review
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/d0a4e678 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/d0a4e678 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/d0a4e678 Branch: refs/heads/ignite-113 Commit: d0a4e678d9fe9e1750a90a8148928d6849ad01f6 Parents: 5be6a7c Author: Yakov Zhdanov <yzhda...@gridgain.com> Authored: Wed Jan 28 16:50:02 2015 +0300 Committer: Yakov Zhdanov <yzhda...@gridgain.com> Committed: Wed Jan 28 16:50:02 2015 +0300 ---------------------------------------------------------------------- .../ignite/tools/javadoc/GridLinkTaglet.java | 165 ------------------- .../ignite/tools/javadoc/IgniteLinkTaglet.java | 165 +++++++++++++++++++ pom.xml | 6 +- 3 files changed, 168 insertions(+), 168 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d0a4e678/modules/tools/src/main/java/org/apache/ignite/tools/javadoc/GridLinkTaglet.java ---------------------------------------------------------------------- diff --git a/modules/tools/src/main/java/org/apache/ignite/tools/javadoc/GridLinkTaglet.java b/modules/tools/src/main/java/org/apache/ignite/tools/javadoc/GridLinkTaglet.java deleted file mode 100644 index e890abe..0000000 --- a/modules/tools/src/main/java/org/apache/ignite/tools/javadoc/GridLinkTaglet.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.tools.javadoc; - -import com.sun.tools.doclets.*; -import com.sun.javadoc.*; - -import java.io.*; -import java.util.*; - -/** - * Represents {@ignitelink ...} tag. This tag can - * be used as replacement of {@link ...} tag that references to the GridGain class that is not in classpath. - * Class and its arguments should have fully qualified names. - */ -public class GridLinkTaglet implements Taglet { - /** */ - private static final String NAME = "ignitelink"; - - /** - * Return the name of this custom tag. - */ - public String getName() { - return NAME; - } - - /** - * @return true since this tag can be used in a field doc comment. - */ - public boolean inField() { - return true; - } - - /** - * @return true since this tag can be used in a constructor doc comment. - */ - public boolean inConstructor() { - return true; - } - - /** - * @return true since this tag can be used in a method doc comment. - */ - public boolean inMethod() { - return true; - } - - /** - * @return true since this tag can be used in an overview doc comment. - */ - public boolean inOverview() { - return true; - } - - /** - * @return true since this tag can be used in a package doc comment. - */ - public boolean inPackage() { - return true; - } - - /** - * @return true since this. - */ - public boolean inType() { - return true; - } - - /** - * Will return true since this is an inline tag. - * - * @return true since this is an inline tag. - */ - public boolean isInlineTag() { - return true; - } - - /** - * Register this Taglet. - * - * @param tagletMap the map to register this tag to. - */ - public static void register(Map<String, GridLinkTaglet> tagletMap) { - GridLinkTaglet tag = new GridLinkTaglet(); - - Taglet t = tagletMap.get(tag.getName()); - - if (t != null) - tagletMap.remove(tag.getName()); - - tagletMap.put(tag.getName(), tag); - } - - /** - * Given the <code>Tag</code> representation of this custom tag, return its string representation. - * <p> - * Input: org.gridgain.grid.spi.indexing.h2.GridH2IndexingSpi#setIndexCustomFunctionClasses(Class[]) - * <p> - * Output: <a href="../../../../../org/gridgain/grid/spi/indexing/h2/GridH2IndexingSpi.html# - * setIndexCustomFunctionClasses(java.lang.Class...)"> - * <code>GridH2IndexingSpi.setIndexCustomFunctionClasses(java.lang.Class[])</code></a> - * - * @param tag <code>Tag</code> representation of this custom tag. - */ - public String toString(Tag tag) { - if (tag.text() == null || tag.text().isEmpty()) - return ""; - - File f = tag.position().file(); - - String curClass = f == null ? "" : f.getAbsolutePath().replace(File.separator, "."); - - String packPref = "src.main.java."; - - int idx = curClass.indexOf(packPref); - - StringBuilder path = new StringBuilder(); - - if (idx != -1) { - curClass = curClass.substring(idx + packPref.length()); - - for (int i = 0, n = curClass.split("\\.").length - 2; i < n; i++) - path.append("../"); - } - - String[] tokens = tag.text().split("#"); - - int lastIdx = tokens[0].lastIndexOf('.'); - - String simpleClsName = lastIdx != -1 && lastIdx + 1 < tokens[0].length() ? - tokens[0].substring(lastIdx + 1) : tokens[0]; - - String fullyQClsName = tokens[0].replace(".", "/"); - - return "<a href=\"" + path.toString() + fullyQClsName + ".html" + - (tokens.length > 1 ? ("#" + tokens[1].replace("[]", "...")) : "") + - "\"><code>" + simpleClsName + (tokens.length > 1 ? ("." + tokens[1]) : "") + "</code></a>"; - } - - /** - * This method should not be called since arrays of inline tags do not - * exist. Method {@link #toString(Tag)} should be used to convert this - * inline tag to a string. - * - * @param tags the array of <code>Tag</code>s representing of this custom tag. - */ - public String toString(Tag[] tags) { - return null; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d0a4e678/modules/tools/src/main/java/org/apache/ignite/tools/javadoc/IgniteLinkTaglet.java ---------------------------------------------------------------------- diff --git a/modules/tools/src/main/java/org/apache/ignite/tools/javadoc/IgniteLinkTaglet.java b/modules/tools/src/main/java/org/apache/ignite/tools/javadoc/IgniteLinkTaglet.java new file mode 100644 index 0000000..d55e25f --- /dev/null +++ b/modules/tools/src/main/java/org/apache/ignite/tools/javadoc/IgniteLinkTaglet.java @@ -0,0 +1,165 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.tools.javadoc; + +import com.sun.tools.doclets.*; +import com.sun.javadoc.*; + +import java.io.*; +import java.util.*; + +/** + * Represents {@ignitelink ...} tag. This tag can + * be used as replacement of {@link ...} tag that references to the GridGain class that is not in classpath. + * Class and its arguments should have fully qualified names. + */ +public class IgniteLinkTaglet implements Taglet { + /** */ + private static final String NAME = "ignitelink"; + + /** + * Return the name of this custom tag. + */ + public String getName() { + return NAME; + } + + /** + * @return true since this tag can be used in a field doc comment. + */ + public boolean inField() { + return true; + } + + /** + * @return true since this tag can be used in a constructor doc comment. + */ + public boolean inConstructor() { + return true; + } + + /** + * @return true since this tag can be used in a method doc comment. + */ + public boolean inMethod() { + return true; + } + + /** + * @return true since this tag can be used in an overview doc comment. + */ + public boolean inOverview() { + return true; + } + + /** + * @return true since this tag can be used in a package doc comment. + */ + public boolean inPackage() { + return true; + } + + /** + * @return true since this. + */ + public boolean inType() { + return true; + } + + /** + * Will return true since this is an inline tag. + * + * @return true since this is an inline tag. + */ + public boolean isInlineTag() { + return true; + } + + /** + * Register this Taglet. + * + * @param tagletMap the map to register this tag to. + */ + public static void register(Map<String, IgniteLinkTaglet> tagletMap) { + IgniteLinkTaglet tag = new IgniteLinkTaglet(); + + Taglet t = tagletMap.get(tag.getName()); + + if (t != null) + tagletMap.remove(tag.getName()); + + tagletMap.put(tag.getName(), tag); + } + + /** + * Given the <code>Tag</code> representation of this custom tag, return its string representation. + * <p> + * Input: org.gridgain.grid.spi.indexing.h2.GridH2IndexingSpi#setIndexCustomFunctionClasses(Class[]) + * <p> + * Output: <a href="../../../../../org/gridgain/grid/spi/indexing/h2/GridH2IndexingSpi.html# + * setIndexCustomFunctionClasses(java.lang.Class...)"> + * <code>GridH2IndexingSpi.setIndexCustomFunctionClasses(java.lang.Class[])</code></a> + * + * @param tag <code>Tag</code> representation of this custom tag. + */ + public String toString(Tag tag) { + if (tag.text() == null || tag.text().isEmpty()) + return ""; + + File f = tag.position().file(); + + String curClass = f == null ? "" : f.getAbsolutePath().replace(File.separator, "."); + + String packPref = "src.main.java."; + + int idx = curClass.indexOf(packPref); + + StringBuilder path = new StringBuilder(); + + if (idx != -1) { + curClass = curClass.substring(idx + packPref.length()); + + for (int i = 0, n = curClass.split("\\.").length - 2; i < n; i++) + path.append("../"); + } + + String[] tokens = tag.text().split("#"); + + int lastIdx = tokens[0].lastIndexOf('.'); + + String simpleClsName = lastIdx != -1 && lastIdx + 1 < tokens[0].length() ? + tokens[0].substring(lastIdx + 1) : tokens[0]; + + String fullyQClsName = tokens[0].replace(".", "/"); + + return "<a href=\"" + path.toString() + fullyQClsName + ".html" + + (tokens.length > 1 ? ("#" + tokens[1].replace("[]", "...")) : "") + + "\"><code>" + simpleClsName + (tokens.length > 1 ? ("." + tokens[1]) : "") + "</code></a>"; + } + + /** + * This method should not be called since arrays of inline tags do not + * exist. Method {@link #toString(Tag)} should be used to convert this + * inline tag to a string. + * + * @param tags the array of <code>Tag</code>s representing of this custom tag. + */ + public String toString(Tag[] tags) { + return null; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d0a4e678/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 46ae20d..3701b48 100644 --- a/pom.xml +++ b/pom.xml @@ -592,7 +592,7 @@ <configuration> <taglets> <taglet> - <tagletClass>org.apache.ignite.tools.javadoc.GridLinkTaglet</tagletClass> + <tagletClass>org.apache.ignite.tools.javadoc.IgniteLinkTaglet</tagletClass> <tagletArtifact> <groupId>org.apache.ignite</groupId> <artifactId>ignite-tools</artifactId> @@ -799,7 +799,7 @@ <configuration> <taglets> <taglet> - <tagletClass>org.apache.ignite.tools.javadoc.GridLinkTaglet</tagletClass> + <tagletClass>org.apache.ignite.tools.javadoc.IgniteLinkTaglet</tagletClass> <tagletArtifact> <groupId>org.apache.ignite</groupId> <artifactId>ignite-tools</artifactId> @@ -1021,7 +1021,7 @@ <configuration> <taglets> <taglet> - <tagletClass>org.apache.ignite.tools.javadoc.GridLinkTaglet</tagletClass> + <tagletClass>org.apache.ignite.tools.javadoc.IgniteLinkTaglet</tagletClass> <tagletArtifact> <groupId>org.apache.ignite</groupId> <artifactId>ignite-tools</artifactId>