|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectsoot.Transformer
soot.SceneTransformer
ptolemy.copernicus.applet.AppletWriter
public class AppletWriter
A transformer that writes an applet version of a model. For a model called Foo, we generate Foo/makefile, Foo/Foo.xml, Foo/Foo.htm Foo/FooVergil.htm in the directory named by the outputDirectory parameter.
The model is traversed and jar files are found for each
class. If a model uses other code by reference at runtime,
then if the model includes a parameter named "_jnlpClassesToJars",
then that parameter is expected to be an array of two element arrays,
where the first element is dot separated class name, and the
second element is the slash separated path to the jar file.
For example, {{"ptolemy.domains.sdf.kernel.SDFDirectory",
"ptolemy/domains/sdf/sdf.jar"}} means that sdf.jar
should be included in the jar files.
Potential future enhancements
| Red (cxh) |
| Red (cxh) |
| Field Summary | |
|---|---|
private java.lang.String |
_codeBase
|
private java.lang.String |
_configurationName
|
private boolean |
_debug
|
private java.lang.String |
_domainJar
|
private java.lang.String |
_jnlpJars
|
private CompositeActor |
_model
|
private java.lang.String |
_modelJarFiles
|
private java.lang.String |
_modelPath
|
private java.lang.String |
_outputDirectory
|
private java.lang.String |
_ptIIJarsPath
|
private java.lang.String |
_ptIILocalURL
|
private java.lang.String |
_ptIIUserDirectory
|
private java.lang.String |
_sanitizedModelName
|
private java.util.Map |
_substituteMap
|
private java.lang.String |
_targetPackage
|
private java.lang.String |
_targetPath
|
private java.lang.String |
_templateDirectory
|
private java.lang.String |
_vergilJarFiles
|
private static java.lang.String |
TEMPLATE_DIRECTORY_DEFAULT
|
| Constructor Summary | |
|---|---|
private |
AppletWriter(CompositeActor model)
Construct a new transformer |
| Method Summary | |
|---|---|
private java.util.Map |
_allAtomicEntityJars()
|
private java.util.Map |
_allAttributeJars(CompositeEntity compositeEntity)
|
private static java.lang.String |
_checkForJNLPExtensions(java.lang.String jarFileName)
|
private void |
_copyFile(java.lang.String sourceFileName,
java.lang.String destinationDirectory,
java.lang.String destinationFileName)
|
private boolean |
_copyJarFiles(java.util.Map classMap,
java.util.HashSet jarFilesThatHaveBeenRequired)
Copy the jar files listed in the map. |
private static void |
_copyModelRemoveGeneratorTableau(java.net.URL modelPathURL,
java.io.File newModelFile)
|
private boolean |
_copyPotentialJarFile(java.lang.String jarFile,
java.lang.String className,
java.util.HashSet jarFilesThatHaveBeenRequired)
|
private void |
_createJarFile(java.io.File jarFile,
java.io.File optionalJarFile,
java.lang.String[] jarFileNames,
java.io.File[] filesToBeJared)
Create a jar file. |
private java.util.Map |
_deepOpaqueEntityJars()
|
private java.util.Set |
_findModelJarFiles(Director director)
|
private java.util.Set |
_findVergilJarFiles(Director director,
java.util.Set modelJarFiles)
|
private static java.lang.String |
_getDomainJar(java.lang.String domainPackage)
|
private static java.lang.String |
_getToplevelDocumentation(java.net.URL modelPathURL)
Get the top level documentation. |
private java.lang.String |
_jarFileLengthAttribute(java.lang.String fileName)
Return the file size as a JNLP file attribute |
private static void |
_signJarFile(java.lang.String jarFileName,
java.lang.String signedJarFileName)
Sign a jar file. |
private java.lang.String[] |
_updateJar(java.util.jar.JarOutputStream jarOutputStream,
java.util.jar.JarInputStream jarInputStream,
java.lang.String[] jarFileNames)
Update a jar file and ignore filenames that are in jarFileNames. |
private java.util.Map |
_userSpecifiedJars()
|
java.lang.String |
getDeclaredOptions()
Return the declared options. |
java.lang.String |
getDefaultOptions()
Return the default options. |
java.lang.String |
getPhaseName()
Return the phase name. |
protected void |
internalTransform(java.lang.String phaseName,
java.util.Map options)
Save the model as an applet. |
static AppletWriter |
v(CompositeActor model)
Return an instance of this transformer that will operate on the given model. |
| Methods inherited from class soot.SceneTransformer |
|---|
transform, transform, transform |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private java.lang.String _codeBase
private java.lang.String _configurationName
private boolean _debug
private java.lang.String _domainJar
private CompositeActor _model
private java.lang.String _modelJarFiles
private java.lang.String _modelPath
private java.lang.String _outputDirectory
private java.lang.String _sanitizedModelName
private java.lang.String _ptIIJarsPath
private java.lang.String _ptIILocalURL
private java.lang.String _ptIIUserDirectory
private java.util.Map _substituteMap
private java.lang.String _targetPackage
private java.lang.String _targetPath
private java.lang.String _templateDirectory
private static final java.lang.String TEMPLATE_DIRECTORY_DEFAULT
private java.lang.String _vergilJarFiles
private java.lang.String _jnlpJars
| Constructor Detail |
|---|
private AppletWriter(CompositeActor model)
| Method Detail |
|---|
public static AppletWriter v(CompositeActor model)
model - The model that this class will operate on.
public java.lang.String getDefaultOptions()
templateDirectory: ptolemy/copernicus/applet/
getDefaultOptions in interface soot.HasPhaseOptionspublic java.lang.String getDeclaredOptions()
modelPath outputDirectory ptIIJarsPath ptIILocalURL ptIIUserDirectory targetPackage targetPath templateDirectory
getDeclaredOptions in interface soot.HasPhaseOptionspublic java.lang.String getPhaseName()
getPhaseName in interface soot.HasPhaseOptions
protected void internalTransform(java.lang.String phaseName,
java.util.Map options)
For example, if the model is called MyModel, and this phase is called with:
-p wjtp.appletWriter targetPackage:foo.bar
Then we will create the directory $PTII/foo/bar/MyModel and
place MyModel.xml, MyModel.htm, MyModelVergil.htm in that
directory.
internalTransform in class soot.SceneTransformerphaseName - The name of the phase, for example
wjtp.appletWriter.options - The options Map. This method uses the
targetPackage option to specify package
to generate code in.private java.util.Map _allAttributeJars(CompositeEntity compositeEntity)
private java.util.Map _allAtomicEntityJars()
private java.util.Map _deepOpaqueEntityJars()
private static java.lang.String _checkForJNLPExtensions(java.lang.String jarFileName)
private static void _copyModelRemoveGeneratorTableau(java.net.URL modelPathURL,
java.io.File newModelFile)
throws java.lang.Exception
java.lang.Exception
private boolean _copyPotentialJarFile(java.lang.String jarFile,
java.lang.String className,
java.util.HashSet jarFilesThatHaveBeenRequired)
throws java.io.IOException
java.io.IOException
private boolean _copyJarFiles(java.util.Map classMap,
java.util.HashSet jarFilesThatHaveBeenRequired)
throws java.io.IOException
classMap - A map consisting of String keys that are dot separated
class name and a value that is a String naming a jar file.jarFilesThatHaveBeenRequired - A set of strings that is set
to the names of the jar files that have been found.
java.io.IOException
private void _copyFile(java.lang.String sourceFileName,
java.lang.String destinationDirectory,
java.lang.String destinationFileName)
throws java.io.IOException
java.io.IOException
private static java.lang.String _getToplevelDocumentation(java.net.URL modelPathURL)
throws java.lang.Exception
java.lang.Exception
private java.lang.String _jarFileLengthAttribute(java.lang.String fileName)
throws java.io.IOException
java.io.IOException
private java.util.Set _findModelJarFiles(Director director)
throws java.io.IOException
java.io.IOException
private java.util.Set _findVergilJarFiles(Director director,
java.util.Set modelJarFiles)
throws java.io.IOException
java.io.IOExceptionprivate static java.lang.String _getDomainJar(java.lang.String domainPackage)
private static void _signJarFile(java.lang.String jarFileName,
java.lang.String signedJarFileName)
throws java.lang.Exception
java.lang.Exception
private void _createJarFile(java.io.File jarFile,
java.io.File optionalJarFile,
java.lang.String[] jarFileNames,
java.io.File[] filesToBeJared)
throws java.lang.Exception
java.lang.Exception
private java.lang.String[] _updateJar(java.util.jar.JarOutputStream jarOutputStream,
java.util.jar.JarInputStream jarInputStream,
java.lang.String[] jarFileNames)
throws java.io.IOException
jarOutputStream - The Jar output stream to be written.jarInputStream - The Jar output stream to be read.jarFileNames - An array of file names that have been
already added to the jar file.
java.io.IOExceptionprivate java.util.Map _userSpecifiedJars()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||