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
html
and
body
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.

CreateYourOwnSimpleServletPortal

= 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.

{{{


ViewPage
/WEB-INF/security/login/simple.jsp

MySimplePortlet
org.apache.portals.bridges.common.GenericServletPortlet

}}}

= 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.

Requirements

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/


Windows

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">


Building

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


Running

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

Tuesday, August 16, 2005

AndroMDA Cartridges - AndroMDA Cartridges will tell you the required elements of a AndroMDA Cartridge (namespace.xml, andromda-cartridge.xml and templates).
See the Profile for classes that represent uml objects.

cartridges/andromda-bpm4struts/src/java/org/andromda/cartridges/bpm4struts/Bpm4StrutsProfile.java
cartridges/andromda-bpm4struts/src/java/org/andromda/cartridges/bpm4struts/Bpm4StrutsUtils.java

See the metafacades directory for classes that represent uml profiles.

cartridges/andromda-bpm4struts/src/java/org/andromda/cartridges/bpm4struts/metafacades
cartridges/andromda-bpm4struts/src/java/org/andromda/cartridges/bpm4struts/metafacades/StrutsAttributeLogicImpl.java
cartridges/andromda-bpm4struts/src/java/org/andromda/cartridges/bpm4struts/metafacades/StrutsJspLogicImpl.java
cartridges/andromda-bpm4struts/src/java/org/andromda/cartridges/bpm4struts/metafacades/StrutsManageableEntityAttributeLogicImpl.java
cartridges/andromda-bpm4struts/src/java/org/andromda/cartridges/bpm4struts/metafacades/StrutsParameterLogicImpl.java
cartridges/andromda-bpm4struts/src/java/org/andromda/cartridges/bpm4struts/metafacades/StrutsUseCaseLogicImpl.java

Monday, August 15, 2005

Code generation is discussed on this tss article. People from XDoclet, Middlegen, and AndroMDA contribute ideas on the best way to use meta data.

Friday, July 22, 2005

This is completely unrelated to Geronimo but important to creative people. When creating a name use something that the reader wants. In this case it is a job, Media Job.

Tuesday, July 19, 2005

I am at ApacheCon Europe 2005 and the focus is on Java, Spring has been integrated in JetSpeed, ServiceMix, AndroMDA, Security, clustering, transaction managment, and POJOs. POJOs are important in web services jaxrpc which uses Java Service Enpoint JSE technology.

Tuesday, July 12, 2005

Thursday, June 30, 2005

The Apache Geronimo code source can be imported into eclipse. Or, preferably, one can change the workspace to the location of the directory where subversion checked out geronimo (the directory containing the directory geronimo). Proceed with the creation of a "New Java Project" by naming the project geronimo. Eclipse then reports some 30,000 compile errors. Enabling the "assert" keyword resoves a large number of these. Remove all the libraries detected by Eclipse and proceed to add the following libraries from your maven repository. Libraries used by geronimo include,
  • cglib (resolves 1% of the errors)
  • mx4j and mx4j remote (resolves less than 2% of the errors)
  • log4j (resolves less than 1% of the errors)
  • xml-resolver (resolves less than 1% of the errors)
  • junit (25% of the errors) and is only required for the tests
The geronimo-kernel, geronimo-system, geronimo-common and a slew of j2ee specs should now compile successfully. The j2ee specs compiled include transactions, ejb, jms, servlet, jsp, connectors, activation, deployment, authorization contract for containers, jmx, javamail, xml registries, saaj, jaxrcp, j2ee, and corba. Notice that geronimo-kernel and geronimo-deployment have circular dependency. Then add the xmlbeans library.
  • xmlbeans (resolves 51% of the errors)
XMLBeans is a special case because this is required by the generated code, but is no the less required at runtime.
  • concurrent (2%)
  • exolab castor 0.9.5.3 (6%)
  • axis 1.3 (4%)
Concurrent, Castor, and Axis resolve a number of build errors suggesting that each play an important role in Geronimo compilation. At this point the web service and axis modules are compiling.
  • howl (%)
Howl assists in Geronimo transaction managment. The Transaction module is now compiling.
  • activeio
  • ant
  • antlr
  • commons-collections
  • commons-cli
  • commons-fileupload
  • commons-httpclient
  • commons-io
  • commons-jelly
  • commons-logging
  • commons-modeler
  • commons-primatives
  • maven
  • regexps
  • velocity
These libraries result in the resolution of 6% of the compile errors.
  • hsqldb
HSQLDB is required for some of the security tests. Otherwise the security module is now compiling.
  • openejb
  • openorb
These libraries support common j2ee implementations of ejb and corba.

Security is now compiling.
  • axiondb
  • axis scout
  • bountycastle
  • catalina
  • derby
  • jetty
  • mockobjects
  • objectweb asm
  • spring
  • xfire
  • xstream
The frameworks that are extended by Geronimo are AxionDB, Axis Scout, BountyCastle, Catalina, Derby, Jetty, MockObjects, ObjectWeb ASM, Spring, XFire, and XStream. Adding these libraries resolves 10% of the compile errors.
  • geronimo-axis-builder-1.0-SNAPSHOT.jar
  • geronimo-client-builder-1.0-SNAPSHOT.jar
  • geronimo-connector-builder-1.0-SNAPSHOT.jar
  • geronimo-j2ee-builder-1.0-SNAPSHOT.jar
  • geronimo-j2ee-schema-1.0-SNAPSHOT.jar
  • geronimo-jetty-builder-1.0-SNAPSHOT.jar
  • geronimo-naming-1.0-SNAPSHOT.jar
  • geronimo-naming-builder-1.0-SNAPSHOT.jar
  • geronimo-security-builder-1.0-SNAPSHOT.jar
  • geronimo-service-builder-1.0-SNAPSHOT.jar
  • geronimo-spring-builder-1.0-SNAPSHOT.jar
  • geronimo-tomcat-builder-1.0-SNAPSHOT.jar
  • openejb-builder-1.0-SNAPSHOT.jar
These xmlbeans libraries represent configuration utilities used for reading and writing xml input and output. Adding these libraries to your Eclipse project classpath resolves 12% of the compile errors. All Geronimo modules that suffix "-builder" represent some kind of configuration processing library.

The remaining errors were caused by duplicate class files. I deleted them to move forward.

This is where it gets interesting. The server is started using the org.apache.geronimo.system.main.Daemon class in the system module. It requires the server.jar to be on the classpath. It is found in the modules/assembly/target/geronimo-1.0-SNAPSHOT/bin directory. Debugging this now. There are several errors that need to be work out.

Wednesday, June 29, 2005

The Eclipse UML2 Project is rapidly becoming a strong alternative to using MagicDraw for Andromda.
There are some electronic books listed on the Apache Geronimo Documentation page. Authors include Katia Aresti González, David Blevins, Aaron Mulder.
It never hurts to browse the Apache Geronimo Javadoc API.
There are five Apache Geronimo Mailing Lists, dev, user, source, pmc, and tck. The last two are reserved for people doing project managment and certification respectfully.
Get to know the Apache Geronimo Committers.