[fleXive] Developer Blog

February 8, 2010

[fleXive] 3.1 Beta 2 available

Filed under: Announcements, Releases — Tags: , , , , , , , — Daniel Lichtenberger @ 16:40

The second beta version for the upcoming release of [fleXive] 3.1 is available. It includes many bugfixes since the first beta release, PostgreSQL support and (experimental) division export and import.

Continue reading on flexive.org for further information and download links.

October 23, 2009

CMIS and WebDAV connector source released

Filed under: Development News — Daniel Lichtenberger @ 11:02

Yesterday I added the sources of our CMIS and WebDAV adapters to our main repository on svn.flexive.org. They are still under development, so no binary releases yet, but especially the WebDAV adapter is already quite useable. If you want to build them now, please follow these steps…

Get and build Chemistry

Chemistry is an incubating project at Apache and provides a generic implementation of a server-side CMIS connector. The idea is that the content repository only has to implement a modest set of backend methods, and Chemistry will provide the rest (like AtomPub and WebService bindings). Currently there are no releases of Chemistry yet, so we need to build it on our own (all instructions are for Unix, please adopt slightly when using Windows):

Update 2010-01-08: Flexive tracks the Chemistry trunk version again, so please checkout http://svn.apache.org/repos/asf/incubator/chemistry/trunk instead.

mkdir build
cd build
svn checkout http://svn.apache.org/repos/asf/incubator/chemistry/branches/0.62 chemistry-reactor
cd chemistry-reactor
mvn install
cd chemistry
mvn install

Get the CMIS/WebDAV modules

The CMIS and WebDAV modules of [fleXive] are also built with Maven 2. To build them, we don’t need the entire [fleXive] source tree, as the [fleXive] artifacts will be resolved from our Maven repository.

cd ../..
svn checkout http://svn.flexive.org/repository/flexive/trunk/modules/chemistry flexive-chemistry
cd flexive-chemistry
mvn install

The “mvn install” step will also run some tests with an embedded [fleXive] container, if you want to skip them pass “-DskipTests” on the command line.

Installation

The interesting artifacts produced by the build are two web applications:

  • flexive-webdav-webapp/target/flexive-webdav.war contains the WebDAV adapter
  • flexive-atompub-webapp/target/flexive-atompub.war is the CMIS AtomPub connector

To use them, add the WAR files to your flexive.ear (when using Maven, add a dependency to the WAR artifact, when using the flexive distribution, add them to the flexive-dist/applications directory, when building [fleXive] from source put them in the drop/ directory). Note that both adapters are under active development, and are not yet in a stable state. The CMIS adapter used to work against the CMIS Spaces and CMIS Explorer clients, but the clients have moved to newer versions of the standard since then. The WebDAV adapter is based on Milton and works quite well, although it’s also not recommended for production use. I tested it with KDE’s Dolphin, Gnome Nautilus (only works when it is bound to the root web context), cadaver (Linux command line client), and Windows XP. It also passes quite a few tests of the litmus WebDAV test suite, which of course is entirely to be attributed to the excellent Milton WebDAV library.

August 25, 2009

[fleXive] 3.1 Beta 1 available

Filed under: Announcements, Releases — Daniel Lichtenberger @ 14:28

The first beta release of [fleXive] 3.1 is available. This release includes a ton of new features and improvements, as well as a Java-based installer that takes you to the [fleXive] login prompt in less than a minute.

Try out the installer or continue to read the rest of the announcement on www.flexive.org

August 14, 2009

Maven EAR applications: new H2 version required

Filed under: Development News — Tags: , , , , , , , — Daniel Lichtenberger @ 15:18

The 0.6 version of our EAR archetype includes a hardcoded version number for the H2 database engine artifact. Recent changes in the [fleXive] trunk (i.e. 3.1-SNAPSHOT) require a newer version of H2, otherwise the initialization of the database will fail with a “Syntax error in SQL statement”.

The fix for existing projects is to fix the version number in your main module’s pom.xml: increase the h2.version property from 1.1.106 to 1.1.117.

To avoid this issue in the future, I moved the H2 dependency to the flexive-h2 artifact. The current snapshot version of the archetype (1.0-SNAPSHOT) therefore no longer includes a dependency on com.h2database.h2, and potential changes in the required H2 version number (always a possibility since H2 development is very active) won’t affect existing projects.

June 25, 2009

[fleXive] 3.0.3 released

Filed under: Releases — Tags: , , , , , — Daniel Lichtenberger @ 15:32

[fleXive] 3.0.3, a bugfix release for [fleXive] 3.0, has been released. It contains important bugfixes and maintains binary compatibility with [fleXive] 3.0. The release can be downloaded at SourceForge, either in a platform-independent format or a Windows-only installer based on JBoss and MySQL. Version 3.0.3 has also been published to our Maven repository (further information can be found in the reference documentation).

The changelog follows after the break.
(more…)

April 16, 2009

WAR deployment with EJB 3.1 and Glassfish v3 Preview

Filed under: Development News, Using fleXive — Tags: , , , , , , — Daniel Lichtenberger @ 15:32

Update 2009/07/15: address the Glassfish v3 Preview instead of the older Prelude release.

EJB 3.1 brings the deployment of EJBs as part of a WAR, ultimately removing any entry barriers to using EJBs with a container that supports EJB 3.1. This article will show how to deploy [fleXive] as part of a WAR application, using [fleXive]’s WAR archetype for Maven and Glassfish v3 Preview.

Create the WAR project

To get started, create a new Maven project using our WAR archetype:
mvn archetype:generate -DarchetypeGroupId=com.flexive -DarchetypeArtifactId=flexive-archetype-war -DarchetypeVersion=1.0-SNAPSHOT -DarchetypeRepository=http://repo.flexive.org/maven2/ -DgroupId=my.group.test -DartifactId=webapp-test -Dversion=1.0-SNAPSHOT

This creates a basic WAR application with the following directory structure:

    webapp-test
    |-- pom.xml
    `-- src
        `-- main
            |-- java
            |   `-- my
            |       `-- group
            |           `-- test
            |               |-- EJBExampleBean.java
            |               `-- ExampleBean.java
            `-- webapp
                |-- WEB-INF
                |   |-- faces-config.xml
                |   `-- web.xml
                `-- index.xhtml

EJBExampleBean shows a prime feature of EJB 3.1: instead of having to declare an EJB interface and packaging the EJB class in a separate EJB JAR file, we just add our EJB to the web application and annotate it with @javax.ejb.Stateless (of course, you can still use explicit local and remote interfaces). This turns it into a fully-fledged EJB that can be injected into other managed beans using the @EJB annotation.

@Stateless(name = "EJBExample")
public class EJBExampleBean {

    public Map<FxType, Integer> getInstanceCounts() throws FxApplicationException {
        final Map<FxType, Integer> result = new HashMap<FxType, Integer>();
        final FxEnvironment environment = CacheAdmin.getEnvironment();
        // Invoke fleXive query through EJB and collect the results
        for (FxFoundType foundType : new SqlQueryBuilder().select("@pk").getResult().getContentTypes()) {
            result.put(environment.getType(foundType.getContentTypeId()), foundType.getFoundEntries());
        }
        return result;
    }
}
/**
 * Request-scoped JSF bean accessing the EJB.
 */
public class ExampleBean {
    @EJB EJBExampleBean exampleEJB;
    private Map<FxType, Integer> instanceCounts;

    public Map<FxType, Integer> getInstanceCounts() throws FxApplicationException {
        if (instanceCounts == null) {
            instanceCounts = exampleEJB.getInstanceCounts();
        }
        return instanceCounts;
    }
}

In our pom.xml we add the [fleXive] EJB and JSF artifacts, as well as Glassfish itself to provide the EJB 3.1 APIs during compilation. It seems that Glassfish v3 Preview does not bring Sun’s EL-1.0 implementation (which we need for Facelets), so we have to add this too.

<properties>
    <flexive.version>3.1-SNAPSHOT</flexive.version>
</properties>

<dependencies>
    <dependency>
        <groupId>com.flexive</groupId>
        <artifactId>flexive-ejb</artifactId>
        <type>ejb</type>
        <version>${flexive.version}</version>
    </dependency>

    <dependency>
        <groupId>com.flexive</groupId>
        <artifactId>flexive-plugin-jsf-core</artifactId>
        <version>${flexive.version}</version>
    </dependency>

    <dependency>
        <groupId>com.sun.el</groupId>
        <artifactId>el-ri</artifactId>
        <version>1.0</version>
    </dependency>

    <dependency>
        <groupId>org.glassfish</groupId>
        <artifactId>javax.javaee</artifactId>
        <version>3.0-Prelude-b28b</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

The pom.xml also expands the [fleXive] EJBs into the WEB-INF/classes folder of the web application, because Glassfish v3 Prelude Preview does not yet support EJB-JAR deployments:

<!--
    Unpack the flexive-ejb artifact and add it to WEB-INF/classes
    (Glassfish v3 Prelude does not support EJB-JAR deployment yet)
-->
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <executions>
        <!-- Copy the EJBs to target/flexive -->
        <execution>
            <id>copy-ejb</id>
            <phase>generate-resources</phase>
            <goals>
                <goal>unpack</goal>
            </goals>
            <configuration>
                <artifactItems>
                    <artifactItem>
                        <groupId>com.flexive</groupId>
                        <artifactId>flexive-ejb</artifactId>
                        <version>${flexive.version}</version>
                        <overWrite>true</overWrite>
                        <outputDirectory>target/flexive/WEB-INF/classes</outputDirectory>
                    </artifactItem>
                </artifactItems>
            </configuration>
        </execution>
    </executions>
</plugin>

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.1-beta-1</version>
    <configuration>
        <webResources>
            <resource>
                <directory>target/flexive</directory>
            </resource>
        </webResources>
    </configuration>
</plugin>

Invoke mvn package to compile and package the application into target/webapp-test.war.

Glassfish v3 Prelude Preview setup

Download and install Glassfish v3 Preview.

Before deploying a [fleXive] application, you need to perform additional setup steps described in the reference documentation:

  • Download the [fleXive] distribution
  • Install the required libraries to [glassfish-home]/glassfish/domains/domain1/lib/ext
  • Add the datasources
  • Initialize the database schema as described here

Deploying the WAR application to Glassfish

Finally, start Glassfish with bin/asadmin start-domain and deploy the WAR file from your project directory with [glassfish-home]/bin/asadmin deploy --force=true target/webapp-test.war. Deployment should only take a few seconds, and the application should be running and display the output from calling our EJB at http://localhost:8080/webapp-test/.

A note on JSF2

[fleXive] is a JSF 1.2 application. As such, it should work without changes in a JSF2 container. However, we ran into some issues, mostly due to RichFaces’ Ajax4JSF implementation. In the backend application, you need to force client-side state saving (through a config parameter in the web.xml), and some administration pages don’t work yet. The JSF components themselves appear to be working without problems, however they are still based on JSF 1.2 and Facelets – thus they cannot be used in a true JSF2 application.

April 10, 2009

The Global Configuration Plugin (or: Division not defined)

Filed under: Using fleXive, documentation — Tags: , , , , , , — Daniel Lichtenberger @ 10:45

I recently installed the minicms demo on a virtual server (VPS) with 256 MB of RAM. While the good news is that it all went rather well given the memory constraints (there are even 80-100 MB of RAM remaining after booting minicms and the backend), I got caught on an unexpected front: if you access the server using a domain name (as in http://my.domain.net:8080), you get a “Division not defined” message when accessing the /war or /flexive-backend-war context. The quick solution (which wasn’t apparent to me, until I remembered the cause): use the IP address instead. What’s the problem, and how do we solve it?

[fleXive] has the concept of divisions. A single [fleXive] instance can serve multiple “divisions”, which are fully independent from each other and use separated databases (possibly on different hosts and from different vendors). The division of a web request is determined by looking at the URL: each division has a regular expression to match the URL pattern, the first division that matches the request pattern will be used to serve the request.

Now, this is less interesting for our small demo project, but very important for ASP-like deployments where you serve multiple customers using a single server. The major gotcha is that by default, the first (default) division matches only requests that use localhost or an IP address as the hostname. Any other request will lead to the “Division not defined” error, because the request URL does not match the pattern of the first (and only) division.

So how do we redefine the URL pattern of the first division? [fleXive] provides a web-based UI for the division mapping table through the global configuration plugin. Unluckily for us, this plugin does not get packaged by our default Maven project (mainly forĀ  security reasons, because it uses a default login and this can of course wreak havoc with a running [fleXive] server).

First, since we use the Maven Jetty plugin, we have to deploy the plugin to Jetty. Open minicms/war/pom.xml and add the following dependency to the Jetty configuration:

<plugin>
   <groupId>org.mortbay.jetty</groupId>
   ...
   <dependencies>
      ...
      <dependency>
         <groupId>com.flexive</groupId>
         <artifactId>flexive-plugin-globalconfig</artifactId>
         <version>${flexive.version}</version>
      </dependency>
      ...
   </dependencies>
</plugin>

Restart Jetty, and open (using the IP address of your host) the URI /flexive-backend-war/globalconfig/index.xhtml. You should see a screen similar to this one:

Global configuration login screen

Login using the default credentials of the global configuration. You get to the division configuration table, which lists for every division the pattern to be used for match request URLs and the assigned datasources (that must be defined in the application server).

Global configuration division table

Here we can see that the first division (the one that uses our H2 database) matches the following regular expression: (\d+\.\d+\.\d+\.\d+|localhost). Thus it will match either an IP address in the form of x.x.x.x (the first part) or the hostname localhost (the second part). To specify a “catch-all” pattern for the first division, click the “Edit” button of the row.

Edit a fleXive division entry
In the first column, enter “.*” (without the quotation marks!) as our new mapping. Click “Save changes”. The settings are not applied immediately, so we can still use the input box below the table for checking our pattern. Enter the desired URLs in “Find division for URL”, and verify that the first division is returned as a result. Finally, click “Store divisions in database” to have the settings applied to the running installation. You can then access the [fleXive] application using any hostname, and of course you could also add more divisions to serve other websites.

Of course the entire situation is somewhat unsatisfying, as it is very difficult for you as a fleXive user to figure out what’s going on. I think we need to address this issue in several ways:

  • Improve the documentation of the global configuration plugin. While it’s pretty easy to understand once you get there, it’s not apparent that the global configuration plugin even exists.
  • Perhaps use “.*” as the default mapping. If you want to use multiple divisions, you have to edit the division table anyway, and you’d use your own, hostname- or path-based naming scheme.
  • Add a (disabled) dependency for the global configuration plugin to the Maven archetype (already did this, but this affects only new projects). The Ant-based distribution by default already packages the plugin for your own projects.
  • Possibly figure out a way to configure the divisions without a web frontend. The problem I faced was that I couldn’t (and didn’t want to) launch Firefox on the virtual server (to be able to use localhost access), but I also couldn’t access the global configuration from the outside (you need a valid division to access the global configuration) – at least until I figured out that the IP would work. And by using an embedded, file-based H2 database, there’s no database server to connect to and modify the mappings manually.

April 8, 2009

Improved result preferences

Filed under: Development News, Using fleXive — Daniel Lichtenberger @ 14:07

2009_04_08-backend-resultpreferences-previewIn the [fleXive] backend administration, the user can define the columns of the search result view (click on the “result preferences” button in the search results page, or click on the gear icon in the toolbar). You can also use this in your own code by selecting the @* pseudo-column in FxSQL. Depending on the type of the search result items, the corresponding “result preferences” are used for determining the columns shown to the user.

The current snapshot versions (currently only available through the automated 3.1-SNAPSHOT Maven builds) include the following improvements:

  • Derived properties are listed under the first type that defined (or reused) them.
  • Group properties are available in the dropdown (as in “Address/…”)
  • If a derived type has no own result preferences defined for the current user, the settings from the parent type(s) are used first before using the main fallback (the “all types” setting)

These improvements make the backend search results a lot more usable when you’re working with type inheritance and groups.

March 31, 2009

Development build #1149 available

Filed under: Development News — Tags: , , , , , — Daniel Lichtenberger @ 14:39

A new snapshot from the development branch (3.1) is available: Download from SourceForge

The improvements include:

  • WebLogic support
  • Full Geronimo support
  • Backend: Improved content editor layout
  • Backend: Improved script editing and scripting console
  • Miscellaneous bugfixes

JSFDays2009 examples

Filed under: Miscellaneous, Using fleXive — Tags: , , , , , , , , , , — Daniel Lichtenberger @ 14:26

In this post you can find the examples from the presentation “Challenges of JSF Web Site Development” held by Yours Truly at theĀ  JSFDays2009 conference in Vienna, Austria. The slides will also be made available after the conference.

minicms

Download: minicms.zip (3.3M)
Prerequisites: Java 1.5+, Maven 2

Instructions:

  • Unpack into a local directory
  • cd minicms
  • mvn install
  • cd war
  • mvn jetty:run

Note for those that attended the session: the ResourceResolver in minicms is actually different from the one presented in the slides, it is based on temporary files that are updated by a servlet filter. The main reason is that when I wrote minicms I hadn’t yet discovered the more elegant approach using a URLStreamHandler as described in the slides. If time permits, I’ll update the minicms ResourceResolver. This would make the Filter obsolete and also make caching easier (and it’s probably faster, too).

JSF web site development examples

Download: jsfdays09-website-examples.zip (17.4M)
Prerequisites: Java 1.5+, Apache Ant

This package contains examples covering the following areas:

  • Accessibility: MyFaces Trinidad
  • Accessibility: Yahoo UI (progressive enhancement)
  • Dynamic templates (Facelets ResourceResolver)
  • RESTful URLs: PrettyFaces
  • RESTful URLs: PrettyUrlPhaseListener (Mojarra)
  • RESTful URLs: RestFaces
  • RESTful URLs: UrlRewriteFilter

Instructions:

  • Unpack into local directory
  • cd jsfDays09
  • ant

Deploy any of the generated WAR files to a web container like Tomcat.

Older Posts »

Blog at WordPress.com.