On Thursday, February 13, 2003, at 05:16 AM, J Aaron Farr wrote:
I do have a <cache> entry in my *.xconf file
since it seems that if I don't, there's no other way to get the
DefaultContainer to start up the cache component (is there another way?).
You have to declare all components that you will use in your xconf file
Cache doesn't implement configurable as far as I know, so I just have dummy
info there. This seems like a hack, so what's the proper way to initialize
something that doesn't take a Configuration or Parameters?
just put <cache/> in your xconf, no nested elements required.
(why doesn't Cache have a public ROLE variable?)I don't believe that the cache was designed to be used directly. Rather, create a simple component of your own that wraps the cache (this is what I have done). Since there are several ways to put the cache components together, it is easier if you assemble them in the pattern that is needed for your application.
However, the container throws errors when it tries to start the cache
component:
ERROR 2003-02-13 05:08:38.927 [fortress.system.handler.] (): Unable to create
new instance
java.lang.InstantiationException: org.apache.excalibur.cache.impl.DefaultCache
public interface MyCache
{
String ROLE = MyCache.class.getName();
Object get( String key ); // or you can have it return something more specific than object, depending on your use case
Object store( String key );
}
public class MyCacheImpl extends AbstractLogEnabled implements MyCache, Initializable, Configurable
{
private final int m_cacheSize;
public void configure( Configuration c ) throws ConfigurationException
{
m_cacheSize = c.getChild("cache-size").getValueAsInteger(100);
}
public void initialize() throws Exception
{
//create the cache here
}
//etc
}
-pete
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
