<!doctype html public '-//W3C//DTD HTML 4.01//EN'
  'http://www.w3.org/TR/html4/strict.dtd'>
<html>
<title>Isight - Component Examples</title>
  <head>
	<link rel="stylesheet" href="../../EStyle.css" type="text/css">
	<link rel="stylesheet" href="../../ETables.css" type="text/css">
  </head>
<a href="http://www.simulia.com/products/sim_opt.html"><img src="../../../examples/logo.gif"></a>
<body>
<h1>Components</h1>
<dl>
  <dt><a href="#plate"><strong>Plate</strong></a><dd> Complete Custom component example.
  <dt><a href="#oscmd"><strong>OSCommand Plug-in</strong></a><dd> Using OSCommand as a plug-in to a custom component.
</dl>
<table>
	<th colspan=2><a name="plate">Plate</a></th>
	<tr>
		<td>Description:</td>
		<td>This simple problem is to determine the surface area,
volume, and weight of a thick plate of a specified
shape and size. While this problem could be solved
quite easily using some of the basic existing Isight
components, the simplicity allows us to demonstrate
the procedures and code for developing Isight extensions
without the burden of understanding a complex problem.
For this example, a component is developed that accepts
input specifications for the plate and provides the
quantities of interest as outputs.</td>
	</tr>
	<tr>
		<td>Support files needed:</td>
		<td>
			<ul><li><a href="plate/PlateEditor.java">PlateEditor.java</a> -
						Source file for the plate configuration editor.
						This is called from the Design Gateway.

				</li>
				<li><a href="plate/PlateExecutor.java"> PlateExecutor.java</a> -
						Source file for the plate-properties evaluation
      procedure.  This is called when the component is
      executed (either locally or on the SIMULIA Execution Engine).

				</li>
				<li><a href="plate/PlateHandler.java">PlateHandler.java</a>-
						is called in response to changes made to the
      model outside of the component which may require
      changes inside the component to maintain model
      validity (or at least the posting of validation
      errors and/or warnings).

				</li>

				<li><a href="plate/PlatePostProcessor.java">PlatePostProcessor.java</a>-
					Source file for the runtime post-processing code.
      This is called to construct the execution results
      summary text for display in the Runtime Gateway
      after a model containing the component has been
      executed.

				</li>

				<li><a href="plate/plate.gif">plate.gif</a>-
						This is the image displayed by icons representing
      the component in the Design and Runtime Gateways.

				</li>
			</ul>
		</td>
	</tr>
	<tr>
		<td>Instructions:</td>
		<td>
			<ol><li>Use the provided build script (<a href = "plate/build.sh"> build.sh</a> on Unix,
   <a href="plate/build.bat">build.bat</a> on Windows) to compile the Java source
   files and generate corresponding class files.  You
   MUST have a Java compiler installed, and must set
   the environment variable JAVA_HOME to point to it.
   You must also have Isight installed, and must set
   the environment variable FIPER_HOME to point to it.
   Note that the generated class files will be placed in
   a directory structure under this current example
   directory that mirrors the package structure defined in
   the Java source files (examples/development/components/plate).

</li><li> Run the Isight tool 'sdkGenerator'.  Build the plate
   component as follows:

   <ol><li> Name the component.  The value to use as the
      full name is 'examples.development.components.plate',
      which is the Java package name that appears
      at the top of each Java source file.

   </li><li> Select 'plate.gif' as the icon.

   </li><li> Define two properties (as scalars):<br/>

      <ul>
		  <li>Shape:    type = 'String', value = 'circle'</li>
	      <li>Material: type = 'String', value = 'aluminum' </li>
	  </ul>
   </li><li> Define two input parameters:<br/>
	<ul>
		<li> Dimensions: structure = aggregate, no members
                  [the editor will add members]</li>
	    <li>Thickness: structure = scalar, type = 'Real',
                 value = 0.1</li>

	</ul>
   </li><li> Define three scalar 'Real' output parameters:<br/>

      <ul>
		<li>Area</li>
		<li>Volume</li>
		<li>Weight</li>
	  </ul>

   </li><li> Set the following class files (generated in step 1):<br/>

	<ol>
		<li>Set the editor class to PlateEditor.class, and make sure that the Package Name is set to 'examples/development/components/plate</li>
		<li>Set the executor class to PlateExecutor.class, and set the component type to activity.</li>
		<li>Set the handler class to PlateHandler.class</li>
		<li>Set the post-processor class to PlatePostProcessor.class</li>
		<li>Set the API class to PlateAPI.class</li>

	</ol>

   </li><li> Test the editor. When the
      editor GUI comes up, exit by clicking OK to
      ensure that the component will be properly
      defined for execution.

   </li><li> Test execution. The Isight Runtime Gateway will
      appear and will display the execution results.
      Modify the dimensions on the Parameters tab and
      re-execute to verify that the execution is working properly.
      Also verify the results on the Summary tab.

   </li><li> Save the component as 'plate.jar'.
   </ol>
</li><li> Either run the Isight tool 'gateway' and raise the
   Library GUI from it, or run the Isight tool 'library'
   directly.  Click on 'publish a file to the library',
   select the JAR file created above, and click OK.

</li><li>You may now build models containing plate components.</li>
</ol>
</td></tr>

<th colspan=2><a name="oscmd">OSCommand Plug-in</a></th>
	<tr><td>Description:</td>
		<td>This is an example of a custom component that uses the OSCommand plug-in to provide command execution,
		    without exposing the full OSCommand component editor to the model assembler.
		    The component's behavior is trivial - open an input file in a windowing text editor,
		    allow the user to edit the program, and then save the result as an output file parameter.
		    The only complexity is that the command to start the editor is different on different platforms.
		</td>
	</tr>
	<tr>
		<td>Support files needed:</td>
		<td>
			<ul><li><a href="mycommand/MyCommandEditor.java">MyCommandEditor.java</a> -
						Source file for the OSCommand plug-in configuration editor.
						This is called from the Design Gateway.
				</li>
				<li><a href="mycommand/MyCommandExecutor.java">MyCommandExecutor.java</a> -
						Source file for the OSCommand plug-in example.
						Sets up some parameters and then calls the OSCommand plug-in to start the editor.
      					This is called when the component is
     					executed (either locally or on the SIMULIA Execution Engine).
				</li>
				<li><a href="mycommand/MyCommandHandler.java">MyCommandHandler.java</a> -
						is called in response to changes made to the
      					model outside of the component which may require
      					changes inside the component to maintain model
      					validity (or at least the posting of validation
      					errors and/or warnings).
				</li>
				<li><a href="mycommand/MyCommand.xml">MyComand.xml</a> -
						XML Descriptor of this component that defines properties, parameters,
						and the executor, editor, and handler classes for the component.
						This file is not necessary if you use the SDK Generator to build the component.
				</li>
				<li><a href="mycommand/MyCommand.mf">MyCommand.mf</a> - Jar file manifest for the componnet.
					Not needed if you use the SDK Generator to build the component.</li>
				<li><a href="mycommand/build.bat">build.bat</a> - Windows batch file to compile the component.</li>
				<li><a href="mycommand/build.sh">build.sh</a> - Unix shell script to compile the component.</li>
			</ul>
		</td>
	</tr>
	<tr>
		<td>Instructions:</td>
		<td>
			<ol>
				<li>Use the provided build script (<a href = "mycommand/build.sh">build.sh</a> on Unix,
				   <a href="mycommand/build.bat">build.bat</a> on Windows) to compile the Java source
				   files and build the component Jar file.  You
				   MUST have a Java compiler installed, and must set
				   the environment variable JAVA_JDK to point to it.
				   You must also have Isight installed, and must set
				   the environment variable FIPER_HOME to point to it.
	   			</li>
	   			<li>Publish MyCommand.jar to the Isight library using the Library browser in the Design Gateway.
	   			<li>Create a model and drag the component MyCommand from the library browser into the Sim-Flow of the model.
	   			<li>Test the model.  It should work correctly on both Microsoft Windows any any supported Unix
	   				platform.
   			</ol>
   		</td>
   	</tr>
</table>
</body>
</html>
