Vanity Foul
Dedicated to the wanderings of an egotistical mind.


20030223
Sunday February 23, 2003

JXPath success!

I figured out the syntax by adding a UnitTest to BoomarkManager and using trial-and-error:
// folder2 is test data already added to the Prevayler datastore
JXPathContext context = JXPathContext.newContext(bookmarkMgr);
FolderData folder = (FolderData)context.getValue("folders/*[name='TestFolder2']");
assertEquals(folder, folder2);
This successfully looks in the HashMap of folders and finds the one with a name equal to "TestFolder2" and returns that one.
( Feb 23 2003, 01:59:42 PM ) Technology Permalink Comments [1]
Trackback: http://www.brainopolis.com/roller/trackback/lance/Weblog/jxpath_success

Re: Argh, I'm infected!

While I am infected, it hasn't progressed to the point of writing UnitTests first. That is how all the "terminally infected" say it should be done, but I'm one of those people who has to learn lessons the hard way, most times. Whether you're interested or not, I'll post my progress/descent into TDD (TestDrivenDevelopment) as it occurs.
( Feb 23 2003, 09:47:27 AM ) Technology Permalink [Link]
Trackback: http://www.brainopolis.com/roller/trackback/lance/Weblog/re_argh_i_m_infected

More on Prevayler

It's hard to describe a code/framework problem in prose, and my last post demonstrates that difficulty splendidly. I'll try for a more detailed description.

It's hard to describe, and once I get further I plan on checking the code into Roller's CVS, but by then it won't exhibit the problems. The issue I had was that each method of my "manager" class was creating its own Prevayler from itself: new Prevayler(this) as Manager is a subclass of AbstractPrevaylerSystem.

In my test classes each test case was calling a method in the Manager. I don't recall the exact error, but it took some puzzling to figure that Manager should just create an instance of Prevayler at instantiation and pass that one instance to each Command. The demo's and articles don't adequately demonstrate how Prevayler and PrevaylerSystem are to be used: the article at developerWorks doesn't even show us the System subclass...

The second problem I ran into will require naming problem code. A method in BookmarkManager named moveFolderContents transfers all bookmarks from Folder A to Folder B. Also in BookmarkManager is a method moveBookmark which just moves one bookmark from its current folder to another. In MoveFolderContentsCommand execute() it seemed obvious to me that I could iterate over the bookmarks in A, calling bookmarkMgr.moveBookmark(bookmark, folderB) which would "delegate" to MoveBookmarkCommand. Again, I don't recall the exact error message (something about the SystemClock I think) but Prevayler didn't like this. I copy-pasted the relevant code from MoveBookmarkCommand into MoveFolderContentsCommand and it worked fine.

One last note, it isn't clear from the Prayler site/articles/demo that "read" operations do/not have to go through a Command as well. I had some trouble early on and made all my read operations Commands. Later I realized this may not be necessary, refactored, and it wasn't necessary.

My next task is to explore using JXPath so that I can do the more complicated "queries" necessary to lookup weblogentries for past dates (and other such "non-id" queries). Stayed tuned for more frustrations and griping...
( Feb 23 2003, 09:42:37 AM ) Technology Permalink [Link]
Trackback: http://www.brainopolis.com/roller/trackback/lance/Weblog/more_on_prevayler

For further reading on today's posts:



20030222
Saturday February 22, 2003

Prevayler is touchy

I'm playing with writing Roller's persistence layer using Prevayler, and have found some "cautions" with regards to the PrevaylerSystem: If you create more than one Prevayler instance using the same PrevaylerSystem it'll be unhappy. If one of your Commands makes use of another method in the business class that calls its own Command - Prevayler will be unhappy. I ran into these issues while trying to get my UnitTests to pass, but the output was less than clear on what the problem was (why Prevayler was unhappy).

Be warned, and be cautious.
( Feb 22 2003, 06:32:47 PM ) Technology Permalink Comments [3]
Trackback: http://www.brainopolis.com/roller/trackback/lance/Weblog/prevayler_is_touchy



20030220
Thursday February 20, 2003

Roller and GPL

The email linked from here suggests that we'll have to remove any GPL jars from Roller. Or get a release from the authors of any GPL jars we're using. It isn't quite as clear on LGPL - which covers the Ekit editor, Flock and the Jazzy spellchecker. The opinion expressed in the email suggests that LGPL isn't viral.

Everything else seems to be in the clear (BSD/Apache style licenses). MySQL is GPL, but this would seem to be an even more tenuous bind.
( Feb 20 2003, 08:32:00 PM ) Roller Permalink Comments [4]
Trackback: http://www.brainopolis.com/roller/trackback/lance/Weblog/roller_and_gpl

Argh, I'm Infected!

With the current project at work of moving to Weblogic 7 necessitating moving a data repository to LDAP a new library was needed. I took this opportunity to teach myself the use of JUnit, and now I'm hooked!
( Feb 20 2003, 12:03:31 PM ) Technology Permalink Comments [4]
Trackback: http://www.brainopolis.com/roller/trackback/lance/Weblog/argh_i_m_infected



20030218
Tuesday February 18, 2003

MS Third Degree

Oops, meant Three Degrees. Neat idea (I have a 10 year old, who asked me yesterday for her own blog), and given the libraries already existant in Java it looks pretty easy to replicate.
What's the proper format for a TrackBack link, this one returns an error?
( Feb 18 2003, 01:43:24 PM ) Technology Permalink
Trackback: http://www.brainopolis.com/roller/trackback/lance/Weblog/ms_third_degree

Hacking Log 2.0 Sux

Disclaimer: I did create this blog just to play with Andy. He takes himself so seriously, yet welcomes abuse. I thought I'd oblige him. Please post comments there, join in the fun.
( Feb 18 2003, 08:00:00 AM ) Entertainment Permalink Comments [4]
Trackback: http://www.brainopolis.com/roller/trackback/lance/Weblog/hacking_log_2_0_sux

For further reading on today's posts:




archives
links