<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <title>Build and Deploy ReadMe</title>
  <style>
  p.indented { margin-left: 40px; }
  div.indented { margin-left: 40px; }
  div.indented2 { margin-left: 15px; }
  div.indented2 { margin-left: 15px; }
  td.code {vertical-align: top; text-align: center; font-family: monospace; color: rgb(0, 0, 153);}
  span.code {font-family: monospace; color: rgb(0, 0, 153);}
  </style>
</head>
<body>
<p>This directory contains design, documentation, and development
materials
associated with the SEEK EcoGrid (ecogrid).
</p>
<p><br>
<big style="font-weight: bold;">Building the GAR file</big><br>
</p>
<p>The <span class="code">build.xml</span>
file can be used to build the Metacat Ecogrid implementaion
gar file. <br>
</p>
<span style="font-weight: bold;">Overview</span><br
 style="font-weight: bold;">
First you build the gar using the command "ant gar",&nbsp; the
gar file will be created in the directory <span class="code">build/lib</span>
directory, then you may deploy it
to globus toolkit or tomcat.<br>
<br>
<span style="font-weight: bold;">Detailed steps for building the GAR
File from scratch:</span><br>
<ol>
</ol>
You may modify the build file <span class="code">build.xml</span>
to create your own ecogrid
implementation. The main steps are:<br>
<br>
<div class="indented">
1. Create a directory under <span class="code">src/ecoinformatics/ecogrid</span>
and put the
implementaion source code there.<br>
</div>
<br>
<div class="indented">
2. Put the lib files (e.g. jar files) into lib directory.
</div>
<br>
<div class="indented">
3. Modified the build.xml. The main property you need changes are:<br>
<br>
<div class="indented2">
<table cellpadding="2" cellspacing="2" border="1">
  <tbody>
    <tr>
      <td class="code">impl.package.dir</td>
      <td style="vertical-align: top;">the directory to put your
implementation source code</td>
    </tr>
    <tr>
      <td class="code">impl.package.name</td>
      <td style="vertical-align: top;">the package name of your
implementation</td>
    </tr>
    <tr>
      <td class="code">impl.class.name</td>
      <td style="vertical-align: top;">the class name of your
implementation</td>
    </tr>
    <tr>
      <td class="code">baseURL</td>
      <td style="vertical-align: top;"> the base url which your service
will be deployed.</td>
    </tr>
    <tr>
      <td class="code">clientProxyURL</td>
      <td style="vertical-align: top;">as same as baseURL</td>
    </tr>
    <tr>
      <td class="code">service.name</td>
      <td style="vertical-align: top;">service name in service container</td>
    </tr>
    <tr>
      <td class="code">service.instance</td>
      <td style="vertical-align: top;"> instance name created by
service factory</td>
    </tr>
  </tbody>
</table>
<br>
<br>
</div>
</div>
<span style="font-weight: bold;">
Detailed steps for building the GAR File by pulling the source code
from the SEEK repository:<br>
<br>
</span>The main steps are (assume the user is "foo"):<br>
<br>
<div class="indented">
1. First you must build Metacat. The best thing to do is to pull the
source code directly from the SEEK repository.<br>
<div style="margin-left: 40px;">Location <span
 style="font-family: monospace; color: rgb(0, 0, 153);">org.ecoinformatics.org/cvs<br>
</span>Pull: <span
 style="font-family: monospace; color: rgb(0, 0, 153);">cvs co -P
metacat<br>
</span></div>
<div style="margin-left: 40px;">To build Metacat you may also need to
pull the <span style="font-family: monospace; color: rgb(0, 0, 153);">utilities</span>
directory<span class="code"><br>
</span></div>
</div>
<br>
<div class="indented">
2. Pull the source from SEEK under <span
 style="font-family: monospace; color: rgb(0, 0, 153);">seek/projects/ecogrid</span>
<br>
<div style="margin-left: 40px;">Location <span
 style="font-family: monospace; color: rgb(0, 0, 153);">org.ecoinformatics.org/cvs<br>
</span>Pull: <span
 style="font-family: monospace; color: rgb(0, 0, 153);">cvs co -P </span><span
 style="font-family: monospace; color: rgb(0, 0, 153);">seek/projects/ecogrid</span><br>
<span style="font-family: monospace; color: rgb(0, 0, 153);"><br>
</span></div>
<div style="margin-left: 40px;">The build file will be:<br>
<span class="code">/home/foo/seek/projects/ecogrid/src/build.xml<br>
<br>
</span></div>
<div style="margin-left: 40px;">The implementation will be in:<br>
<span class="code">/home/foo/seek/projects/ecogrid/src/ecoinformatics/ecogrid</span><br>
</div>
</div>
<br>
<div class="indented">
3. Modified the <span
 style="font-family: monospace; color: rgb(0, 0, 153);">build.xml</span>.
The main properties you need changes are:<br>
<br>
<div class="indented2">
<table cellpadding="2" cellspacing="2" border="1"
 style="text-align: left;">
  <tbody>
    <tr>
      <td style="vertical-align: top; text-align: center;"><span
 style="font-weight: bold;">Property Name</span><br>
      </td>
      <td style="vertical-align: top; text-align: center;">&nbsp;<span
 style="font-weight: bold;">Description</span><br
 style="font-weight: bold;">
      </td>
      <td style="vertical-align: top; text-align: center;"><span
 style="font-weight: bold;">Example Value</span><br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;"><span
 style="font-family: monospace; color: rgb(0, 0, 153);">impl.package.dir</span></td>
      <td style="vertical-align: top;">The directory to put your
implementation source code<br>
      <span style="font-weight: bold;">Note:</span> This is the
directory where the source of the metacat implementation must reside.
But the value is relative to the "src" directory, not relative to the
directory where build file is located.<br>
      </td>
      <td class="code">org/ecoinformatics/ecogrid/metacat/impl</td>
    </tr>
    <tr>
      <td class="code">impl.package.name</td>
      <td style="vertical-align: top;">The package name of your
implementation<br>
      </td>
      <td class="code">org.ecoinformatics.ecogrid.metacat.impl</td>
    </tr>
    <tr>
      <td class="code">impl.class.name</td>
      <td style="vertical-align: top;">The class name of your
implementation</td>
      <td class="code">MetacatImpl</td>
    </tr>
    <tr>
      <td class="code">baseURL</td>
      <td style="vertical-align: top;"> The base url which your service
will be deployed.</td>
      <td class="code">http://localhost:8080/ogsa/services</td>
    </tr>
    <tr>
      <td class="code">clientProxyURL</td>
      <td style="vertical-align: top;">As same as baseURL</td>
      <td class="code">http://localhost:8080/ogsa/services</td>
    </tr>
    <tr>
      <td class="code">service.name</td>
      <td style="vertical-align: top;">Service name in service container</td>
      <td class="code">metacat</td>
    </tr>
    <tr>
      <td class="code">service.instance</td>
      <td style="vertical-align: top;"> Instance name created by
service factory<br>
      <span style="font-weight: bold;">Note:</span> This needs to point
to the metcat directory, where ever it is
that you pulled or built it etc.<br>
      </td>
      <td class="code">../../../metacat</td>
    </tr>
  </tbody>
</table>
<br>
<br>
</div>
</div>
<p>What should we do if we need to update <span
 style="font-family: monospace; color: rgb(0, 0, 153);">resultset.xsd</span>
and/or <span class="code">query.xsd</span>?<br>
</p>
<div style="margin-left: 40px;">Because there are some bugs in AXIS,
some stub files which
automatically generated could
NOT match the schema. So we had to modify the stubs files manually. The
modified stub files are: <span
 style="font-family: monospace; color: rgb(0, 0, 153);">ANDType.java</span>,
<span class="code">ORType.java</span>
and
<span class="code">AnyContentType.java</span>.
In cvs, those files have
correct implementation.
</div>
<p style="margin-left: 40px;">So if you change something in <span
 style="font-family: monospace; color: rgb(0, 0, 153);">resultset.xsd</span>
and <span class="code">query.xsd</span>
which has
no relation to the
three java files (in schema they are AND, OR, and AnyContent
complextTypes), you could NOT
commit the changes of those three java file to CVS. You should delete
the modified copy
and check out the cvs newest version for them. The other java files can
be checked into cvs.
</p>
<p style="margin-left: 40px;">If you change something about those three
files, you should merge
the new copy and cvs version before you commit the file.<br>
</p>
<big style="font-weight: bold;">Deploying the GAR<br>
</big><br>
<span style="font-weight: bold;"><span style="color: rgb(204, 0, 0);">IMPORTANT:</span>
If you have already deployed into GLOBUS</span><br>
If you have already deployed into Globus, you should first "undeploy":<br>
<div style="margin-left: 40px;"><span class="code">ant undeploy
-Dgar.id=org</span><br>
(The org is prefix of file name in gt3/undeploy/org-undeploy.xml)</div>
<br>
<br>
<span style="font-weight: bold;">Deploying</span><br>
To deploy the EcoGrid Metacat GAR file you MUST deploy it into both
Globus and Tomcat.<br>
<br>
<br>
<span style="font-weight: bold;">First, deploy the EcoGrid Metacat GAR
file into Globus:</span><br>
<br>
<div class="indented">
Change directory to the root of your globus installation (this
would be your $GLOBUS_DIRECTORY env. var.) <br>
Execute the following command: <br>
<span style="font-family: monospace; color: rgb(0, 0, 153);">cd
$GLOBUS_DIRECTORY</span><br>
<span class="code">ant
deploy
-Dgar.name=/home/foo/seek/projects/ecogrid/build/lib/org.ecoinformatics.ecogrid.EcogridSoap.MetacatImpl.gar</span>
</div>
<br>
<br>
<span style="font-weight: bold;">Then deploy into Tomcat:<br>
<br>
</span>
<div style="margin-left: 40px;"><span
 style="font-weight: bold; color: rgb(204, 0, 0);">IMPORTANT</span>:
Before deploying into Tomcat make sure the mime-types have set up
correctly for gt3:<br>
<br>
<br>
<span class="code">cd $CATALINEA_HOME<br>
vi conf/web.xml</span><br>
<br>
Add these line anywhere in the file:<br>
<span class="code">
&lt;mime-mapping&gt;<br>
&nbsp;&nbsp; &lt;extension&gt;gwsdl&lt;/extension&gt;<br>
&nbsp;&nbsp; &lt;mime-type&gt;text/xml&lt;/mime-type&gt;<br>
&lt;/mime-mapping&gt;
&lt;mime-mapping&gt;<br>
&nbsp;&nbsp; &lt;extension&gt;wsdl&lt;/extension&gt;<br>
&nbsp;&nbsp; &lt;mime-type&gt;text/xml&lt;/mime-type&gt;<br>
&lt;/mime-mapping&gt;
&lt;mime-mapping&gt;  <br>
&nbsp;&nbsp; &lt;extension&gt;xsd&lt;/extension&gt;<br>
&nbsp;&nbsp; &lt;mime-type&gt;text/xml&lt;/mime-type&gt;<br>
&lt;/mime-mapping&gt;
<br></span>
<br>
Now deploy into Tomcat:<br><br>
<span class="code">
ant deployTomcat -Dtomcat.dir=yourtomcathomedir</span>
<br>
<br>
</div>
<br>
<div style="margin-left: 40px;"><span
 style="font-weight: bold; color: rgb(204, 0, 0);">IMPORTANT</span>:
When you try to deploy services to Tomcat, the old server-config.wsdd
in <span class="code">tomcat/webapps/ogsa/WEB-INF</span> will NOT be
overwritten by a new version
of it. This will cause problems and the new service will not be found.
<br>
<br>
To fixed this we have two options described below:<br>
<br>
</div>
<div class="indented"><span style="font-weight: bold;">OPTION #1:</span><br>
The first approach is to run "ant redeployTomcat":<br>
<span style="font-family: monospace; color: rgb(0, 0, 153);">cd
$GLOBUS_DIRECTORY<br>
ant
reDeployTomcat
-Dgar.name=/home/foo/seek/projects/ecogrid/build/lib/org.ecoinformatics.ecogrid.EcogridSoap.MetacatImpl.gar<br>
<br>
</span>"<span class="code">ant reDeployTomcat</span>" will delete
everything in
<span class="code">$tomcat/webapps/ogsa</span> and then copy them from
gt3, but "<span class="code">ant
deployTomcat</span>" doesn't delete the files before copying. So "<span
 class="code">ant
redployTomcat</span>" will make sure the <span class="code">server-config.wsdd</span>
file will be
updated. <br>
<br>
<span style="font-weight: bold;">NOTE</span>: Sometimes we don't want
delete everything in ogsa directory, so option #1 will not work. (We
have to use "<span class="code">ant deployTomcat</span>", see the
second option below.)<br>
<br>
<br>
<span style="font-weight: bold;">OPTION #2:</span><br>
If you must use the "<span class="code">ant deployTomcat</span>" and
modify the <span class="code">build-services.xml</span>
file in gt3 home directory. (Don't forget make a backup copy before you
modify it)<br>
<br>
In the target named "<span class="code">deployWebapp</span>", add a
parameter - <span class="code">overwrite="yes"</span>
in the third copy command. The lines will look like:<br>
<br>
<span class="code">&lt;copy toDir="${webapps.dir}/ogsa/WEB-INF/"
overwrite="yes"&gt;<br>
&nbsp;&nbsp;&lt;fileset dir="./" casesensitive="yes"&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;include name="*.wsdd"/&gt;<br>
&nbsp;&nbsp;&lt;/fileset&gt;<br>
&lt;/copy&gt;<br>
</span><br>
Note: the only thing we changed is adding a <span class="code">overwrite="yes"</span>
in copy
command.
<br>
<br>
<span class="code">cd
$GLOBUS_DIRECTORY<br>
cp build-services.xml build-services.xml.bak<br>
vi build-services.xml&nbsp;
</span>(change as described above)<br><span class="code">
ant deployTomcat -Dtomcat.dir=yourtomcathomedir</span><br>
<br>
</div>
<br>
<br>
<br>
</body>
</html>