Thursday, March 30, 2006

IFrame blog

I was curious to see if this would work. It does.

Friday, March 24, 2006

Close Encounters with TeraGrid

I posted some notes on getting Grid credentials set up on the TeraGrid here:
http://www.gorerle.com/vlab-wiki/index.php?title=Using_TeraGrid
on the VLAB wiki.

After I complained, Eric Roberts (TeraGrid user portal developer) sent me these notes: TG Portal Notes

I've also expanded the notes considerably, with some additional notes on installing the Espresso codes (or failures of such) and invoking them via Globus.

Thursday, March 16, 2006

Jetspeed 2 Notes: Getting Started

-------------------------------------
Jetspeed 2 Notes
-------------------------------------

* I'm doing this on my MacBook, by the way.

* Grabbed the "Derby" version of Jetspeed 2 to avoid installing a database. The installation was clean, just used notes from

http://portals.apache.org/jetspeed-2/getting-started-installer.html.


* I note the Jetspeed2 pages are a little confusing, so it is not completely clear how to do a quick start. The link above is the one to use.

* Noted that I did need to set JAVA_HOME for Tomcat to work, so I did. /usr/bin/java is a link that points to /System/Library/Frameworks/JavaVM.framework/Commands/java. Looking around a bit, I see that there is also /System/Library/Frameworks/JavaVM.framework/Home. This is the one. Edit ~/.bashrc and add "export JAVA_HOME=System/Library/Frameworks/JavaVM.framework/Home". Source it and you should be set.

* Fired up the tomcat server, used "tail -f catalina.out" to get some feel for when things were up and running, and then pointed browser at http://localhost:8080/jetspeed/portal. Success.

* Logged in as admin/admin of course. Was immediately faced with having to reset my password.
Could not do anything until I reset, and could not use the same default value. Damn security. In case you are wondering, my admin password is now "admin2".

-------------------------------------
Adding a portlet the hard way.
-------------------------------------

* OK, now I want to deploy a portlet. I'm going to try the IFrame portlet (of course) from the OGCE2 release. This will be interesting, since I will have to a) figure out the web.xml and b) figure out how to get Jetspeed to recognize it.

* So far, so bad. I made the IFrame portlet. Then took a took at the guidelines here:
http://portals.apache.org/jetspeed-2/guides/guide-simple-portlet.html. So I made sure I used the simplest web.xml possible and remade the war. My web.xml is below.


<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
<display-name>IFrame Portlet</display-name>
<description>
IFrame portlet
</description>
</web-app>



The jetspeed deployment process will convert this as necessary.

* Make the war with "cd /path/to/iframe-portlet/; jar -cf iframe-portlet.war".

* I then copied the war into webapps/jetspeed/WEB-INF/deploy. Jetspeed magic took over for a while (I followed along in catalina.out). Then pointed browser at http://localhost:8080/jetspeed/portal/iframe-portlet.psml. Of course things didn't work, but the first failure was a little obscure.

* Looking again at the Jetspeed porltet guide, I realized I needed to make a PSML file. So I made one. This is very BAD since it is easy to make mistakes with the PSML creation. Anyway, I made one called iframe-portlet.psml. It looks like this:

<page>
<defaults
skin="orange"
layout-decorator="tigris"
portlet-decorator="tigris"
/>
<title>The Glorious IFrame Portlet</title>
<metadata name="title" xml:lang="en">Junk</metadata>
<fragment id="iframe" type="layout" name="jetspeed-layouts::VelocityOneColumn">
<fragment id="iframe-1" type="portlet" name="iframe::IFramePortlet">
<property layout="TwoColumns" name="row" value="0" />
<property layout="TwoColumns" name="column" value="1" />
</fragment>
</fragment>

<security-constraints>
<security-constraints-ref>public-view</security-constraints-ref>
</security-constraints>
</page>


I placed this under ~/ApacheJetspeed2.0/webapps/jetspeed/WEB-INF/pages/. I then pointed the browser to http://localhost:8080/jetspeed/portal/iframe-portlet.psml. I of course got an error.

Title Error: Cannot pass a null PortletDefinition to a PortletEntity.
Failed to retrieve Portlet Definition for iframe::IFramePortletFailed to retrieve Portlet Definition for iframe::IFramePortletjava.lang.IllegalArgumentException: Cannot pass a null PortletDefinition to a PortletEntity.Failed to retrieve Portlet Definition for iframe::IFramePortletFailed to retrieve Portlet Definition for iframe::IFramePortlet

* Success! It looks a little crappy, but I found that the error was in my fragment name. Change this:

<fragment id="iframe-1" type="portlet" name="iframe::IFramePortlet">

to this:

<fragment id="iframe-1" type="portlet" name="iframe-portlet::IFramePortlet">


The name attribute should have the value "${portlet.war.name}::${portlet.name}. The first part (${portlet.war.name}) is the name of the portlet war file, minus the .war. So I had iframe-portlet.war, so I have to use iframe-portlet. The second part comes from the value of the <portlet-name/> tag in the portlet.xml file.

I hope all of this is obvious.... See http://portals.apache.org/jetspeed-2/multiproject/jetspeed-deploy-tools/.

* You can also add things to default-page.psml or one of the other PSML files if you prefer.

-----------------------------------------------
Adding portlets to a layout.
-----------------------------------------------
* OK, you can always edit PSML stuff by hand, but obviously this is no good for people don't have write permission to the jetspeed directories.

* One way to do this is as follows:
1. Log in
2. In the upper right corner, click the edit ("pencil") icon. If unsure, there is a tooltip popup
over the icon.
3. You should now see three icons in the upper right: View, Help, and Add a Portlet. This is
the + ("plus") icon.
4. Click add a portlet. You should get a popup window.
5. Search for your portlet by name or by keyword (note keywords are in the portlet.xml).
6. Add it.

* Try something like "RSS" and use keyword searching.

* Note also you can do a similar thing to add tabs to the top menu. Enter edit mode first. You should
see a mysterious "Add Page" button next to a text field. Hmm. So type in a name and you will get a new tab across the top.

* Click the tab you just created. It will be filled completely with the lefthand navigator window, which I found confusing at first. Enter Edit mode by clicking the pencil icon in the upper right and then add a portlet as before.

* The main problem with this approach is that you have to know or guess at the available portlets. Hopefully there is a way to do this differently.

* You may also wonder at this point if there is a way to remove these tabs that you are creating. There is a way. Log in as the administrator and click the Portal Site Manager. You will need to click "Jetspeed Administrative Portlets" on the lefthand side. Under the tree view, find the user account that includes all the new tabs that you added. Click the tab to cause it to appear in the right hand column. Click delete.

Tuesday, March 07, 2006

Maven 2 Web Site and Unit Report Generation

* I was interesting in both the Xdoc and JUnit dashboard capabilities of Maven 2 (and how they compared
to Maven 1).

* To start, Maven 2 has a nice built in archetype that you can use to create an entire site. From the
Maven 2 User Guide, you use the following piece of command line magic:

mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-site

* Unfortunately this didn't work. It is supposed to create a project called my-app with directories
site, test, and main under my-app/src, but only site was created. So I used the above archetype
command, then used the default archetype to make normal project in the /tmp directory, and then
cp -r'd the main and test directories.

* I also had to copy the Junit <dependency/> stuff into the pom.xml of the site archetype.

* Next I ran "mvn site" but had to do this twice for some reason to get a successful build. The
token site was built in my-app/target/site.

* OK, now I run the tests. Looking around, I finally found the target that actually creates the
html dashboard reports for your test. It is

mvn surefire-report:report

The resulting report summary of your tests will be placed in target/site/surefire-report.html

* But note however that "mvn site" and "mvn surefire-report:report", while they both make HTML files
under the target/site directory, will not be combined in the same XDoc generated page.

* So how do you make extra stuff show up in the generated site? All of the web page configuration
is contained in my-app/src/site/site.xml. Open this and edit. Add the <item> to the <menu> section.


<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="Maven">
<bannerLeft>
<name>Maven</name>
<src>http://maven.apache.org/images/apache-maven-project.png</src>
<href>http://maven.apache.org/</href>
</bannerLeft>
<bannerRight>
<src>http://maven.apache.org/images/maven-small.gif</src>
</bannerRight>
<body>
<links>
<item name="Apache" href="http://www.apache.org/" />
<item name="Maven 1.0" href="http://maven.apache.org/"/>
<item name="Maven 2" href="http://maven.apache.org/maven2/"/>
</links>

<menu name="Maven 2.0">
<item name="APT Format" href="format.html"/>
<item name="FAQ" href="faq.html"/>
<item name="Xdoc Example" href="xdoc.html"/>
<!-- Added this item here -->
<item name="Unit Reports" href="surefire-report.html"/>
</menu>

${reports}

</body>
</project>


* Also note that the ${reports} will add all the usual maven "Project Info" links on the left hand
side bar.

* Maven's pom also has a <reporting> section. Looks like this:
<project>
...
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
</plugin>
</plugins>
</reporting>
...
</project>

This tag is at the same level as <dependencies>, <build>, etc.


* I ran this, by the way, with "mvn clean surefire-report:report site" to clean, make the surefire
report, and then make the site.