Tom's Blog
Installing Groovy from RPM on Fedora
Published by Tom |
March 21, 2009 06:11 PM EST |
I installed Groovy 1.6 on Fedora from an RPM as offered on the
Groovy download
page and immediately got an exception stack trace when running groovysh or groovyConsole.
I installed the groovy-1.6.0-2.noarch.rpm file,
kindly packaged by Federico Pedemonte,
then tried to run groovyConsole:
[tom@dev ~]$ groovyConsole Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/groovy/tools/GroovyStarter Caused by: java.lang.ClassNotFoundException: org.codehaus.groovy.tools.GroovyStarter at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) Could not find the main class: org.codehaus.groovy.tools.GroovyStarter. Program will exit.I then tried to run groovysh with no better luck:
[tom@dev ~]$ groovysh Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/groovy/tools/GroovyStarter Caused by: java.lang.ClassNotFoundException: org.codehaus.groovy.tools.GroovyStarter at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) Could not find the main class: org.codehaus.groovy.tools.GroovyStarter. Program will exit.The problem turned out to be quite simple to solve: a missing GROOVY_HOME. The packager adds the environment variable GROOVY_HOME to the shell by adding the file /etc/profile.d/groovy.sh so bash picks it up at startup via the /etc/profile script, but my current shell hadn't had a chance to read in that file yet.
The solution was as easy as exiting and starting a new shell, or manually setting:
[tom@dev ~]$ export GROOVY_HOME=/usr/share/groovy [tom@dev ~]$ groovyConsoleand everything works.
Saturday March 21, 2009 Permalink
Comments [0]
How to modify the Alfresco Share page footer
Published by Tom |
March 18, 2009 09:18 AM EST |
Share is Alfresco Software's open source collaboration server.
It's a Java web application that stands as a free competitor to Microsoft
SharePoint.
Since I
wrote earlier
this month about how to modify the default footer text
in the Alfresco content management server's web client,
I thought I'd follow up with even simpler instructions on how to modify
the global footer in
Alfresco Share.
You don't even need to stop and restart the web application server
for this modification.
Share is part of the open source Alfresco Labs 3 and the commercial Alfresco Enterprise Edition enterprise content management server and is built using Alfresco's Surf web framework. The Share application comes fully functional out of the box (more precisely, out of the share.war file). But it also is highly customizable with a little HTML, JavaScript and FreeMarker script modifications or additions. Thus, the default footer text in Share is much easier to modify than it is in the Alfresco web client I wrote about earlier.
The web client, which is a JavaServer Faces application, embeds the footer text inside a Java tag library inside a JAR file inside the
alfresco.war
file.
You need the source code and a JDK to modify the global footer text.
The Share web application,
more simply,
places its footer text inside a properties file inside the
share.war file,
which you can customize with a plain text editor.
If you deploy Share as a WAR file instead of an exploded WAR,
you'll need to unzip the WAR, edit the text file, then rezip.
But that's about as complex as this change gets.
To customize the footer text for Share, unzip the
share.war
file if necessary to a directory of your choosing
or just find the exploded WAR file you have currently deployed.
If you run Share on Tomcat,
your deployed Share application likely is in the directory
$CATALINA_HOME/webapps/share
(or
%CATALINA_HOME%\webapps\share
under Windows).
The file to modify is in the directory
WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/footer
called
footer.get.properties.
On my version of Alfresco Share,
this default footer file looks like this (but all on one line):
label.copyright=Supplied free of charge with <a href='http://www.alfresco.com/services/support/communityterms/#support'>no support</a>, <a href='http://www.alfresco.com/services/support/communityterms/#certification'>no certification</a>, <a href='http://www.alfresco.com/services/support/communityterms/#maintenance'>no maintenance</a>, <a href='http://www.alfresco.com/services/support/communityterms/#warranty'>no warranty</a> and <a href='http://www.alfresco.com/services/support/communityterms/#indemnity'>no indemnity</a> by <a href='http://www.alfresco.com'>Alfresco</a> or its <a href='http://www.alfresco.com/partners/'>Certified Partners</a>. <a href='http://www.alfresco.com/services/support/'>Click here for support</a>.<br /> Alfresco Software Inc. © 2008-2009 All rights reserved.This text gets rendered on every Share page as a footer that looks like this:
You can see why someone might want to change this global footer text.
Change the text to anything you like and save
footer.get.properties
file.
Mine now says:
label.copyright=Alfresco Software Inc. © 2008-2009 All rights reserved.
To see your change,
you can either restart your web application server if no one is using Share,
or you can tell Share to refresh its web components cache without inconveniencing anyone
currently using the server.
Here's how.
Login to Share as the "admin" user and visit the service
/share/service
path of the Share application.
If you are running Share on your Tomcat local server,
the path is probably
http://localhost:8080/share/service/.
This page will have a button at the bottom labeled "Refresh Web Scripts".
Click it,
and your footer text change should be loaded the next time the footer component script is called.
Ahh. Much better.
If you build Share from source, you can make your footer text change there by making the change to the "slingshot" project. That apparently was the earlier name of the Share application. The file is
config/alfresco/site-webscripts/org/alfresco/components/footer/footer.get.properties
Making this footer change might whet your appetite for making other customizations to your Share application. The Surf component framework makes customization fairly easy once you get the hang of how Surf works. By being able to see your changes quickly by interactively refreshing the web scripts rather than restarting the server, your feedback comes quickly.
Wednesday March 18, 2009 Permalink
Comments [0]
Google doesn't trust itself when it comes to spam
Published by Tom |
March 12, 2009 02:46 PM EST |
I created a
Google Alerts to be sent daily to my
Google mail account.
I received daily emails for a week,
then one day it stopped.
Turns out Gmail filtered the Google alert to the Spam folder.
When it comes to spam, Google doesn't even trust itself.
Thursday March 12, 2009 Permalink
Comments [2]
How to get rid of the Alfresco Labs default page footer
Published by Tom |
March 04, 2009 02:01 PM EST |
The web client for the open source
Alfresco
enterprise content management server
ships with a footer that is added to every webpage via a JSP tag.
The footer blends marketing and usage tracking with a copyright statement.
It can be annoying to see on every page,
especially if you are using the web client internally.
The web client footer looks like this (from a clipped screen capture):
The footer says:
Supplied free of charge with no support, no certification, no maintenance, no warranty and no indemnity by Alfresco or its Certified Partners. Click here for support. Alfresco Software Inc. © 2005-2009 All rights reserved.The footer includes Alfresco's logo by reading an image from the Alfresco website. This image is called a web bug, or beacon, and Alfresco can use the image request to their server to help track who is using Alfresco. The footer's underlined text links to pages on the alfresco.com website to provide warnings that the Labs version of Alfresco is not supported by Alfresco Software Inc. The right-side graphic links you to Alfresco's SourceForge download site.
Except for the web beacon image, I don't fault Alfresco Software for adding the footer to its web client. Alfresco Labs is a powerful -- free -- and flexible product. If used within an organization, it is not a bad thing that users are made aware that the product is not the supported Enterprise version. However, since I am using Alfresco on an internal website, and plan to customize the various JSP pages, displaying the warning on every one of my pages seems overkill and unnecessary. And I could do without sending tracking statistics to Alfresco Software.
Removing the global footer isn't a simple process, but it is pretty straightforward. The removal should be as simple as editing a globally included text file. Instead, those clever developers at Alfresco embedded the footer text into a fairly useful JSP tag. This
<r:page>
JSP tag outputs the skeletal HTML page tags,
and includes HTML to pull in global scripts and cascading stylesheets.
It also includes code that can log how long it took Alfresco to build the JSP page.
To remove the footer from your web pages,
you need either to stop using the
r:page
tag or recompile the page tag to set the text to what you would like,
which is what the instructions below cover.
Recompiling the
r:page
tag that lives in the Alfresco web client JAR file isn't complicated.
Assuming you already are using the Alfresco Labs 3 web application,
the process should take you a half hour or less,
with most of that time spent downloading and compiling code.
Overview
The steps below show you how to obtain the complete source code to Alfresco, make the necessary change to the Java page tag code, rebuild the web client JAR file, then replace the existing JAR file in your Alfresco server with the newly built one.
Prerequisites: You must have a Java compiler, a Subversion client, Apache Ant, and be able to use the command line. For Windows users without Subversion, you can install the SlikSVN client. Others can find a link to download a Subversion client from CollabNet's Tigris.org.
Instructions
Here are the steps to rebuild the Alfresco web client with the altered JSP page tag. (You should be able to cut and paste these lines onto your command line if you remove the prompt character.)
- Create an empty directory for the source code
% mkdir alfresco-labs % cd alfresco-labs - Use Subversion to download the Alfresco Labs source code
% svn co svn://svn.alfresco.com/alfresco/HEADor use the http protocol if you have internal firewall issues:% svn co http://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/HEADThesvncommand will connect to the Alfresco Subversion repository and copy each of the files in the HEAD branch into your local directory. Total download size will be about 734MB. Depending on the speed of your connection, this might be a good time to get coffee, have lunch, check your email. If the Subversion URL doesn't work, check this page to see if Alfresco has changed the repository location.
- Edit
PageTag.javato change/remove the page footer text
ThePageTag.javafile you want to edit is in the directoryHEAD/root/projects/web-client/source/java/org/alfresco/web/ui/repo/tag. The commands below will edit the file in Notepad for Windows or vi for Unix/Mac users. But you also can just navigate to the folder and edit the file with any editor.
For Windows:% notepad HEAD\root\projects\web-client\source\java\org\alfresco\web\ui\repo\tag\PageTag.javaFor Unix variants:$ vi HEAD/root/projects/web-client/source/java/org/alfresco/web/ui/repo/tag/PageTag.javaAt this point, you can decide what you want your new page footer text to say. The quickest edit is to completely remove all footer contents by changing line 115:private static String alfresco = null;to:private static String alfresco = "";Why this works is that staticalfrescovariable holds the contents of the page footer HTML (images and text), which is output by the overridden JSP tag library methoddoEndTag. If thealfrescovariable is null, which it is the first time the code is run, thedoEndTagmethod calls a private helper method,getAlfrescoButton, to populate it.
If you want to change the footer text to something of your own choosing, or perhaps you want to retain the Alfresco copyright notice because you won't be changing the web client's look and feel, you will want either to set thealfrescovariable to the text of your choosing, or edit thegetAlfrescoButtonmethod and/or some of the variables it uses to build up the footer text.
For example, if you want to retain the copyright statement but remove the warning text, edit theALF_COPYconstant on lines 103-112 to remove the text you don't want:private final static String ALF_COPY = "Supplied free of charge with " + "<a class='footer' href='http://www.alfresco.com/services/support/communityterms/#support'>no support</a>, " + "<a class='footer' href='http://www.alfresco.com/services/support/communityterms/#certification'>no certification</a>, " + "<a class='footer' href='http://www.alfresco.com/services/support/communityterms/#maintenance'>no maintenance</a>, " + "<a class='footer' href='http://www.alfresco.com/services/support/communityterms/#warranty'>no warranty</a> and " + "<a class='footer' href='http://www.alfresco.com/services/support/communityterms/#indemnity'>no indemnity</a> by " + "<a class='footer' href='http://www.alfresco.com'>Alfresco</a> or its " + "<a class='footer' href='http://www.alfresco.com/partners/'>Certified Partners</a>. " + "<a class='footer' href='http://www.alfresco.com/services/support/'>Click here for support</a>. " + "Alfresco Software Inc. © 2005-2009 All rights reserved.";If you want to keep some of the text but remove the web beacon image or SourceForge graphic, you will need to edit thegetAlfrescoButtonmethod or set thealfrescovariable as discussed previously.
Fortunately, thegetAlfrescoButtonmethod does not add structural HTML text to the footer, so setting thealfrescovariable directly with your chosen text is a viable option. If you use HTTPS on your website and you want to use an image in your footer, have a look at the technique used in thegetAlfrescoButtonmethod to change the image URL based on the request scheme. It's a handy way to avoid having web browsers complain about an encrypted page using non-encrypted components.
With the code edited, you are ready to rebuild Alfresco. - Rebuild the web client application
Here is where you need Ant. Use the build target to rebuild the project modules. The default target will attempt to deploy the rebuilt WAR file, so make sure to use the "build" target.
For Windows:% ant -f HEAD\root\build.xml buildFor Unix:$ ant -f HEAD/root/build.xml buildYou will see several warnings about the use of deprecated methods and the like. But the code should build correctly.
The Ant task should rebuild the Alfresco JAR files and the WAR file. The rebuiltalfresco-web-client.jarfile is the one that contains the repository JSP tag you want to replace. The Ant task creates this JAR file in the directoryHEAD/root/projects/web-client/build/dist. - Copy the alfresco-web-client.jar to your Alfresco webapp
Copy the JAR file to your exploded WAR file directory location under theWEB-INF/libdirectory. If you deploy Alfresco as WAR file rather than exploded WAR, you can use the fullalfresco.warfile that you also will find in theHEAD/root/projects/web-client/build/dist. directory.
Gone is the footer from this and all Alfresco web client pages.
Wednesday March 04, 2009 Permalink
Comments [10]
Weighing risks of storing files in a content management system
Published by Tom |
February 27, 2009 11:29 AM EST |
I was cleaning out a desk drawer last weekend and found a few old 3 1/2 inch floppy disks. The discovery made me realize that in order to read the data off those disks, I would have to pull the floppy drive from an old computer and install it in a functioning computer -- and hope the new computer had the appropriate data connector, or that I could find an adapter.
The discovery of the floppies, and the realization that the data couldn't easily be read, is parallel to a situation I face today as I debate moving my document and media files to a content management system. The risk today, just like with the floppy disks, is that I might end up storing important data in a format that later becomes unreadable.
I have been contemplating moving a bulk of my personal text files, and perhaps even multimedia files, to an Alfresco CMS running on my home server in order to access my documents conveniently from anywhere. I have been using Evernote to store text notes and web clips, and I looked at Google Docs as an option. Both are great services and dead-simple to manage, but these online services don't provide some of the conveniences of Alfresco.
Alfresco is a free, open source Java web application that is slowly becoming a Swiss army knife for managing content. One of Alfresco's compelling features is the wide variety of file-access protocols it offers to manipulate documents stored in its repository. Alfresco's documents can be accessed via its web client, Java APIs, and CMIS, sure. But more interesting for my current needs is that documents stored in Alfresco also can be read, written and deleted from other computers on the LAN using a CIFS/SMB shared drive, over the web using WebDAV, using NFS, and even FTP.
Because Alfresco can expose its managed content using so many industry-standard protocols, I thought storing my files inside Alfresco would make it easier for me to access my documents no matter where I was, without adding the need for a specialized client application or web connection. I could use a CIFS shared drive at home to access documents from any of my home computers. I could access the documents securely from work using WebDAV over SSL. And I could access documents from a friend's house by logging into my home server from a web browser using Alfresco's native web application. My documents would be stored at home, but also available "in the cloud." I could even use Alfresco's feature to emulate a SharePoint server to version and share my MS Word and other Office documents from Office applications.
Making my documents this accessible would be convenient and (on the geeky side of) cool. I do have a strong concern about whether I want to risk exposing my documents to Internet hackers. But the longer term concern is will I find myself wanting to access my files someday without using Alfresco? Will my content repository one day become the equivalent of a floppy disk?
The risk of storing data in a format that later becomes unreadable is not new, and the problem grows as more of our lives become digitized. I remember a few years ago hearing Grady Booch describe his work preserving seminal software for the Computer History Museum and his labor of love, the Handbook of Software Architecture. He mentioned that software that should be preserved for historical and educational reasons is sometimes stored in once-popular paper or magnetic formats that are difficult to read today. The Library of Congress has been concerned with what digital formats it should use in order to store its electronic archives.
Alfresco stores its content as regular files, which is good. However, those files are named using globally unique identifiers rather than the original file name. The stored documents are mixed with other files used by Alfresco for versioning and other purposes in a series of numbered subdirectories. Do I want to rely on Alfresco being the required middleman to give me the files I need? Using the digital media sustainability factors used by the Library of Congress to rate digital preservation, I would rate Alfresco's storage like this, with High meaning good for sustainability:
- Disclosure: High
The files are stored in your native format like ext3 or NTFS. Alfresco itself is open source, and it runs under Java, which can be run on nearly any modern operating system. - Adoption: Low
Despite Alfresco being powerful and free, the file organization and metadata formats are unique to Alfresco. - Transparency: High
Alfresco stores files as regular files, albeit buried within its own directory organization scheme, and the file metadata is stored in a relational database of your choosing. - Self-documentation: Low
Alfresco separates file contents from its metadata using a proprietary storage scheme. Reuniting the two requires Alfresco. - External dependencies: Medium-to-High
Retrieving file data with its metadata requires Java, a web application server, Alfresco, and the database used to store the metadata. Since I use the open source MySQL as my database, and all other dependencies are open source, the external dependencies can be easily assembled. But it would be a pain. - Impact of patents: High
I think all the technology needed to retrieve the data is unencumbered by patents. - Technical protection mechanisms: High
Alfresco's files are stored on the file system without alteration, so no translation or decryption is needed.
But, hmm, how to find that fire insurance policy while I'm at the local motel's shared lobby computer. Yes, it will be possible to find the file I need through search tools, or by opening the files one by one -- and in the case of binary image files, by changing the file extension from Alfresco's ".bin" to whatever format the file really contains so I can open it with the proper application. But getting my files out of the Alfresco repository, with the file name and directory structure with which the files are usable, will not be as easy as plugging the disk drive into someone else's computer and opening the file with a text editor. It will be in unexpected situations like this when I will have wished I had kept my files stored as regular files in regular directories and just used Samba.
That's where I am now, weighing the advantages of storing my files in a content management system versus the disadvantages and risks. I'm guessing many businesses go through this same struggle whenever they adopt a content management system for their documents. Once a company switches to a content management system, they must jump in with both feet and live with the benefits and problems of storing their documents inside an electronic vault controlled by a piece of non-standard software. At least with Alfresco, the process is reversible through its CIFS interface, and less scary because of its open source nature.
Maybe my solution will be to use Alfresco but to backup my content repository using the CIFS interface. That way, my backups are independent of Alfresco and I preserve the files with their original names and directory locations. I'd lose any extra Alfresco metadata stored with the files, any versioning, any software triggers or rules associated with the files. But I'd still enjoy Alfresco's benefits on my live file system. If you have faced and solved a similar situation when using a content management system, your comments are welcome.
Friday February 27, 2009 Permalink
Comments [0]


