From odf-commits-return-744-apmail-incubator-odf-commits-archive=incubator.apache.org@incubator.apache.org Fri Feb 24 05:57:04 2012 Return-Path: X-Original-To: apmail-incubator-odf-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-odf-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DF1C69986 for ; Fri, 24 Feb 2012 05:57:04 +0000 (UTC) Received: (qmail 13227 invoked by uid 500); 24 Feb 2012 05:57:04 -0000 Delivered-To: apmail-incubator-odf-commits-archive@incubator.apache.org Received: (qmail 13178 invoked by uid 500); 24 Feb 2012 05:57:03 -0000 Mailing-List: contact odf-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: odf-dev@incubator.apache.org Delivered-To: mailing list odf-commits@incubator.apache.org Received: (qmail 13157 invoked by uid 99); 24 Feb 2012 05:57:03 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Feb 2012 05:57:03 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Feb 2012 05:57:01 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 0B3F723888E4; Fri, 24 Feb 2012 05:56:41 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1293094 - in /incubator/odf/trunk/taglets/src/main/java/org/odftoolkit/odfdom/taglet: OdfAttributeTaglet.java OdfDatatypeTaglet.java OdfElementTaglet.java Date: Fri, 24 Feb 2012 05:56:40 -0000 To: odf-commits@incubator.apache.org From: devinhan@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120224055641.0B3F723888E4@eris.apache.org> Author: devinhan Date: Fri Feb 24 05:56:39 2012 New Revision: 1293094 URL: http://svn.apache.org/viewvc?rev=1293094&view=rev Log: #ODFTOOLKIT-306# Update Taglets to support ODF 1.2 final version.[Developer:Devin] Modified: incubator/odf/trunk/taglets/src/main/java/org/odftoolkit/odfdom/taglet/OdfAttributeTaglet.java incubator/odf/trunk/taglets/src/main/java/org/odftoolkit/odfdom/taglet/OdfDatatypeTaglet.java incubator/odf/trunk/taglets/src/main/java/org/odftoolkit/odfdom/taglet/OdfElementTaglet.java Modified: incubator/odf/trunk/taglets/src/main/java/org/odftoolkit/odfdom/taglet/OdfAttributeTaglet.java URL: http://svn.apache.org/viewvc/incubator/odf/trunk/taglets/src/main/java/org/odftoolkit/odfdom/taglet/OdfAttributeTaglet.java?rev=1293094&r1=1293093&r2=1293094&view=diff ============================================================================== --- incubator/odf/trunk/taglets/src/main/java/org/odftoolkit/odfdom/taglet/OdfAttributeTaglet.java (original) +++ incubator/odf/trunk/taglets/src/main/java/org/odftoolkit/odfdom/taglet/OdfAttributeTaglet.java Fri Feb 24 05:56:39 2012 @@ -21,148 +21,186 @@ */ package org.odftoolkit.odfdom.taglet; +import java.util.HashSet; import java.util.Map; +import java.util.Set; import java.util.logging.Logger; import com.sun.javadoc.Tag; import com.sun.tools.doclets.Taglet; /** - * This class implements a custom taglet to the map the ODF attribute to the - * declaration of the ODF attribute in the OpenDocument specification. - * - * The position of the OpenDocument specification in HTML can be provided using - * an environment variable or java system property, while the system property overrides - * the environment variable. - * In case nothing is been a default path within the JavaDoc doc-files directory is being used. - * - * For example the taglet {@odf.attribute xml:id} would be resolved without variable settings to - * JAVA_DOC_BASE/doc-files/OpenDocument-v1.2-cd05-part1.html#attribute-xml_id. + * This class implements a custom taglet to the map the ODF attribute to the + * declaration of the ODF attribute in the OpenDocument specification. + * + * The position of the OpenDocument specification in HTML can be provided using + * an environment variable or java system property, while the system property + * overrides the environment variable. In case nothing is been a default path + * within the JavaDoc doc-files directory is being used. + * + * For example the taglet {@odf.attribute xml:id} would be + * resolved without variable settings to + * JAVA_DOC_BASE/doc-files/OpenDocument-v1.2-part1.html#attribute-xml_id + * . */ public class OdfAttributeTaglet implements Taglet { - + private static final Logger LOG = Logger.getLogger(OdfAttributeTaglet.class.getName()); private static final String NAME = "odf.attribute"; - private static final String ODF_SPEC_PATH = "../../../../../../doc-files/OpenDocument-v1.2-cd05-part1.html"; - private static String mOdfSpecPath = null; - - /* FINDING THE ABSOLUTE PATH TO THE ODF SPEC IN HTML: - * 1) Try to get the odfSpecPath from the Java System variable (ODF_SPEC_PATH) - * 2) Try to get the odfSpecPath from the environemnt variable (ODF_SPEC_PATH) - * 3) If both not worked, use the default path - **/ - static { - mOdfSpecPath = System.getProperty("ODF_SPEC_PATH"); - if (mOdfSpecPath == null) { - mOdfSpecPath = System.getenv("ODF_SPEC_PATH"); - if (mOdfSpecPath == null) { - mOdfSpecPath = ODF_SPEC_PATH; - LOG.info("OdfSpecPath was set to " + mOdfSpecPath + " by class declaration."); - } else { - LOG.info("OdfSpecPath was set to " + mOdfSpecPath + " by environment property 'ODF_SPEC_PATH'."); - } - } else { - LOG.info("OdfSpecPath was set to " + mOdfSpecPath + " by Java System property 'ODF_SPEC_PATH'."); - } - } - - /** - * @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 tagletMap) { - OdfAttributeTaglet tag = new OdfAttributeTaglet(); - Taglet t = tagletMap.get(tag.getName()); - if (t != null) { - tagletMap.remove(tag.getName()); - } - tagletMap.put(tag.getName(), tag); - } - - /** - * Given the Tag representation of this custom - * tag, return its string representation. - * @param tag he Tag representation of this custom tag. - * @return the string representation of the custom tag - */ - public String toString(Tag tag) { - int pos = tag.text().lastIndexOf(":"); - String fragmentIdentifier = "attribute-" + tag.text().substring(0, pos) + "_" + tag.text().substring(pos + 1); - return "" + tag.text() + ""; - } - - /** - * This method should not be called since arrays of inline tags do not - * exist. Method should be used to convert this - * inline tag to a string. - * @param tags the array of Tags representing of this custom tag. - * @return Nothing is returned, instead an UnsupportedOperationException is being thrown. - */ - public String toString(Tag[] tags) { - throw new java.lang.UnsupportedOperationException("Arrays of inline tags do not exist!"); - } + private static final String ODF_SPEC_PART1_PATH = "../../../../../../doc-files/OpenDocument-v1.2-part1.html"; + private static final String ODF_SPEC_PART3_PATH = "../../../../../doc-files/OpenDocument-v1.2-part3.html"; + private static String mOdfSpecPart1Path = null; + private static String mOdfSpecPart3Path = null; + private static Set mNS_IN_PART3 = new HashSet(); + + // initial attribute set which should be search in part3. + static { + mNS_IN_PART3.add("manifest"); + mNS_IN_PART3.add("dsig"); + mNS_IN_PART3.add("ds"); + } + + /* + * FINDING THE ABSOLUTE PATH TO THE ODF SPEC PART1 and PART3 IN HTML: + * 1) Try to get the odfSpecPath from the Java System variable (ODF_SPEC_PATH) + * 2) Try to get the odfSpecPath from the environment variable (ODF_SPEC_PATH) + * 3) If both not worked, use the default path + */ + static { + mOdfSpecPart1Path = System.getProperty("ODF_SPEC_PART1_PATH"); + if (mOdfSpecPart1Path == null) { + mOdfSpecPart1Path = System.getenv("ODF_SPEC_PATH"); + if (mOdfSpecPart1Path == null) { + mOdfSpecPart1Path = ODF_SPEC_PART1_PATH; + LOG.info("OdfSpecPart1Path was set to " + mOdfSpecPart1Path + " by class declaration."); + } else { + LOG.info("OdfSpecPart1Path was set to " + mOdfSpecPart1Path + " by environment property 'ODF_SPEC_PATH'."); + } + } else { + LOG.info("OdfSpecPart1Path was set to " + mOdfSpecPart1Path + " by Java System property 'ODF_SPEC_PATH'."); + } + + mOdfSpecPart3Path = System.getProperty("ODF_SPEC_PART3_PATH"); + if (mOdfSpecPart3Path == null) { + mOdfSpecPart3Path = System.getenv("ODF_SPEC_PATH"); + if (mOdfSpecPart3Path == null) { + mOdfSpecPart3Path = ODF_SPEC_PART3_PATH; + LOG.info("OdfSpecPart3Path was set to " + mOdfSpecPart3Path + " by class declaration."); + } else { + LOG.info("OdfSpecPart3Path was set to " + mOdfSpecPart3Path + " by environment property 'ODF_SPEC_PATH'."); + } + } else { + LOG.info("OdfSpecPart3Path was set to " + mOdfSpecPart3Path + " by Java System property 'ODF_SPEC_PATH'."); + } + + } + + /** + * @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 tagletMap) { + OdfAttributeTaglet tag = new OdfAttributeTaglet(); + Taglet t = tagletMap.get(tag.getName()); + if (t != null) { + tagletMap.remove(tag.getName()); + } + tagletMap.put(tag.getName(), tag); + } + + /** + * Given the Tag representation of this custom tag, return its + * string representation. + * + * @param tag + * he Tag representation of this custom tag. + * @return the string representation of the custom tag + */ + public String toString(Tag tag) { + int pos = tag.text().lastIndexOf(":"); + String namespace = tag.text().substring(0, pos); + String name = tag.text().substring(pos + 1); + String mOdfSpecPath = mOdfSpecPart1Path; + if (mNS_IN_PART3.contains(namespace)) { + mOdfSpecPath = mOdfSpecPart3Path; + } + String fragmentIdentifier = "attribute-" + namespace + "_" + name; + return "" + tag.text() + ""; + } + + /** + * This method should not be called since arrays of inline tags do not + * exist. Method should be used to convert this inline tag to a string. + * + * @param tags + * the array of Tags representing of this custom + * tag. + * @return Nothing is returned, instead an + * UnsupportedOperationException is being thrown. + */ + public String toString(Tag[] tags) { + throw new java.lang.UnsupportedOperationException("Arrays of inline tags do not exist!"); + } } Modified: incubator/odf/trunk/taglets/src/main/java/org/odftoolkit/odfdom/taglet/OdfDatatypeTaglet.java URL: http://svn.apache.org/viewvc/incubator/odf/trunk/taglets/src/main/java/org/odftoolkit/odfdom/taglet/OdfDatatypeTaglet.java?rev=1293094&r1=1293093&r2=1293094&view=diff ============================================================================== --- incubator/odf/trunk/taglets/src/main/java/org/odftoolkit/odfdom/taglet/OdfDatatypeTaglet.java (original) +++ incubator/odf/trunk/taglets/src/main/java/org/odftoolkit/odfdom/taglet/OdfDatatypeTaglet.java Fri Feb 24 05:56:39 2012 @@ -43,7 +43,7 @@ public class OdfDatatypeTaglet implement private static final Logger LOG = Logger.getLogger(OdfDatatypeTaglet.class.getName()); private static final String NAME = "odf.datatype"; - private static final String ODF_SPEC_PATH = "../../../../doc-files/OpenDocument-v1.2-cd05-part1.html"; + private static final String ODF_SPEC_PATH = "../../../../doc-files/OpenDocument-v1.2-part1.html"; private static String mOdfSpecPath = null; /* FINDING THE ABSOLUTE PATH TO THE ODF SPEC IN HTML: Modified: incubator/odf/trunk/taglets/src/main/java/org/odftoolkit/odfdom/taglet/OdfElementTaglet.java URL: http://svn.apache.org/viewvc/incubator/odf/trunk/taglets/src/main/java/org/odftoolkit/odfdom/taglet/OdfElementTaglet.java?rev=1293094&r1=1293093&r2=1293094&view=diff ============================================================================== --- incubator/odf/trunk/taglets/src/main/java/org/odftoolkit/odfdom/taglet/OdfElementTaglet.java (original) +++ incubator/odf/trunk/taglets/src/main/java/org/odftoolkit/odfdom/taglet/OdfElementTaglet.java Fri Feb 24 05:56:39 2012 @@ -21,147 +21,186 @@ */ package org.odftoolkit.odfdom.taglet; +import java.util.HashSet; import java.util.Map; +import java.util.Set; import java.util.logging.Logger; import com.sun.javadoc.Tag; import com.sun.tools.doclets.Taglet; - /** - * This class implements a custom taglet to the map the ODF element to the - * declaration of the ODF element in the OpenDocument specification. - * - * The position of the OpenDocument specification in HTML can be provided using - * an environment variable or java system property, while the system property overrides - * the environment variable. - * In case nothing is been a default path within the JavaDoc doc-files directory is being used. - * - * For example the taglet {@odf.element text:span} would be resolved without variable settings to - * JAVA_DOC_BASE/doc-files/OpenDocument-v1.2-cd05-part1.html#element-text_span. + * This class implements a custom taglet to the map the ODF element to the + * declaration of the ODF element in the OpenDocument specification. + * + * The position of the OpenDocument specification in HTML can be provided using + * an environment variable or java system property, while the system property + * overrides the environment variable. In case nothing is been a default path + * within the JavaDoc doc-files directory is being used. + * + * For example the taglet {@odf.element text:span} would be + * resolved without variable settings to + * JAVA_DOC_BASE/doc-files/OpenDocument-v1.2-part1.html#element-text_span + * . */ - public class OdfElementTaglet implements Taglet { - - private static final Logger LOG = Logger.getLogger(OdfElementTaglet.class.getName()); - private static final String NAME = "odf.element"; - private static final String ODF_SPEC_PATH = "../../../../../../doc-files/OpenDocument-v1.2-cd05-part1.html"; - private static String mOdfSpecPath = null; - - /* FINDING THE ABSOLUTE PATH TO THE ODF SPEC IN HTML: - * 1) Try to get the odfSpecPath from the Java System variable (ODF_SPEC_PATH) - * 2) Try to get the odfSpecPath from the environemnt variable (ODF_SPEC_PATH) - * 3) If both not worked, use the default path - **/ - static { - mOdfSpecPath = System.getProperty("ODF_SPEC_PATH"); - if (mOdfSpecPath == null) { - mOdfSpecPath = System.getenv("ODF_SPEC_PATH"); - if (mOdfSpecPath == null) { - mOdfSpecPath = ODF_SPEC_PATH; - LOG.info("OdfSpecPath was set to " + mOdfSpecPath + " by class declaration."); - } else { - LOG.info("OdfSpecPath was set to " + mOdfSpecPath + " by environment property 'ODF_SPEC_PATH'."); - } - } else { - LOG.info("OdfSpecPath was set to " + mOdfSpecPath + " by Java System property 'ODF_SPEC_PATH'."); - } - } - - /** - * Return the name of this custom tag. - */ - public String getName() { - return NAME; +public class OdfElementTaglet implements Taglet { + + private static final Logger LOG = Logger.getLogger(OdfElementTaglet.class.getName()); + private static final String NAME = "odf.element"; + private static final String ODF_SPEC_PART1_PATH = "../../../../../../doc-files/OpenDocument-v1.2-part1.html"; + private static final String ODF_SPEC_PART3_PATH = "../../../../../doc-files/OpenDocument-v1.2-part3.html"; + private static String mOdfSpecPart1Path = null; + private static String mOdfSpecPart3Path = null; + private static Set mNS_IN_PART3 = new HashSet(); + + // initial attribute set which should be search in part3. + static { + mNS_IN_PART3.add("manifest"); + mNS_IN_PART3.add("dsig"); + mNS_IN_PART3.add("ds"); + } + + /* + * FINDING THE ABSOLUTE PATH TO THE ODF SPEC PART1 and PART3 IN HTML: + * 1) Try to get the odfSpecPath from the Java System variable (ODF_SPEC_PATH) + * 2) Try to get the odfSpecPath from the environment variable (ODF_SPEC_PATH) + * 3) If both not worked, use the default path + */ + static { + mOdfSpecPart1Path = System.getProperty("ODF_SPEC_PART1_PATH"); + if (mOdfSpecPart1Path == null) { + mOdfSpecPart1Path = System.getenv("ODF_SPEC_PATH"); + if (mOdfSpecPart1Path == null) { + mOdfSpecPart1Path = ODF_SPEC_PART1_PATH; + LOG.info("OdfSpecPart1Path was set to " + mOdfSpecPart1Path + " by class declaration."); + } else { + LOG.info("OdfSpecPart1Path was set to " + mOdfSpecPart1Path + " by environment property 'ODF_SPEC_PATH'."); + } + } else { + LOG.info("OdfSpecPart1Path was set to " + mOdfSpecPart1Path + " by Java System property 'ODF_SPEC_PATH'."); + } + + mOdfSpecPart3Path = System.getProperty("ODF_SPEC_PART3_PATH"); + if (mOdfSpecPart3Path == null) { + mOdfSpecPart3Path = System.getenv("ODF_SPEC_PATH"); + if (mOdfSpecPart3Path == null) { + mOdfSpecPart3Path = ODF_SPEC_PART3_PATH; + LOG.info("OdfSpecPart3Path was set to " + mOdfSpecPart3Path + " by class declaration."); + } else { + LOG.info("OdfSpecPart3Path was set to " + mOdfSpecPart3Path + " by environment property 'ODF_SPEC_PATH'."); + } + } else { + LOG.info("OdfSpecPart3Path was set to " + mOdfSpecPart3Path + " by Java System property 'ODF_SPEC_PATH'."); } - - /** - * @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 tagletMap) { - OdfElementTaglet tag = new OdfElementTaglet(); - Taglet t = tagletMap.get(tag.getName()); - if (t != null) { - tagletMap.remove(tag.getName()); - } - tagletMap.put(tag.getName(), tag); - } - - /** - * Given the Tag representation of this custom - * tag, return its string representation. - * @param tag he Tag representation of this custom tag. - */ - public String toString(Tag tag) { - int pos = tag.text().lastIndexOf(":"); - String fragmentIdentifier = "element-" + tag.text().substring(0, pos) + "_" + tag.text().substring(pos + 1); - return "" + tag.text() + ""; - } - - /** - * This method should not be called since arrays of inline tags do not - * exist. Method should be used to convert this - * inline tag to a string. - * @param tags the array of Tags representing of this custom tag. - */ - public String toString(Tag[] tags) { - return null; - } + + } + + /** + * 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 tagletMap) { + OdfElementTaglet tag = new OdfElementTaglet(); + Taglet t = tagletMap.get(tag.getName()); + if (t != null) { + tagletMap.remove(tag.getName()); + } + tagletMap.put(tag.getName(), tag); + } + + /** + * Given the Tag representation of this custom tag, return its + * string representation. + * + * @param tag + * he Tag representation of this custom tag. + */ + public String toString(Tag tag) { + int pos = tag.text().lastIndexOf(":"); + String namespace = tag.text().substring(0, pos); + String name = tag.text().substring(pos + 1); + String mOdfSpecPath = mOdfSpecPart1Path; + if (mNS_IN_PART3.contains(namespace)) { + mOdfSpecPath = mOdfSpecPart3Path; + } + String fragmentIdentifier = "element-" + namespace + "_" + name; + if("ds:Signature".equals(tag.text())){ + fragmentIdentifier = "element2-xmldsig_Signature"; + } + return "" + tag.text() + ""; + } + + /** + * This method should not be called since arrays of inline tags do not + * exist. Method should be used to convert this inline tag to a string. + * + * @param tags + * the array of Tags representing of this custom + * tag. + */ + public String toString(Tag[] tags) { + return null; + } }