Everything Java Apache Geospatial Open Source. Hello Shinning Stars!!! Vincent Massol, Raphael Luta, Santiago Gala, Carsten Z.

Tuesday, October 25, 2005

I am going to write a MapServer portlet. The mapserv cgi script can be used on the command line like this.

./mapserv QUERY_STRING="layer=Citylimits&layer=Citywards&zoomdir=1&zoomsize=2&map=%2Fms4w%2FApache%2Fhtdocs%2Fmap%2FMorganCo.map&program=%2Fcgi-bin%2Fmapserv&root=%2Fmap&map_web_imagepath=%2Ftmp%2F&map_web_imageurl=%2Fmap%2Ftmp%2F&map_web_template=map.html"

The parameter program will be replaced by a servlet mapping. Therefore all request to the url, /browse/map, will be redirected to the mapserver.

The template will have all
tags removed so that it is an html page fragment.

A MapServerPortlet class will implement the doView method and encapsulate the mapserv binary execution. The portlet requires the following settings, the location of the mapserv binary, the location of the map file, the initial layer to display, the template to use, the absolute uri to the servlet mapping, the temporary image directory, the temporary image uri, the zoom mode, the zoom value.

A Jetspeed bridge is required. It is based on the Perl bridge which was too busy for the mapserver needs, so I just adapted it to the simplicity of mapserver.
MapServer 4.6 requests can probably be broken down into the following steps. Here the common name is presented along with its corresponding code fragment and/or the name of the source file.
  • Create a mapserver object using mapserv.c.loadParams and mapserv.c.loadMap
  • Parse parameters mapserv.c.loadForm
  • Determine the mode. One of three are know to me, browse,query, and nquery. This is determined by the msObj.Mode property. Most of this logic is in mapserv.c.main.
Only the Browse mode is explained here.
  • Extent, scale, and query files are evaluated using mapserv.c.setExtent mapserv.c.checkWebScale and mapserv.c.msLoadQuery
  • Images are generated using maptemplate.c.msGenerateImages
  • Map is drawn using mapdraw.c.msDrawMap
  • Map is drawn using mapdraw.c.msDrawQueryMap
  • Legend is drawn using maplegend.c.msDrawLegend
  • Scalebar is drawn using mapscale.c.msDrawScalebar
  • Reference map is drawn using mapraster.c.msDrawReferenceMap

NOTES : Nice things to have.
  • Two maps on one page.

Sunday, October 23, 2005

Implicit versus explicit application development. Creating a application that relies on implicit configuration or rules is a bad idea. I came across a struts configuration in Jetspeed that made me think of this subject. A $M$P pattern indicated that pages exist with the /module/path. Although this case is not an implicit declaration programming with out explicitly declaring classes, configuration, or properties will only create confusion and hard to debug applications.

Saturday, October 22, 2005

Another short tutorial on the Jetspeed portlet.


= The portlet.xml =

Add a new portlet tag to one of the existing portlet applications. The security application is know to work.

edit $JETSPEED2_SRC/applications/security/src/webapps/WEB-INF/portlets.xml

The portlet tag can be placed anywhere inside the root element called portlet-app.





= The psml =

Add a fragment tag to one of the psml files. The default page is appropriate.

edit $JETSPEED2_SRC/src/webapp/WEB-INF/pages/default-page.psml

Note that the id must be unique. Using the same id twice will confuse Jetspeed. There is no error handling regarding this point so be creative.



= The JSP =

We did say that this is a simple servlet portlet, so the JSP will be simple.

edit $JETSPEED2_SRC/applications/security/src/webapps/WEB-INF/security/login/simple.jsp

Here are the contents of a very simple JSP.

<%@page import="java.util.Date"%>
The time is <%=(new Date()).toString()%>

Friday, October 21, 2005

Please read QuickstartForTheImpatient before before proceeding.

To simplify this document $JS2_PAGES will represent the directory path src/webapp/WEB-INF/pages of the Jetspeed 2 source code.

= Jetspeed Portlet Layout =

The Jetspeed portlet layout is defined by a number of mechanisms. The $JS2_PAGES file structure has an effect on the layout. Here are some modifications you can do without breaking the build.

== Change the Default Page ==
Modify the column and row indexes for some or all of the portlets on the welcome page($JS2_PAGES/default-page.psml).

== Add Additional Links ==
Create a file called myLink.link in the directory $JS2_PAGES. Refer to or copy one of the other .link files for the proper syntax.

== Create a New Tab ==
Tabs can be created by simply creating a psml file in the $JS2_PAGES directory. Copy $JS2_PAGES/default-page.psml to $JS2_PAGES/my-page.psml. Note that the security-constraint tag in psml defines the roles authorized to view this page.

== Modify the Menu ==
The left menu is defined in the folder.metadata file of each directory of the $JS2_PAGES directory.
I see that in Jetspeed's demo portlets the web.xml defines the following tags security-constraint, login-config, and multiple security-role tags. The meaning of these are explained here.

security-constraint defines a list of web resources (urls) protected by web security and a list of roles authorized to access these resources.

login-config defines the authentication method and the realm name. Optionally a login page and a error page can be defined.

The security-role tag must appear if this is a custom role that does not already exist in the container.
Seems there are some patches to do for Jetspeed.

demo/src/webapp/WEB-INF/jetspeed-portlet.xml and demo/src/webapp/WEB-INF/portlet.xml could use some more languages. Some dc:title tags with attributes xml:lang="en" to support Japanese, Chinese, Spanish, Italian as specified in the file resources.

Tuesday, October 18, 2005

I am writing a JetSpeed 2 quickstart development guide for the impatient.


JDK 1.4.1 or higher
Maven 1.0.2
Tomcat 5.5.12

Set the following environment variables.

Linux and Unix

export MAVEN_HOME=/home/opensource/apache-maven-1.0.2/
export CATALINA_HOME=/home/opensource/apache-tomcat-5.5.12/
export JETSPEED2_SRC=/home/opensource/jetspeed-2/


set MAVEN_HOME=/home/opensource/apache-maven-1.0.2/
set CATALINA_HOME=/home/opensource/apache-tomcat-5.5.12/
set JETSPEED2_SRC=/home/opensource/jetspeed-2/

Modify Tomcat's tomcat-users.xml to contain the following lines

<role rolename="manager">
<user username="j2deployer" password="j2deployer" roles="manager">


maven -Dorg.apache.jetspeed.server.home=$CATALINA_HOME -Dorg.apache.jetspeed.server.shared=$CATALINA_HOME/shared/lib -Dorg.apache.jetspeed.deploy.war.dir=$CATALINA_HOME/webapps -Dorg.apache.jetspeed.services.autodeployment.user=j2deployer -Dorg.apache.jetspeed.services.autodeployment.password=j2deployer -Dorg.apache.jetspeed.catalina.version.major=5.5 -Dorg.apache.jetspeed.project.home=$JETSPEED2_SRC initMavenPlugin

maven -Dorg.apache.jetspeed.server.home=$CATALINA_HOME -Dorg.apache.jetspeed.server.shared=$CATALINA_HOME/shared/lib -Dorg.apache.jetspeed.deploy.war.dir=$CATALINA_HOME/webapps -Dorg.apache.jetspeed.services.autodeployment.user=j2deployer -Dorg.apache.jetspeed.services.autodeployment.password=j2deployer -Dorg.apache.jetspeed.catalina.version.major=5.5 -Dorg.apache.jetspeed.project.home=$JETSPEED2_SRC j2:start.test.server

maven -Dorg.apache.jetspeed.server.home=$CATALINA_HOME -Dorg.apache.jetspeed.server.shared=$CATALINA_HOME/shared/lib -Dorg.apache.jetspeed.deploy.war.dir=$CATALINA_HOME/webapps -Dorg.apache.jetspeed.services.autodeployment.user=j2deployer -Dorg.apache.jetspeed.services.autodeployment.password=j2deployer -Dorg.apache.jetspeed.catalina.version.major=5.5 -Dorg.apache.jetspeed.project.home=$JETSPEED2_SRC allClean allBuild


maven -Dorg.apache.jetspeed.server.home=$CATALINA_HOME -Dorg.apache.jetspeed.server.shared=$CATALINA_HOME/shared/lib -Dorg.apache.jetspeed.deploy.war.dir=$CATALINA_HOME/webapps -Dorg.apache.jetspeed.services.autodeployment.user=j2deployer -Dorg.apache.jetspeed.services.autodeployment.password=j2deployer -Dorg.apache.jetspeed.catalina.version.major=5.5 -Dorg.apache.jetspeed.project.home=$JETSPEED2_SRC j2:start.production.server

maven -Dorg.apache.jetspeed.server.home=$CATALINA_HOME -Dorg.apache.jetspeed.server.shared=$CATALINA_HOME/shared/lib -Dorg.apache.jetspeed.deploy.war.dir=$CATALINA_HOME/webapps -Dorg.apache.jetspeed.services.autodeployment.user=j2deployer -Dorg.apache.jetspeed.services.autodeployment.password=j2deployer -Dorg.apache.jetspeed.catalina.version.major=5.5 -Dorg.apache.jetspeed.project.home=$JETSPEED2_SRC j2:quickStart

I don't understand why the org.apache.jetspeed.project.home is required. Can't this be obtained from Maven.

Tomcat 5.5 is telling me that "[/jetspeed] startup failed due to previous errors". The errors and warnings are in order of appearance.

WARNING: A docBase /home/opensource/soft/bin/apache-tomcat-5.5.12/webapps/jetspeed inside the host appBase has been specified, and will be ignored

INFO: WARNING: Security role name admin used in an without being defined in a

SEVERE: Error filterStart