ptolemy.actor.gui
Class GenerateCopyrights

java.lang.Object
  extended by ptolemy.actor.gui.GenerateCopyrights

public class GenerateCopyrights
extends java.lang.Object

Generate an HTML file that contains links to the appropriate copyrights for entities in the configuration. This class looks for particular classes, and if the class is found in the classpath, then a corresponding html file is included in the list of copyrights.

Since:
Ptolemy II 2.0
Version:
$Id: GenerateCopyrights.java 59167 2010-09-21 17:08:02Z cxh $
Author:
Christopher Hylands
Accepted Rating:
Red (cxh)
Proposed Rating:
Red (cxh)

Constructor Summary
GenerateCopyrights()
           
 
Method Summary
private static void _addIfPresent(java.util.Map copyrightsMap, java.lang.String className, java.lang.String copyrightPath)
           
private static void _addIfPresent(java.util.Map copyrightsMap, java.lang.String applicationClassName, java.lang.String libraryClassName, java.lang.String copyrightPath)
           
private static java.lang.String _canonicalizeURLToPTII(java.lang.String path)
           
private static java.lang.String _findURL(java.lang.String localURL)
           
private static java.lang.String _getApplicationName(Configuration configuration)
          Get the application name from the _applicationName parameter.
static java.lang.String generateHTML(Configuration configuration)
          Generate HTML about the copyrights for classes that might be present in the configuration.
static java.lang.String generatePrimaryCopyrightHTML(Configuration configuration)
          Generate the primary copyright.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenerateCopyrights

public GenerateCopyrights()
Method Detail

generateHTML

public static java.lang.String generateHTML(Configuration configuration)
Generate HTML about the copyrights for classes that might be present in the configuration. This method contains a list of classes and corresponding copyrights. If a class in the list is present, then we generate html that contains a link to the copyright. Note that if the copyright file need not be present on the local machine, we generate a link to the copy on the Ptolemy website.

If the configuration contains an _applicationName attribute then that attributed is used as the name of the application in the generated text. If _applicationName is not present, then the default name is "Ptolemy II".

If the configuration contains an _applicationCopyright StringAttribute, then the value of that attributed is used as the location of the copyright html file. If _applicationCopyright is not present, then "ptolemy/configs/doc/copyright.htm" is used.

If the configuration has a parameter called _applicationCopyrights that is an array of records where each element is a record

  {actor="ptolemy.actor.lib.Foo", copyright="foo.htm"}
  
then we add that actor/copyright pair to the list of potential copyrights.

Parameters:
configuration - The configuration to look for the _applicationName and _applicationCopyright attributes in.
Returns:
A String containing HTML that describes what copyrights are used by Entities in the configuration

generatePrimaryCopyrightHTML

public static java.lang.String generatePrimaryCopyrightHTML(Configuration configuration)
Generate the primary copyright. Include a link to the other copyrights.

Parameters:
configuration - The configuration in which to look for the _applicationName attribute.
Returns:
A String containing HTML that describes what copyrights are used by Entities in the configuration

_addIfPresent

private static void _addIfPresent(java.util.Map copyrightsMap,
                                  java.lang.String applicationClassName,
                                  java.lang.String libraryClassName,
                                  java.lang.String copyrightPath)

_addIfPresent

private static void _addIfPresent(java.util.Map copyrightsMap,
                                  java.lang.String className,
                                  java.lang.String copyrightPath)

_canonicalizeURLToPTII

private static java.lang.String _canonicalizeURLToPTII(java.lang.String path)

_findURL

private static java.lang.String _findURL(java.lang.String localURL)

_getApplicationName

private static java.lang.String _getApplicationName(Configuration configuration)
Get the application name from the _applicationName parameter. If the _applicationName parameter is not set, then return "Ptolemy II"