Wednesday, September 20, 2006

maven 2

Maven 2 is working with the current code checked into the svn repository. It worked perfectly with the settings.xml below (in ~/.m2)




settings.xml


<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2006 The Apache Software Foundation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

$Id:$
-->

<!--
settings.xml

This file is placed in ~/.m2 by convention. User defined
profiles must be defined or extended with these settings
to perform a complete J2 build and deployment.
-->
<settings xmlns="http://maven.apache.org/POM/4.0.0">

<!-- Local Repository Location -->

<!--
<localRepository>/opt/home/jlangley/.m2/repository</localRepository>
-->

<!-- Jetspeed-2 Profile Configuration -->

<profiles>

<!-- Default Profile -->
<profile>
<id>settings</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>

<!-- Build profiles configuration -->

<!--
<org.apache.jetspeed.env.deploy.target>tomcat</org.apache.jetspeed.env.deploy.target>
<org.apache.jetspeed.env.deploy.type>full</org.apache.jetspeed.env.deploy.type>
<org.apache.jetspeed.env.deploy.db.psml>false</org.apache.jetspeed.env.deploy.db.psml>
-->

<!-- Jetspeed-2 deployment properties -->

<org.apache.jetspeed.server.home>/usr/local/tomcat</org.apache.jetspeed.server.home>
<org.apache.jetspeed.catalina.version.major>5.5</org.apache.jetspeed.catalina.version.major>
<org.apache.jetspeed.services.autodeployment.server>localhost</org.apache.jetspeed.services.autodeployment.server>
<org.apache.jetspeed.services.autodeployment.port>8080</org.apache.jetspeed.services.autodeployment.port>
<org.apache.jetspeed.services.autodeployment.user>j2deployer</org.apache.jetspeed.services.autodeployment.user>
<org.apache.jetspeed.services.autodeployment.password>j2deployer</org.apache.jetspeed.services.autodeployment.password>

<!-- Derby embedded database properties -->

<org.apache.jetspeed.test.jdbc.drivers.path></org.apache.jetspeed.test.jdbc.drivers.path>
<org.apache.jetspeed.test.database.default.name>derby</org.apache.jetspeed.test.database.default.name>
<org.apache.jetspeed.test.database.url>jdbc:derby:/tmp/j2test</org.apache.jetspeed.test.database.url>
<org.apache.jetspeed.test.database.driver>org.apache.derby.jdbc.EmbeddedDriver</org.apache.jetspeed.test.database.driver>
<org.apache.jetspeed.test.database.user></org.apache.jetspeed.test.database.user>
<org.apache.jetspeed.test.database.password></org.apache.jetspeed.test.database.password>
<org.apache.jetspeed.production.jdbc.drivers.path></org.apache.jetspeed.production.jdbc.drivers.path>
<org.apache.jetspeed.production.database.default.name>derby</org.apache.jetspeed.production.database.default.name>
<org.apache.jetspeed.production.database.url>jdbc:derby:/tmp/j2</org.apache.jetspeed.production.database.url>
<org.apache.jetspeed.production.database.driver>org.apache.derby.jdbc.EmbeddedDriver</org.apache.jetspeed.production.database.driver>
<org.apache.jetspeed.production.database.user></org.apache.jetspeed.production.database.user>
<org.apache.jetspeed.production.database.password></org.apache.jetspeed.production.database.password>

<!-- MSSQL database properties -->

<!--
<org.apache.jetspeed.test.jdbc.drivers.path>${org.apache.jetspeed.server.home}/shared/lib/jtds-1.2.jar</org.apache.jetspeed.test.jdbc.drivers.path>
<org.apache.jetspeed.test.database.default.name>mssql</org.apache.jetspeed.test.database.default.name>
<org.apache.jetspeed.test.database.url>jdbc:jtds:sqlserver://localhost:1433/j2test</org.apache.jetspeed.test.database.url>
<org.apache.jetspeed.test.database.driver>net.sourceforge.jtds.jdbc.Driver</org.apache.jetspeed.test.database.driver>
<org.apache.jetspeed.test.database.user>sa</org.apache.jetspeed.test.database.user>
<org.apache.jetspeed.test.database.password>sa</org.apache.jetspeed.test.database.password>
<org.apache.jetspeed.production.jdbc.drivers.path>${org.apache.jetspeed.server.home}/shared/lib/jtds-1.2.jar</org.apache.jetspeed.production.jdbc.drivers.path>
<org.apache.jetspeed.production.database.default.name>mssql</org.apache.jetspeed.production.database.default.name>
<org.apache.jetspeed.production.database.url>jdbc:jtds:sqlserver://localhost:1433/j2</org.apache.jetspeed.production.database.url>
<org.apache.jetspeed.production.database.driver>net.sourceforge.jtds.jdbc.Driver</org.apache.jetspeed.production.database.driver>
<org.apache.jetspeed.production.database.user>sa</org.apache.jetspeed.production.database.user>
<org.apache.jetspeed.production.database.password>sa</org.apache.jetspeed.production.database.password>
-->

<!-- HSQLDB embedded database properties -->

<!--
<org.apache.jetspeed.test.jdbc.drivers.path></org.apache.jetspeed.test.jdbc.drivers.path>
<org.apache.jetspeed.test.database.default.name>hsql</org.apache.jetspeed.test.database.default.name>
<org.apache.jetspeed.test.database.url>jdbc:hsqldb:file:/tmp/j2test;shutdown=true</org.apache.jetspeed.test.database.url>
<org.apache.jetspeed.test.database.driver>org.hsqldb.jdbcDriver</org.apache.jetspeed.test.database.driver>
<org.apache.jetspeed.test.database.user>sa</org.apache.jetspeed.test.database.user>
<org.apache.jetspeed.test.database.password></org.apache.jetspeed.test.database.password>
<org.apache.jetspeed.production.jdbc.drivers.path></org.apache.jetspeed.production.jdbc.drivers.path>
<org.apache.jetspeed.production.database.default.name>hsql</org.apache.jetspeed.production.database.default.name>
<org.apache.jetspeed.production.database.url>jdbc:hsqldb:file:/tmp/j2;shutdown=true</org.apache.jetspeed.production.database.url>
<org.apache.jetspeed.production.database.driver>org.hsqldb.jdbcDriver</org.apache.jetspeed.production.database.driver>
<org.apache.jetspeed.production.database.user>sa</org.apache.jetspeed.production.database.user>
<org.apache.jetspeed.production.database.password></org.apache.jetspeed.production.database.password>
-->

</properties>
</profile>

</profiles>

<activeProfiles>

<!-- Derby embedded database properties -->

<activeProfile>jetspeed-db-embedded-derby</activeProfile>

<!-- Drivers path configured database profile -->

<!--
<activeProfile>jetspeed-db-drivers-path</activeProfile>
-->

<!-- HSQLDB embedded database profile -->

<!--
<activeProfile>jetspeed-db-embedded-hsql</activeProfile>
-->

</activeProfiles>

</settings>

Ajax Desktop!!!

Checkout the new feature in Jetspeed 2.1 code... just go to
http://localhost:8080/jetspeed/desktop and you'll get a peek at the new ajax style portlet decorations.

It seems like the customers aren't there yet, but it certainly a great peak and great to see this sort of active development on jetspeed's core infrastructure. The admin portlets and the decorators and customization capability afforded users by the older style decoration was really starting to look pretty clunky compared to the the state of the art ajax user interfaces like Yahoo!Mail's Beta.

Tuesday, August 29, 2006

How are Pages/Tabs are selected for display by User

The behavior I wanted to understand was: "How are the pages/tabs displayed in the default-page.psml effected by the user who is logged in"?

The simple way to see this is to login and notice that you see a different set of tabs on the default-page then when you're not logged in. The difference is related to being identified as a user or guest. So, I went looking through the rules in the profiler documentation and functionality. However, I didn't see anything.

FINALY, I stumbled on the security that is encoded in each page. If you check the pages in the top level directory you'll notice that some of them express a <security-constraints-ref> for "users" and some of them have "public-view". So the decision about whether to display them is coded in the page. (I'm not sure where the "policy enforcment" is implemented though, I guess in some "page composer"/page manager.

Monday, August 28, 2006

Adjusting Height of the IFramePortlet

If you want to adjust the height of the IFrame Portlet, which you can use to display another web page within your portal...
  1. Login in to the portal as admin, then go to the Jetspeed Administrative Portlets "folder" (using the navigation links on the left).
  2. Select the Portlet Application Manager tab at the top of the page
  3. Using the tree control for "Application Tree View", expand the APP_ROOT node, demo, then select the IFrame Portlet
  4. Then in the "Portlet Application Detail" select the Preferences tab.
  5. Use the "Add Preference" form to add a new Preference with name "HEIGHT" (no quotes) and what ever value you want your portlet to be (e.g. 1000)
That's it, your IFrame portlet will now use the new height.

Friday, August 25, 2006

Additional Link Nightmare!

Argh... So I spent way too long figuring out that the links that you see in the "Additional Links" navigation element on the left hand side "menu" come from files that are stored in the various folder directories! Initially I went looking for them in the folder.metadata files but that was a red herring (I still haven't gone back and figured out what those were).... and then there's the time I wasted looking at the .psml files. Ugh.

So... the fix is simple. Just delete the *.link files from the .../pages/.... directories and you'll remove those (potentially) irritating additional links.

RSS Portlet problem

To fix the problem shown below... add a xalan.jar to $CATALINA_HOME/common/lib

You'll see the error message below where the RSS feed should be.
-------------------------------------------------------------------------------------------
Failed to load portlet org.apache.portals.applications.rss.RSSPortlet: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transformCache' defined in resource loaded through InputStream: Can't resolve reference to bean 'transform' while setting property 'constructor argument with index 0'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transform' defined in resource loaded through InputStream: Instantiation of bean failed; nested exception is org.springframework.beans.FatalBeanException: Could not instantiate class [org.apache.portals.applications.transform.impl.JetspeedTransform]; constructor threw exception; nested exception is javax.xml.transform.TransformerFactoryConfigurationError: Provider org.apache.xalan.processor.TransformerFactoryImpl not found

Thursday, August 24, 2006

Some Quick Notes on Customization

  • You can add portlets by putting them in the WEB-INF/deploy down in the target directory e.g. $HOME/lab/myPortalDevDir/target/myPortal/WEB-INF/deploy
  • You can then add the Portlet to a page by going into edit mode for the page and using the "portlet selector" (it's the button that looks like a '+'). NOTE: these portlets are added to the psml files stored in the file system. You'll lose them next time you update your portal site with % maven j2:nodbQuickStart (maybe there's a way to do an update that doesn't overwrite them, but I don't know it yet).
  • You can add new pages using the Portal Site Manager page under the "Jetspeed Administrative Portlets" folder.
  • BUT, you can't add new folders with any of the customization tools that I've seen yet. The folder definitions are in the "folder.metadata" files associated with the folders in the filesystem, e.g. ./WEB-INF/pages/_user/user/folder.metadata

Creator 2 Portlets

I found the trick for adding Portlets created in Creator2 (from Sun) here.
It boils down to tweaking the war that you export to remove the tld dicretory and the portlet.jar.

Rather than doing it David's way (which I believe might hose you if you wanted to continue development in Creator), I just opened up the exported war and made the changes by hand.

403 Forbidden

If you have problems logging in as a user with credentials (this seems to happen to users other than admin) then you just need to tweak your web.xml file.

Modify the <security-constraint> section from
<pre>Instead of:
<auth-constraint>
<role-name>*</role-name>
</auth-constraint>

Change to:
<auth-constraint>
<role-name>admin</role-name>
<role-name>user</role-name>
<role-name>manager</role-name>
</auth-constraint>

Note: I found this answer here.

Wednesday, August 23, 2006

Beginning Jetspeed

Jetspeed is an open source enterprise information portal that should provide an excellent starting place for building portal based applications or customized portals for internal use. However, there is a steep learning curve for it and though the site is filled with documentation (there are currently many errors), getting the software to work by following the current documentation is a herculean task!

Here are my notes for getting the most basic install of Jetspeed 2 running.


0. you need to install maven. NOTE: use maven 1.0.2! Maven 2.x doesn't work yet!!!!
1. you need to modify the attached build.properties and project.properties and put them in the directory you want to build your custom portal in (see below). NOTE: it's important to do this first before step 3 below.
2. % maven -DartifactId=maven-jetspeed2-plugin -DgroupId=org.apache.portals.jetspeed-2 -Dversion=2.0 plugin:download
3. % maven j2:portal.genapp
4. % maven war:install
5. % maven j2:start.production.server
then in another console
6. % maven j2:quickStart

Then you're ready to hit your local tomcat 5.5 install with your browser. The url will be the value of the
org.apache.jetspeed.portal.artifactId variable in your build.properties, so given the below build.properties it is http://localhost:8080/snafuportal

BUT YOU NEED THE FOLLOWING PROPERTIES FILES!!!!

##### build.properties
basedir = /opt/home/jlangley/lab/jetspeed/snafu
maven.repo.remote = http://www.bluesunrise.com/maven/, http://www.ibiblio.org/maven/, http://dist.codehaus.org/, http://cvs.apache.org/repository

# required portal configuration properties
org.apache.jetspeed.portal.home = /opt/home/jlangley/lab/jetspeed/snafu
org.apache.jetspeed.project.home = /opt/home/jlangley/lab/jetspeed/snafu
org.apache.jetspeed.portal.groupId = snafugroup
org.apache.jetspeed.portal.artifactId = snafuportal
org.apache.jetspeed.portal.name = My Snafu Portal
org.apache.jetspeed.portal.currentVersion = 1.0

# j2:portal.genapp properties
org.apache.jetspeed.genapp.home = /opt/home/jlangley/lab/jetspeed/snafu
org.apache.jetspeed.genapp.groupId = snafugroup


ant.home = /usr/local/ant
org.apache.jetspeed.server.home = /usr/local/tomcat
org.apache.jetspeed.server.shared = /usr/local/tomcat/shared/lib

org.apache.jetspeed.deploy.war.dir = /usr/local/tomcat/webapps
org.apache.jetspeed.catalina.version.major=5.5

org.apache.jetspeed.services.autodeployment.user=j2deployer
org.apache.jetspeed.services.autodeployment.password=j2deployer




###### project.properties
# Copyright 2004 The Apache Software Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# jetspeed.version is required is {user.home}/build.properties.
# Other properties.
jetspeed.version=2.0
pluto.version=1.0.1
portlet.api.version=1.0
servlet.api.version=2.3
myfaces.version=1.1.0
spring.version=1.1.5
portals.bridges.version=1.0
bridges.groupId=org.apache.portals.bridges
portals.bridges.common.version=1.0
portals.bridges.frameworks.version=1.0
portals.bridges.jsf.version=1.0
portals.bridges.perl.version=1.0
portals.bridges.php.version=1.0
portals.bridges.struts.version=1.2.7-1.0
portals.bridges.jpetstore.version=1.0
portals.bridges.velocity.version=1.0
commons.logging.version=1.0.3
derby.version=10.1.1.0
hsql.version=1.8.0.2

# Whether or not to include commons-logging in war files. Your container may already have this.
commons.logging.include=true

log4j.version=1.2.8
# Whether or not to include log4j in war files. Your container may already have this.
log4j.include=true

# Whether or not to include JTP api in war files. Your container may already have this.
jta.include=true

# You only need Derby if you don't supply your own database
derby.include=true

maven.mode.online = true
maven.repo.remote = http://www.bluesunrise.com/maven/, http://www.ibiblio.org/maven/, http://dist.codehaus.org/, http://cvs.apache.org/repository

# xdocs themes
maven.xdoc.theme = j2

# Display the date on the Maven web site
maven.xdoc.date = left

# Display the maven version the web site is documenting
maven.xdoc.version = ${pom.currentVersion}

# Maven Compilation Setting
maven.compile.source=1.4
maven.compile.target=1.4
maven.compile.deprecation=on

# Whether to skip tests.
maven.test.skip=true
maven.test.ignore.failure=false

maven.junit.fork=true
maven.compile.fork=yes

# Include private method and field in Javadoc.
# Note: make sure only one is set to true (which is the reason to define all tree: default protected scope is true)
maven.javadoc.package=false
maven.javadoc.private=true
maven.javadoc.public=false
maven.javadoc.links=http://java.sun.com/j2se/1.4.2/docs/api/

# Removed the rule rulesets/naming.xml from the default
# maven.pmd.rulesetfiles. This is because the LongVariableName rule is to
# restrictive. We need to increase the limit from 12 to 20
maven.pmd.rulesetfiles=rulesets/strings.xml,rulesets/junit.xml,rulesets/braces.xml,rulesets/basic.xml,rulesets/unusedcode.xml,rulesets/design.xml,rulesets/imports.xml,rulesets/codesize.xml

# tell changelog plugin (and others) about the SCM repo type (SVN)
maven.changelog.factory=org.apache.maven.svnlib.SvnChangeLogFactory

# ---------------------------------------------------------------------------
# Multiproject settings
maven.multiproject.includes=*/project.xml,components/*/project.xml,applications/*/project.xml,taglibs/*/project.xml
maven.multiproject.excludes=project.xml,applications/project.xml,cornerstone*/project.xml,portlet-api/project.xml,design-docs/project.xml,site/project.xml,taglibs/project.xml,maven-plugin/project.xml,portals-bridges/**
# following are default values but needed here because our allSite goal doesn't know them from the plugin
maven.multiproject.aggregateDir=multiproject/
maven.multiproject.ignoreFailures=false

jar.includes=applications/gems/project.xml,portlet-api/project.xml,commons/project.xml,cps/project.xml,content-server/project.xml,jetspeed-api/project.xml,components/**/project.xml,taglibs/treecontrol/project.xml
jar.excludes=/project.xml,maven-plugin/**,layout-portlets/**,applications/project.xml,applications/demo/**,applications/rss/**,applications/j2-admin/**,site/project.xml,design-docs/project.xml

maven.multiproject.site.goals=site pdf dashboard:report-single
# For site only, comment line above, uncomment line below.
#maven.multiproject.site.goals=site dashboard:report-single

## Dashboard plugin
maven.dashboard.includes=${maven.multiproject.includes}
maven.dashboard.excludes=${maven.multiproject.excludes}
maven.dashboard.rungoals = false
maven.dashboard.aggregators=cserrors,cswarnings,clovertpc,cloverloc,cloverncloc,junitpassrate,juniterrors,junitfailures,simiantdl
maven.dashboard.ignoreFailures=true

## MultiChanges plugin
maven.multichanges.includes=${maven.multiproject.includes}
maven.multichanges.excludes=${maven.multiproject.excludes}
maven.multichanges.ignoreFailures=true


# ---------------------------------------------------------------------------
# Database Properties
# ---------------------------------------------------------------------------

org.apache.jetspeed.derbydatabase.path = /tmp

# Default production server settings.
org.apache.jetspeed.production.database.url = jdbc:derby:${org.apache.jetspeed.derbydatabase.path}/productiondb;create=true
org.apache.jetspeed.production.database.driver = org.apache.derby.jdbc.EmbeddedDriver
org.apache.jetspeed.production.database.user =
org.apache.jetspeed.production.database.password =

org.apache.jetspeed.production.jdbc.drivers.path=
org.apache.jetspeed.production.database.default.name=derby


# Default test database server settings.
org.apache.jetspeed.test.database.url = jdbc:derby:${org.apache.jetspeed.derbydatabase.path}/testdb;create=true
org.apache.jetspeed.test.database.driver = org.apache.derby.jdbc.EmbeddedDriver
org.apache.jetspeed.test.database.user =
org.apache.jetspeed.test.database.password =

org.apache.jetspeed.test.jdbc.drivers.path=
org.apache.jetspeed.test.database.default.name=derby

# plugin defaults overrides for building jetspeed portal just as with a generated custom portal setup
# org.apache.jetspeed.portal.home = ${org.apache.jetspeed.project.home}
# org.apache.jetspeed.portal.groupId = org.apache.portals.jetspeed-2
# org.apache.jetspeed.portal.artifactId = jetspeed
# org.apache.jetspeed.portal.name = Jetspeed 2 Enterprise Portal
# org.apache.jetspeed.portal.currentVersion = ${jetspeed.version}
# org.apache.jetspeed.use.test.database = true


AND!!!! MOST IMPORTANTLY, you may need to tweak project.xml so it agrees with the values in project.xml. CHECK THEM; there seems to be some sequence of events that can leave these hosed.
like so...

##### project.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2004 The Apache Software Foundation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

$Id$
-->
<project>
<extend>full-portal.xml</extend>
<pomVersion>3</pomVersion>
<groupId>snafugroup</groupId>
<artifactId>snafuportal</artifactId>
<name>My Test Portal</name>
<currentVersion>1.0</currentVersion>
</project>