Skip to Content.
Sympa Menu

grouper-dev - RE: [grouper-dev] Action Items from Grouper Call 6-June-08

Subject: Grouper Developers Forum

List archive

RE: [grouper-dev] Action Items from Grouper Call 6-June-08


Chronological Thread 
  • From: Chris Hyzer <>
  • To: Emily Eisbruch <>, "" <>
  • Subject: RE: [grouper-dev] Action Items from Grouper Call 6-June-08
  • Date: Thu, 12 Jun 2008 03:20:12 -0400
  • Accept-language: en-US
  • Acceptlanguage: en-US


>
> [AI] {Chris} will add a hook veto exception field to the proposed
> design
> for hooks.

That's done, no problem. There is one veto exception, and the type of veto
is inside, configured automatically if not manually... Also, I added an
attribute list if there is more data to pass with veto

> [AI] {Chris} will look at using ehcache for hook implementation.
> http://ehcache.sourceforge.net/

That's done too. I made Jira GRP-133 to keep this documentation somewhere.
I got rid of my home-made cache, and now use ehcache. I think there are some
deficiencies with ehcache, but I wrapped it in GrouperCache, so now it is
tip-top. Some features:

- Java5 generic so its easy to tell the types of whats in the cache and easy
to retrieve values
- dont have to deal with "Element" return values. The cache should act like
a Map. (there is a reference in GrouperCache to the Cache object so if you
want to get additional info you can)
- singleton controller in EhcacheController if there are utility / global
caches
- sometimes I think we can have a default cache config hardcoded in java and
not require everything in the grouper.ehcache.xml file (e.g. Method objects
in GrouperUtil). I think it is kind of a pain to get everyone to have to
update their config file, and if we change defaults, then they have to update
their defaults. So now the defaults can be specified in Java, and can be
overridden in the config. The cache name and default settings are logged to
"info" level so people can know what to override.
- we can very easily fix bug GRP-130 by replacing the map with a GrouperCache
since it acts like a map and can use default if we like, or add a config to
the config file.

Here is the test case to illustrate this:

/*
* @author mchyzer
* $Id: GrouperCacheTest.java,v 1.1.2.1 2008/06/12 07:10:12 mchyzer Exp $
*/
package edu.internet2.middleware.grouper.util;

import edu.internet2.middleware.grouper.cache.EhcacheController;
import junit.framework.TestCase;


/**
* test grouper cache
*/
public class GrouperCacheTest extends TestCase {

/**
* @param name
*/
public GrouperCacheTest(String name) {
super(name);
}

/**
* test the cache
*/
public void testCache() {

String name =
"edu.internet2.middleware.grouper.util.GrouperCacheTest.testCache";
GrouperCache<String, Object> grouperCache =
new GrouperCache<String, Object>(name,
1000, false, 1, 1, false);
Object value = new Object();
String key = "test";
grouperCache.put(key, value);
assertTrue("references should be the same", value==grouperCache.get(key));

//get this again from factory to be sure
grouperCache = (GrouperCache<String,
Object>)EhcacheController.ehcacheController().getGrouperCache(name);

assertTrue("references should still be the same",
value==grouperCache.get(key));

//wait 1.5 seconds and it should expire
GrouperUtil.sleep(1500);

assertNull("wait 1.5 seconds and it should expire",
grouperCache.get(key));

//here is a cache that should exist... and shouldnt fail
new GrouperCache("edu.internet2.middleware.grouper.Membership.getGroup");

//here is a cache that doesnt exist and should fail
try {
new GrouperCache("isntConfigured");
fail("An unconfigured cache with no defaults should fail construction");
} catch (IllegalStateException ise) {
//good
}
}

}







Archive powered by MHonArc 2.6.16.

Top of Page