Fork me on GitHub

n. Slang a rough lawless young Kuali developer.
[perhaps variant of Houlihan, Irish surname]
kualiganism n

Blog of an rSmart Java Developer. Full of code examples, solutions, best practices, et al.

Tuesday, February 28, 2012

KFS Overlay Reference Implementation on GitHub

As a follow-up to the Mavenized KFS Distribution Available on GitHub post, this is a real world solution on setting up an overlay. It is also a good example of how you would structure your project to do so. I intended this for download, so that people can have a glimpse of a reference implementation example of a KFS overlay.

The Project

First, you can find the KFS Overlay Reference Implementation on GitHub.

The POM

Let's break down the POM a little bit. We'll start at the boilerplate.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.kuali.pom</groupId>
    <artifactId>kfs-public</artifactId>
    <version>0.0.1</version>
  </parent>
  <groupId>com.rsmart.kuali</groupId>
  <artifactId>kfs</artifactId>
  <packaging>pom</packaging>
  <name>rsmart-kfs</name>
  <inceptionYear>2012</inceptionYear>
  <version>0.0.1-SNAPSHOT</version>
  <description></description>
  <url>https://github.com/r351574nc3/kfs-overlay-reference/</url>

This overlay is using the kfs-public POM as mentioned in an earlier post. The reason is that this is not a Kuali-Foundation project.
<groupId>com.rsmart.kuali</groupId>
  <artifactId>kfs</artifactId>
  <packaging>pom</packaging>
  <name>rsmart-kfs</name>

I have put this in the com.rsmart.kuali group, so I do not want this deploying artifacts to nexus or cloudfront for the kuali foundation. Using the kfs-public POM let's me override all that stuff and not have to deal with it.

Next, I have created some standard modules that the Kuali Foundation regards as essential to your project.
<modules>
    <module>config</module>
    <module>web</module>
  </modules>

One is the config module. KFS uses this for external configuration. Peeking inside its POM, we see
<properties>
    <kfs.external.package.phase>package</kfs.external.package.phase>
  </properties>

  <build>
    <filters>
      <filter>${user.home}/kfs-build.properties</filter>
      <filter>${env.filter}</filter>
      <filter>${filter.directory}/b2b.properties</filter>
      <filter>${filter.directory}/build.properties</filter>
      <filter>${filter.directory}/build-foundation.properties</filter>
      <filter>${filter.directory}/database.properties</filter>
      <filter>${filter.directory}/logging.properties</filter>
      <filter>${filter.directory}/rice.properties</filter>
    </filters>
  </build>

  <profiles>
    <profile>
      <id>distribute</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <build>
        <plugins>              
          <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

There are filters setup for the standard KFS filters which are used to build the configuration.properties and the external configuration directory. Notice also that the distribute profile makes use of our assembly plugin configured in the kfs-common POM.

The web module is also essential because this is what eventually creates our WAR file. You may have already noticed the the POMs I have show so far have <packaging>pom</packaging> set. Obviously, those are not creating any WAR artifacts. The pattern/convention set by the Kuali Foundation is that there is a web module that does that for you. You can see in the web POM I created, that a great deal is going on here. The maven POM is a declarative DSL, so stuff is not described in any order, just organized and grouped together. To explain what is happening, I may jump around a little.

First, I want to point out the the dependencies
<dependencies>
    <dependency>
      <groupId>${kfs.maven.groupId}</groupId>
      <artifactId>kfs-web</artifactId>
      <version>${kfs.maven.version}</version>  
      <type>tar.bz2</type>
      <classifier>src</classifier>
    </dependency>
    <dependency>
      <groupId>${kfs.maven.groupId}</groupId>
      <artifactId>kfs-web</artifactId>
      <version>${kfs.maven.version}</version>  
      <type>war</type>
    </dependency>
  </dependencies> 

Of course, there is the normal war dependency for the overlay. There is also a sources dependency. o_0!? You may have already noticed the section on filters. It has to filter in properties set in these files. For simplicity, I have excluded those file from the overlay project. Why should I need them? They're not part of my project. They're in another project. It makes sense that these are dependencies, right? That is what I have done. The sources .tar.bz2 is where the filters are unpacked from. This needs to only happen once. This is an overlay project after all. There is no need to keep unpacking the dependencies unless they change which is not likely. Therefore, there is a specific phase (that can be overridden) which specifies when this happens
<properties>
    <kfs.web.unpack.phase>generate-sources</kfs.web.unpack.phase>
  </properties>

Where is the Overlay!?

The only clue we have is the war plugin in this POM
<plugin>
        <artifactId>maven-war-plugin</artifactId>
      </plugin>

So where is it happening then? It is in the kfs-public POM along with everything else that is needed for a project that is the child of the main kfs-parent. Part of this is to make overlays a lot more easier. Basically, the plugins are already setup for you. You can just create an overlay project with minimal modification to your POMs.

Conclusion

Try it out. If there's anything you would change, please email me or get in contact with me. I really enjoy collaborating with people and sharing ideas.

Monday, February 27, 2012

Building Applications with the Kuali POMs

Overview

The Kuali Rice team has been investing a lot recently into Maven standardization. That is, bringing projects together more cohesively via Maven. It is not just to have all projects using Maven, but also using the same plugins, licensing, dependencies and so on with Maven. The best solution as of late is one Mother POM. In Maven, it's conveniently named a parent POM. Rice has two right now (Kuali and Kuali Common). Documentation to these can conveniently be found on the Kuali Foundation Wiki.

This post is for projects that are looking to get started really quickly with setting up a project at the Kuali Foundation. While documentation is available on the wiki, I am going through this on my blog as an outsider. Some of this is also pertinent to institutions that wish to implement Kuali Software. While these POM files do simplify things for foundation projects, institutions that use these parent POM files may encounter some caveats.

Scenarios

I Want to Start a New Project. Now What?

Just create your project normally. Make sure your POM has this in it.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.kuali.pom</groupId>
    <artifactId>kuali-common</artifactId>
    <version>1.0.31</version>
  </parent>
...
...
</project>

You will automatically get all of the Kuali Maven Configuration. This means that all of the nexus configuration comes as well. This includes deployment urls and usernames. No passwords are included in the configuration. Passwords are expected to be setup in a wagon configuration via the settings.xml. Therefore, if your project is not a Kuali Foundation project with that settings.xml setup properly, you will probably encounter a number of errors. For example, see below:

[INFO] ------------------------------------------------------------------------
[INFO] Building kfs 4.1.1-maven-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-jar-plugin:2.3.2:test-jar (test-jar) @ kfs-parent ---
[WARNING] JAR will be empty - no content was marked for inclusion!
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ kfs-parent ---
[INFO] Installing /Users/leo/projects/git/kfs-maven/kfs-parent/pom.xml to /Users/leo/.m2/repository/org/kuali/kfs/kfs-parent/4.1.1-maven-SNAPSHOT/kfs-parent-4.1.1-maven-SNAPSHOT.pom
[INFO] Installing /Users/leo/projects/git/kfs-maven/kfs-parent/target/kfs-parent-4.1.1-maven-SNAPSHOT-tests.jar to /Users/leo/.m2/repository/org/kuali/kfs/kfs-parent/4.1.1-maven-SNAPSHOT/kfs-parent-4.1.1-maven-SNAPSHOT-tests.jar
[INFO]
[INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ kfs-parent ---
Downloading: s3://maven.kuali.org/snapshot/org/kuali/kfs/kfs-parent/4.1.1-maven-SNAPSHOT/maven-metadata.xml
[WARN] s3://maven.kuali.org/snapshot - Connection refused
[WARNING] Could not transfer metadata org.kuali.kfs:kfs-parent:4.1.1-maven-SNAPSHOT/maven-metadata.xml from/to kuali.snapshot (s3://maven.kuali.org/snapshot): The S3 wagon needs AWS Access Key set as the username and AWS Secret Key set as the password. eg:

my.server
[AWS Access Key ID]
[AWS Secret Access Key]


[INFO] Logged off - maven.kuali.org

Above is the result of a missing or even misconfigured settings.xml. What is missing are the keys for s3-based maven repository. This isn't something you want to fix, this is something you want to configure. Let's consider this is not a Kuali Foundation project, then what needs to occur is the <distributionManagement ... /> section needs to be configured within the POM.xml
<distributionManagement>
    <downloadUrl>${kuali.site.download.url}</downloadUrl>
    <site>
      <id>${kuali.site.server.id}</id>
      <name>Kuali Maven Site</name>
      <url>${kuali.site.publish.url}</url>
    </site>
    <repository>
      <id>${kuali.repo.release.id}</id>
      <name>${kuali.repo.release.name}</name>
      <url>${kuali.repo.release.url}</url>
    </repository>
    <snapshotRepository>
      <id>${kuali.repo.snapshot.id}</id>
      <name>${kuali.repo.snapshot.name}</name>
      <url>${kuali.repo.snapshot.url}</url>
    </snapshotRepository>
  </distributionManagement>
The above properties can be overridden at build time. If you with for your kfs-maven project to deploy somewhere else within your organization so that you may build an overlay from it, then you will want to override these properties. A few other properties I use are:

-Dkuali.cloudfront.phase=none -Dkuali.nexus.sonatype.phase=none -Dkuali.gpg.phase=none -Dkuali.cloudfront.phase=none -Dksite.phase=none


For a list of other properties that can be overridden, please refer to Kuali Community Maven POM Properties

Typically, properties follow the patterns:
  • <artifactId^gt;.version The version property pattern
  • <artifactId>.goal.phase phase property pattern
For more about what these are and what they're used for, see Kuali Community Maven POM Patterns and Conventions

The kfs-public POM

This isn't an official POM yet. I am hoping to get it added to the Kuali Repository soon, but even if it is not added to the Kuali Repository, you can add it to your own local repository. You can find the kfs-public POM here at GitHub. It is pretty much the same as the kuali-common POM, except that it overrides all of the things I was mentioning earlier to make it usable for public consumption. That is, non-Kuali Foundation projects.

Monday, February 20, 2012

Explanation of kfs-maven Artifacts

Overview

This is for people that have been following the Mavenized KFS Distribution Available on GitHub post. I want to explain a bit about the artifacts how how to use your maven kfs distribution. Once you have it cloned and building, you will probably wonder what to do with the artifacts.

Artifacts

Here is a table of all the available artifacts and what they're there for:
kfs-config-4.1.1-maven-SNAPSHOT-external.zip External configuration packaging
kfs-config-4.1.1-maven-SNAPSHOT-src.tar.bz2 Sources used for the external config. It is used in overlays.
kfs-config-4.1.1-maven-SNAPSHOT-tests.jar For developing tests.
kfs-core-4.1.1-maven-SNAPSHOT-sources.jar Typical maven source jar. Does not include filters.
kfs-core-4.1.1-maven-SNAPSHOT-tests.jar For developing tests.
kfs-core-4.1.1-maven-SNAPSHOT.jar Core classes. Things that could not be put into modules.
kfs-module-endow-4.1.1-maven-SNAPSHOT-sources.jar Typical maven source jar for the endowment module.
kfs-module-endow-4.1.1-maven-SNAPSHOT-tests.jar For developing tests for the endowment module.
kfs-module-endow-4.1.1-maven-SNAPSHOT.jar The endowment module.
kfs-module-external-4.1.1-maven-SNAPSHOT-sources.jar Typical maven source jar for the external module.
kfs-module-external-4.1.1-maven-SNAPSHOT-tests.jar For developing tests for the external module.
kfs-module-external-4.1.1-maven-SNAPSHOT.jar The external module (for stuff like communicating with KC).
kfs-module-4.1.1-maven-SNAPSHOT-tests.jar The module base tests jar.
kfs-rice-4.1.1-maven-SNAPSHOT-sources.jar KFS rice overrides source jar.
kfs-rice-4.1.1-maven-SNAPSHOT-tests.jar KFS rice overrides test jar.
kfs-rice-4.1.1-maven-SNAPSHOT.jar KFS rice overrides.
kfs-parent-4.1.1-maven-SNAPSHOT-tests.jar The parent pom tests jar.
kfs-dev.war The application war.
kfs-dev-sources.jar Sources for the application.
kfs-dev-tests.jar Tests for the application.

kfs-dev.war

This is the main application artifact. This is what gets deployed to your tomcat/jetty/JBoss appserver.

kfs-config-4.1.1-maven-SNAPSHOT-external.zip

KFS has this concept of external configurations. This is a space where the application has read/write access for batch input/output files, logs, and of course security credentials. You wouldn't normally build these things into your application space because it becomes a security and auditing issue. Normally, you would deploy this to the same system as your application and unzip it there. If you look inside, it should be something like this:

Archive: /Users/leo/kfs-config-external-4.1.1-maven-SNAPSHOT-external.zip
Length Date Time Name
-------- ---- ---- ----
0 02-18-12 12:13 kuali/
0 02-18-12 12:13 kuali/main/
0 02-18-12 12:13 kuali/main/dev/
0 02-18-12 12:13 kuali/main/dev/security/
0 02-18-12 12:13 kuali/main/dev/security/kfs/
0 02-18-12 12:13 kuali/main/dev/settings/
0 02-18-12 12:13 kuali/main/dev/settings/kfs/
0 02-18-12 12:13 kuali/main/dev/work/
0 02-18-12 12:13 kuali/main/dev/work/kfs/
0 02-18-12 12:13 kuali/main/dev/work/kfs/attachments/
0 02-18-12 12:13 kuali/main/dev/work/kfs/attachments/pending/
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/ar/
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/bc/
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/cab/
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/cam/
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/cg/
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/coa/
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/ec/
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/fp/
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/gl/
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/ld/
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/pdp/
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/purap/
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/sys/
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/vnd/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/ar/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/ar/customer/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/ar/invoiceWriteoff/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/cm/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/cm/barcode/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/fp/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/fp/procurementCard/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/collectorXml/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/correctionProcess/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/enterpriseFeed/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/originEntry/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/ld/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/ld/correctionProcess/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/ld/enterpriseFeed/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/ld/originEntry/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/pdp/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/pdp/bankFederalReserve/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/pdp/paymentExtract/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/pdp/paymentImport/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/pdp/paymentLoadSummary/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/purap/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/purap/electronicInvoice/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/workflow/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/workflow/loaded/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/workflow/pending/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/workflow/problems/
0 02-18-12 12:13 kuali/main/dev/work/kfs/temp/
2006 02-18-12 12:13 kuali/main/dev/security/kfs/security.properties
5528 02-18-12 12:13 kuali/main/dev/settings/kfs/log4j.properties
0 02-18-12 12:13 kuali/main/dev/work/kfs/attachments/pending/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/ar/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/bc/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/cab/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/cam/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/cg/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/coa/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/ec/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/fp/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/gl/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/ld/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/pdp/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/purap/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/sys/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/vnd/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/ar/customer/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/ar/invoiceWriteoff/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/cm/barcode/placeholder.txt
3610 02-18-12 12:13 kuali/main/dev/work/kfs/staging/fp/procurementCard/allTransDifferentCC.xml
3580 02-18-12 12:13 kuali/main/dev/work/kfs/staging/fp/procurementCard/allTransSameCC.xml
1830 02-18-12 12:13 kuali/main/dev/work/kfs/staging/fp/procurementCard/badChartData.xml
679 02-18-12 12:13 kuali/main/dev/work/kfs/staging/fp/procurementCard/badXmlFile.xml
2720 02-18-12 12:13 kuali/main/dev/work/kfs/staging/fp/procurementCard/fieldsInWrongOrder.xml
18775 02-18-12 12:13 kuali/main/dev/work/kfs/staging/fp/procurementCard/transactions1.xml
3965 02-18-12 12:13 kuali/main/dev/work/kfs/staging/fp/procurementCard/transactionWithExtraFields.xml
3472 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/collectorXml/gl_collector1.xml
3434 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/collectorXml/gl_collector2.xml
10242 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/collectorXml/gl_collector3.xml
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/correctionProcess/placeholder.txt
187 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/enterpriseFeed/entp_test_file_001.data
45 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/enterpriseFeed/entp_test_file_001.recon
137632 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/enterpriseFeed/entp_test_file_002.data
56 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/enterpriseFeed/entp_test_file_002.recon
137632 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/enterpriseFeed/entp_test_file_003.data
25 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/enterpriseFeed/entp_test_file_003.recon
297143 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/enterpriseFeed/entp_test_file_004.data
56 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/enterpriseFeed/entp_test_file_004.recon
1927409 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/enterpriseFeed/entp_test_file_005.data
60 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/enterpriseFeed/entp_test_file_005.recon
1927409 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/enterpriseFeed/entp_test_file_006.data
49 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/enterpriseFeed/entp_test_file_006.recon
60 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/enterpriseFeed/entp_test_file_007.recon
187 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/enterpriseFeed/entp_test_file_008.data
839 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/enterpriseFeed/entp_test_file_readme.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/originEntry/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/ld/correctionProcess/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/ld/enterpriseFeed/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/ld/originEntry/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/pdp/bankFederalReserve/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/pdp/paymentExtract/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/pdp/paymentImport/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/pdp/paymentLoadSummary/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/purap/electronicInvoice/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/workflow/loaded/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/workflow/pending/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/workflow/problems/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/temp/placeholder.txt
-------- -------
4488630 114 files

The reason for the kuali/main/dev is that this is where the application was configured to put the external config at build time. Notice, I did not give an exact path. The reason is because this is intended to go into the home directory of the user running the appserver (tomcat). If I used the ${user.home} path, the paths in the zip would show the build user's home instead which is not what I want; therefore, I made it relative, so it may be deployed within the user's directory. You don't have to do this though. It is just a matter of changing the external config directory's path like I did above to put it wherever.


Sunday, February 19, 2012

Mavenized KFS Distribution Available on GitHub

Introduction

I have been getting a good deal of feedback lately about the Convert Your KFS Distribution to Maven post. I was really hoping the repository of the source would be made available publicly, but it was not. I decided that with some refinements I had been planning for the Maven/KFS distribution, I would release the next distribution publicly on GitHub.

Now I have done so. You may not reach my new-and-improved Maven distribution of KFS 4.1.1 on GitHub. The official kfs-maven site can be found here.

Straight-away, you will notice that there are 4 sub-projects (kfs-assembly, kfs-parent, kfs-common, and kfs-public). I will explain each.

kfs-assembly

In Maven, there is this concept of an assembly which is like an artifact counterpart. If you've worked with maven, you'll know that artifacts are the products of a release or build. These are usually jars or wars. If you have a non-software piece like configuration or help files, you may distribute these as assemblies. KFS happens to have several configuration and help files available which are placed into an assembly. I will explain how to use this later.

kfs-common

This is a common POM. The Kuali Foundation is now starting to make available common POMs that can be used to aggregate plugin configuration and dependencies to each of its umbrella'd projects for consistency. This will help make projects more manageable, but it will also make them easier to get started. No more hassle of trying to figure out what's the best way. It's already provided for you.

kfs-public

I will talk about this more in a later post. For now, I will explain it as the public POM. It is for non-Kuali Foundation projects. Who cares about these? Well, institutions should care. Your project is not part of the Kuali Foundation. Maybe someday it will be, but for now, it is not. There are some settings like CI information, site deployment details, and urls that are not where you want your project to be directed. I don't mean usernames and passwords. What I mean is that kuali-common is configured specifically for the Kuali Foundation. If you want to build a project that makes use of the plugin configuration, dependencies, and properties of the kuali-common POM to get your project started easier, you will halso have to get all the Kuali Foundation configuration with it. The kuali-public POM let's you get all of that without the messy Kuali Foundation configuration your project doesn't need.

kfs-parent

This is the REAL maven distribution. It's a lot leaner than the previous distribution I had described in the Convert Your KFS Distribution to Maven post. I have gotten rid of all the ant stuff. There is no more of that.

Getting Started

In case you wanted to get started and use distribution, here's what you need to do.

Check Out the Project

% git clone git@github.com:r351574nc3/kfs-maven.git
% cd kfs-maven

Install the Assembly

% cd kfs-assembly
% mvn clean install

Install the Common POM

% cd kfs-common
% mvn clean install

Package the war file

Now, you're probably familiar with how things used to be done with the kfs-build.properties. I am going to outright recommend this file primarily be used for credentials and user-specific overrides. That is, developers should probably make the most use of this because they are they only one's with user-specific overrides (like home directory, etc...). Server environments shouldn't have anything of the sort, so you would expect that a server environment will only have credentials. Further, server environments are probably going to be packaged and built using something like Jenkins. This means, any necessary overrides that are not credentials will probably be provided through Jenkins.

If you are a developer, you already have your kfs-build.properties. You won't need to change a thing. Just use what you already have and run the following:
% mvn -Pmysql clean install

Now I am going to demonstrate what you would typically be doing to deploy to a server environment.
CONFIGDIR=$HOME/kuali/main/dev mvn -Pmysql clean install \
-Dant.project.name=kfs \
-Duse.p6spy=false \
-Duse.quartz.scheduling=true \
-Duse.dd.schema.validation=false \
-Dtests.includes=**/*Test.java \
-Dappenders="INFO, LogFile, StdOut" \
-Dexternal.config.directory=$CONFIGDIR \
-Dbase.security.directory=$CONFIGDIR/security \
-Dbase.settings.directory=$CONFIGDIR/settings \
-Dbase.logs.directory=$CONFIGDIR/logs \
-Dbase.work.directory=$CONFIGDIR/work \
-Ddatasource.username=KUALIUSER \
-Dmysql.datasource.url=jdbc:mysql://localhost:3306/KUALIUSER \
-Doracle.datasource.url=jdbc:oracle:thin:@localhost:1521:XE \
-Dmail.relay.server= \
-Dbatch.mailing.list= \
-Dincident.mailing.list= \
-Ddeploy.local.rice.server=false \
-Drice.standalone=false \
-Drice.server.datasource.username=KUALIUSER \
-Drice.kew.xml.pipeline.lifecycle.enabled=true \
-Drice.dev.mode=false \
-Dtomcat.version=6

This will produce a kfs-dev.war file in kfs-parent/web/target

Details

Ok. What Changed?

Among the refinements, the huge one was the kfs-common POM file. It takes advantage of the kuali-common POM file as a parent.
<parent<
  <groupId>org.kuali.pom</groupId>
  <artifactId>kuali-common</artifactId>
  <version>1.0.31</version>
</parent>
What we get from this are all the plugin configurations that are at home with the Kuali Foundation including things like checkstyle, the graph plugin, findbugs configuration, etc... It also allows us to leave our KFS specific plugins with in the kfs-common with things like properties and profiles. If you look at the kfs-common POM, it is 2270 lines long. Sure, that's huge, but when we care mostly about what we want to override, it's not so bad. Now our POM is much simpler in kfs-parent.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.kuali.pom</groupId>
    <artifactId>kfs-common</artifactId>
    <version>0.0.1</version>
  </parent>
  <groupId>org.kuali.kfs</groupId>
  <artifactId>kfs-parent</artifactId>
  <packaging>pom</packaging>
  <name>kfs</name>
  <inceptionYear>2005</inceptionYear>
  <version>4.1.1-maven-SNAPSHOT</version>
  <description></description>
  <url>http://${kuali.site.hostname}/kfs/${project.version}</url>
  
  <modules>
    <module>core</module>
    <module>config</module>
    <module>module</module>
    <module>rice</module>
    <module>web</module>
  </modules>
</project>
Pretty nice, right? Not cluttered by all that other stuff. All that is described here is the modules. Now that's great. Much cleaner. If you take a look at the modules, you'll see that they have much more specific information which is good. That is also due to the kfs-common POM.

Profiles

You've probably been wondering for a while now what the whole -Pmysql thing is about. That's another improvement. There are profiles for what you want.
Mysql You can build KFS to use mysql or oracle. There is no profile for oracle though. Oracle is the default. You merely specify if you want to use mysql.
dev,tst,cnv,cfg,prd,stg These are environments. You can specify an environment you want to build with, and it will use the appropriate ${environment}-build.properties file.
cas You can build with CAS or without. It defaults to without, but use -Pcas and now it will build with cas. It's fakecas though.
p6spy Use this to flip on/off p6spy.
production Are you building for production? What to stop using those silly test urls? This is for you.
standalone Sets all your properties to work with rice standalone. Of course, you need to fix the URLs. We can't read minds afterall.
coeus Turn on coeus integration. No urls, but some spring beans need to be activated. This will do that for you.

Artifacts

kfs-config-4.1.1-maven-SNAPSHOT-external.zip
kfs-config-4.1.1-maven-SNAPSHOT-src.tar.bz2
kfs-config-4.1.1-maven-SNAPSHOT-tests.jar
kfs-core-4.1.1-maven-SNAPSHOT-sources.jar
kfs-core-4.1.1-maven-SNAPSHOT-tests.jar
kfs-core-4.1.1-maven-SNAPSHOT.jar
kfs-module-endow-4.1.1-maven-SNAPSHOT-sources.jar
kfs-module-endow-4.1.1-maven-SNAPSHOT-tests.jar
kfs-module-endow-4.1.1-maven-SNAPSHOT.jar
kfs-module-external-4.1.1-maven-SNAPSHOT-sources.jar
kfs-module-external-4.1.1-maven-SNAPSHOT-tests.jar
kfs-module-external-4.1.1-maven-SNAPSHOT.jar
kfs-module-4.1.1-maven-SNAPSHOT-tests.jar
kfs-rice-4.1.1-maven-SNAPSHOT-sources.jar
kfs-rice-4.1.1-maven-SNAPSHOT-tests.jar
kfs-rice-4.1.1-maven-SNAPSHOT.jar
kfs-parent-4.1.1-maven-SNAPSHOT-tests.jar
kfs-dev.war
kfs-dev-sources.jar
kfs-dev-tests.jar

kfs-dev.war

This is the main application artifact. This is what gets deployed to your tomcat/jetty/JBoss appserver.

kfs-config-4.1.1-maven-SNAPSHOT-external.zip

KFS has this concept of external configurations. This is a space where the application has read/write access for batch input/output files, logs, and of course security credentials. You wouldn't normally build these things into your application space because it becomes a security and auditing issue. Normally, you would deploy this to the same system as your application and unzip it there. If you look inside, it should be something like this:

Archive: /Users/leo/kfs-config-external-4.1.1-maven-SNAPSHOT-external.zip
Length Date Time Name
-------- ---- ---- ----
0 02-18-12 12:13 kuali/
0 02-18-12 12:13 kuali/main/
0 02-18-12 12:13 kuali/main/dev/
0 02-18-12 12:13 kuali/main/dev/security/
0 02-18-12 12:13 kuali/main/dev/security/kfs/
0 02-18-12 12:13 kuali/main/dev/settings/
0 02-18-12 12:13 kuali/main/dev/settings/kfs/
0 02-18-12 12:13 kuali/main/dev/work/
0 02-18-12 12:13 kuali/main/dev/work/kfs/
0 02-18-12 12:13 kuali/main/dev/work/kfs/attachments/
0 02-18-12 12:13 kuali/main/dev/work/kfs/attachments/pending/
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/ar/
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/bc/
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/cab/
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/cam/
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/cg/
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/coa/
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/ec/
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/fp/
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/gl/
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/ld/
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/pdp/
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/purap/
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/sys/
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/vnd/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/ar/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/ar/customer/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/ar/invoiceWriteoff/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/cm/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/cm/barcode/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/fp/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/fp/procurementCard/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/collectorXml/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/correctionProcess/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/enterpriseFeed/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/originEntry/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/ld/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/ld/correctionProcess/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/ld/enterpriseFeed/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/ld/originEntry/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/pdp/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/pdp/bankFederalReserve/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/pdp/paymentExtract/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/pdp/paymentImport/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/pdp/paymentLoadSummary/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/purap/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/purap/electronicInvoice/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/workflow/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/workflow/loaded/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/workflow/pending/
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/workflow/problems/
0 02-18-12 12:13 kuali/main/dev/work/kfs/temp/
2006 02-18-12 12:13 kuali/main/dev/security/kfs/security.properties
5528 02-18-12 12:13 kuali/main/dev/settings/kfs/log4j.properties
0 02-18-12 12:13 kuali/main/dev/work/kfs/attachments/pending/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/ar/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/bc/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/cab/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/cam/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/cg/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/coa/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/ec/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/fp/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/gl/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/ld/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/pdp/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/purap/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/sys/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/reports/vnd/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/ar/customer/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/ar/invoiceWriteoff/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/cm/barcode/placeholder.txt
3610 02-18-12 12:13 kuali/main/dev/work/kfs/staging/fp/procurementCard/allTransDifferentCC.xml
3580 02-18-12 12:13 kuali/main/dev/work/kfs/staging/fp/procurementCard/allTransSameCC.xml
1830 02-18-12 12:13 kuali/main/dev/work/kfs/staging/fp/procurementCard/badChartData.xml
679 02-18-12 12:13 kuali/main/dev/work/kfs/staging/fp/procurementCard/badXmlFile.xml
2720 02-18-12 12:13 kuali/main/dev/work/kfs/staging/fp/procurementCard/fieldsInWrongOrder.xml
18775 02-18-12 12:13 kuali/main/dev/work/kfs/staging/fp/procurementCard/transactions1.xml
3965 02-18-12 12:13 kuali/main/dev/work/kfs/staging/fp/procurementCard/transactionWithExtraFields.xml
3472 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/collectorXml/gl_collector1.xml
3434 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/collectorXml/gl_collector2.xml
10242 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/collectorXml/gl_collector3.xml
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/correctionProcess/placeholder.txt
187 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/enterpriseFeed/entp_test_file_001.data
45 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/enterpriseFeed/entp_test_file_001.recon
137632 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/enterpriseFeed/entp_test_file_002.data
56 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/enterpriseFeed/entp_test_file_002.recon
137632 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/enterpriseFeed/entp_test_file_003.data
25 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/enterpriseFeed/entp_test_file_003.recon
297143 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/enterpriseFeed/entp_test_file_004.data
56 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/enterpriseFeed/entp_test_file_004.recon
1927409 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/enterpriseFeed/entp_test_file_005.data
60 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/enterpriseFeed/entp_test_file_005.recon
1927409 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/enterpriseFeed/entp_test_file_006.data
49 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/enterpriseFeed/entp_test_file_006.recon
60 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/enterpriseFeed/entp_test_file_007.recon
187 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/enterpriseFeed/entp_test_file_008.data
839 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/enterpriseFeed/entp_test_file_readme.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/gl/originEntry/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/ld/correctionProcess/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/ld/enterpriseFeed/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/ld/originEntry/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/pdp/bankFederalReserve/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/pdp/paymentExtract/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/pdp/paymentImport/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/pdp/paymentLoadSummary/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/purap/electronicInvoice/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/workflow/loaded/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/workflow/pending/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/staging/workflow/problems/placeholder.txt
0 02-18-12 12:13 kuali/main/dev/work/kfs/temp/placeholder.txt
-------- -------
4488630 114 files

The reason for the kuali/main/dev is that this is where the application was configured to put the external config at build time. Notice, I did not give an exact path. The reason is because this is intended to go into the home directory of the user running the appserver (tomcat). If I used the ${user.home} path, the paths in the zip would show the build user's home instead which is not what I want; therefore, I made it relative, so it may be deployed within the user's directory. You don't have to do this though. It is just a matter of changing the external config directory's path like I did above to put it wherever.

Conclusion

The new mavenization is cleaner and easier to use. It's also easier to modify. I'll discuss that in my next post. I'll walk through overlays and customizing things like properties. In fact, at the time that I am writing this, there is a kfs-overlay-reference project on github. The trouble is, nothing is there yet. My next post will be specifically about that though, so of course, it will be available soon.

Monday, February 13, 2012

Adding Java Melody to a Kuali Project

Overview


Steps for KFS

1 Setup Dependencies

  1. Download the latest javamelody.jar from http://code.google.com/p/javamelody/downloads/list
  2. Add the jar to build/kfs-lib/

2 Setup Filters and SessionListener

  1. If you have not already, create a file in build/properties called <your institution>-configuration.properties and a <your institution>-build.properties
  2. Add the following to the <your institution>-configuration.properties
    monitoring.listener=${monitoring.license}
    monitoring.filter=${monitoring.filter}
    monitoring.mapping=${monitoring.mapping}
  3. Add the following to the <your institution>-build.properties
    monitoring.filter=monitoring \
        net.bull.javamelody.MonitoringFilter \
         \
            log\
            true\
         \
         \
                 system-actions-enabled\
                 true\
         \
         \
                  url-exclude-pattern\
                  /static/.*|/kr/static/.*|/kr/images/.*|/images-portal/.*\
         \
     \
            
    monitoring.mapping= \
              <![CDATA[ \
     \
        monitoring \
        /* \
     \
              ]]> \
            
    monitoring.listener=         \
              <![CDATA[ \
     \
        net.bull.javamelody.SessionListener \
     \
              ]]> \
            
    
  4. You need to add the following to your web.xml:
    <!-- Change this if you want to use a different Spring file -->
      <context-param>
        <param-name>web.bootstrap.spring.file</param-name>
        <param-value>${bootstrap.spring.file}</param-value>
      </context-param>
    
      ${monitoring.filter}
    
  5. You need to add the following to your web.xml:
    <filter>
        <filter-name>UserPreferencesFilter</filter-name>
        <filter-class>org.kuali.rice.kew.web.UserPreferencesFilter</filter-class>
      </filter>
    
      ${monitoring.mapping}
  6. You need to add the following to your web.xml:
    ${monitoring.listener}
    
      <listener>
        <listener-class>org.kuali.rice.krad.web.session.NonSerializableSessionListener</listener-class>
      </listener>
  7. If you haven't already, set the following in your *kfs-build.properties*
    institution.build.properties.file=build/properties/<your institution>-build.properties
    institution.configuration.properties.file=build/properties/<your institution>-configuration.properties

3 Setup Spring Configuration

  1. Add the following to work/src/spring-kfs-rice-overrides.xml
    <import resource="classpath:net/bull/javamelody/monitoring-spring.xml" />
              <bean id="facadeMonitoringAdvisor" class="net.bull.javamelody.MonitoringSpringAdvisor">
                  <property name="pointcut">
                      <bean class="org.springframework.aop.support.JdkRegexpMethodPointcut">
                          <property name="pattern" value=".*(krad|krms|location|edl|kim|kcb|ken|kew|kns|ksb).*ServiceImp.*" />
                      </bean>
                  </property>
              </bean>
    

4 Prepare for Deployment

    Steps for Rice

    1 Setup Dependencies

    Add the following to the web/pom.xml
    <properties>
        <monitoring.filter />
        <monitoring.mapping />
        <monitoring.listener />
      </properties>
    ...
    ...
      <profiles>
        <profile>
          <id>monitoring</id>
          <properties>
            <monitoring.filter>
              <![CDATA[
    <filter>
        <filter-name>monitoring</filter-name>
        <filter-class>net.bull.javamelody.MonitoringFilter</filter-class>
        <init-param>
            <param-name>log</param-name><param-value>true</param-value></init-param>
        <init-param>
                 <param-name>system-actions-enabled</param-name><param-value>true</param-value></init-param>
        <init-param>
                  <param-name>url-exclude-pattern</param-name><param-value>/static/.*|/kr/static/.*|/kr/images/.*|/images-portal/.*</param-value></init-param>
    </filter>
              ]]>
            </monitoring.filter>
            <monitoring.mapping>
              <![CDATA[
    <filter-mapping>
        <filter-name>monitoring</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
              ]]>
            </monitoring.mapping>
            <monitoring.listener>
              <![CDATA[
    <listener>
        <listener-class>net.bull.javamelody.SessionListener</listener-class>
    </listener>
              ]]>
            </monitoring.listener>
          </properties>
          <build>
          </build>
          <dependencies>
            <!-- javamelody-core -->
            <dependency>
              <groupid>net.bull.javamelody</groupId>
              <artifactid>javamelody-core</artifactId>
              <version>1.31.0</version>
            </dependency>
    ...
    ...
          </dependencies>
        </profiles>
    

    2 Setup Filters and SessionListener

    1. You need to add the following to your web.xml:
      <!-- Change this if you want to use a different Spring file -->
        <context-param>
          <param-name>web.bootstrap.spring.file</param-name>
          <param-value>${bootstrap.spring.file}</param-value>
        </context-param>
      
        ${monitoring.filter}
      
    2. You need to add the following to your web.xml:
      <filter>
          <filter-name>UserPreferencesFilter</filter-name>
          <filter-class>org.kuali.rice.kew.web.UserPreferencesFilter</filter-class>
        </filter>
      
        ${monitoring.mapping}
    3. You need to add the following to your web.xml:
      ${monitoring.listener}
      
        <listener>
          <listener-class>org.kuali.rice.krad.web.session.NonSerializableSessionListener</listener-class>
        </listener>
    4. If you haven't already, set the following in your *kfs-build.properties*
      institution.build.properties.file=build/properties/<your institution>-build.properties
      institution.configuration.properties.file=build/properties/<your institution>-configuration.properties

    3 Setup Spring Configuration

    Add the following to core/impl/src/main/resources/org/kuali/rice/core/CommonSpringBeans.xml:
    
    
      ${monitoring.spring.service}

    4 Prepare for Deployment

    Now you just use:
    mvn -Pmonitoring clean install
    The above will build your distribution of rice with javamelody turned on.

    The Results

    You should see something like this