maandag 9 mei 2011

Updates incoming in 3.6

Hi all,

version 3.6 of SennMagic is currently in the making and there's some nice new stuff in there!

AutowiredHttpServlet: an HttpServlet that allows your Spring beans to be automatically injected if you annotate them with the Spring @Autowired annotation.

The Directory class has been retrofitted to extend  Some methods have been removed to avoid duplicate methods with

The Chainable Collections API has some new stuff aswell! 

First of all, the implementations have been changed so they return their own implementation instead of the interface.  This way specific implementation methods can be added to the end of the chain if needed.
For example in ChainableHashMap:

public ChainableMap<K, V> add(K key, V value) {...}

has been changed to:

public ChainableHashMap<K, V> add(K key, V value) {...}

Second, I've added ChainableVector and ChainableHashtable to the CCA.

And as always methods have been added to various existing classes.

Stay tuned!


zondag 23 januari 2011

Not dead but very much alive!

It's been a while since I updated anything on the SennMagic project, but here it is!

Version 3.5 has some minor changes and additions in existing classes (DFCUtils, GeneralUtils) but most importantly:
The 'chainable' collections api!

Don't you just hate it when you are instantiating objects and you have to pass a Collection instance and you can't do it in one line because the collection needs one or more items in it, like this:

car.setPassengers(new ArrayList<Passenger>()); // you can only add an empty list
//so you have to do:
List<Passenger> passengers = new ArrayList<Passenger>();
passengers.add(new Passenger("Bart"));

That's all in the past with the chainable collections api!

The chainable collections api has extra methods (with very recognizable, straightforward names) to add/remove/replace items in the collections, but instead of the normal return value, it returns the collection itself.  This enables you to 'chain' actions like this:

//same as previous example:
car.setPassengers(new ChainableArrayList<Passenger>().put(new Passenger("Bart")));

I have created implementations for the most commonly used collections (+maps):
  • ChainableList extends List
    • ChainableArrayList extends ArrayList implements ChainableList
    • ChainableLinkedList extends LinkedList implements ChainableList
  • ChainableMap extends Map
    • ChainableHashMap extends HashMap implements ChainableMap
    • ChainableLinkedHashMap extends LinkedHashMap implements ChainableMap
    • ChainableTreeMap extends TreeMap implements ChainableMap
  • ChainableQueue extends Queue
    • ChainablePriorityQueue extends PriorityQueue implements ChainableQueue
  • ChainableSet extends Set
    • ChainableHashSet extends HashSet implements ChainableSet
    • ChainableLinkedHashSet extends LinkedHashSet implements ChainableSet
    • ChainableTreeSet extends TreeSet implements ChainableSet
It's already proven to be quite handy, especially when creating unit tests, in multiple projects, by multiple developers.

Get it while it's still hot! 


donderdag 6 mei 2010

New version! Focus on Java Reflection

Hello young ,and less young, padawans

I was gathering stuff to put in my next release, but it was nothing mind-boggling.
Until a couple of days ago...

I was trying to create a method that would be able to call an SBO (Documentum Service-Based Business Object) without having to import the SBO-interface and having to add the jar to my classpath.

I know this can easily be done using Java Reflection, but the problem was: I wanted to create one method to call any SBO.

Something like this:

public Object callSBO(String sboName, String methodName, Object... args){...}

Now, that isn't such a hard thing to do.
  1. Get the SBO-service
  2. use Reflection to get the method and invoke it
That is, when all your arguments are Objects!

I came across the problem of calling an SBO that takes an int value + some Objects.
The problem is that Java reflection wraps an int-value into an Integer to be able to put it in a Object-array.
Since we don't want to pass both an Object[] array and the corresponding Class[] array, we have to create the Class-array on the fly.
So we start with 2 ints, and unwillingly end up with 2 Integers.

Now I don't know if you have ever tried calling a function that takes int-values with Integer values through reflection, but I can assure you, it results in nice NoSuchMethodExceptions.

As a possible solution I tried to replace all primitive-wrappers-classes in the Class-array with primitive-classes, but what if you ever come across a method like this:
public void foo(int i, String s, Double d){...}

Ye, I know, functions that mix primitives with wrappers are rare, but exist nonetheless!  So ignoring that possibility would be a bad choice.
That left me with 2 options:
  1. Also pass an array with the corresponding classes to the method (no way!)
  2. Work some MAGIC 
I obviously decided to choose the latter, and I'll present it soon!

It's easy to use, just pass a Class/Object, methodName and an array of Objects to the method (as varArgs), and let SennMagic decide which values should be primitive and which should be wrappers.

I created the method to able to use in any case, and I also added a specific method callService(...) to DFCUtils.  

Now you can call any SBO without having to add the jar to the classpath of the (web)application.

Till soon...


dinsdag 13 april 2010

DFC with multiple files

UPDATED: I have called quits on this little sideproject.  It was working ok-ish, but it was not performant enough and I just couldn't bring myself to make this work.
Source code can be handed out if you'd like to give it a try.

For now I'll just focus (lol) on the SennMagic library

I developed a small Java package that allows you to code a DFC based application that uses multiple files.

I'm still in the testing phase, but if you want to try it out (and help me test it) you can contact me and ask for the package.

It has to be tested in
- various OS's
- different Documentum setups (Oracle, SQL Server)
- single- & multithreaded DFC apps (this might show us a few bugs)
- webapps

You can contact me through
- replying here
- mail
- twitter
- EMC Community Forums

Use "SennMagic DFC" as subject.


EDIT: to avoid confusion: this jar cannot be found on our SourceForge page yet!

woensdag 31 maart 2010


I fixed the bug in CountryUtils!

You can find the updated version of SennMagic at SourceFourge!


donderdag 25 maart 2010

Bug in CountryUtils

Hello all,

I discovered that a there's a bug in CountryUtils.
It can't find the country_codes.xml file.

I'll fix this asap!

For the time being, if you want to use CountryUtils, place the resources-folder (found in in the root of your application.

My apologies!


woensdag 3 maart 2010

SM 3.2 released! And how!!!

Hi everybody,

it's been a while since the last version, but here it is!


A whole lot has been added since 3.1!

  • com.senn.magic.util.WebUtils
  • com.senn.magic.util.CountryUtils
  • com.senn.magic.util.DSUtils
And ofcourse, many methods added to the existing classes!

Check out the javadoc and release notes for more info!

As always you can find it @ our sourceforge page