Re: LoggerStore

Peter Donald <peter-4lf8KW9E9MLMqX/[email protected]>
Newsgroups gmane.comp.java.spice.devel
Message-ID <[email protected]>
Hi,

I just did some reworking of the code. Can you have a look and see if you 
like? The one significant thing I have done is introduce a new class 
InitialLoggerStoreFactory. It acts in a manner similar to JNDIs 
InitialContext. So you use it like the following

If you want to fully specify all the input parameters;

final HashMap data = new HashMap();
data.put( InitialLoggerStoreFactory.INITIAL_FACTORY,
          "org.realityforge.loggerstore.LogKitLoggerStoreFactory" );
data.put( LoggerStoreFactory.FILE_LOCATION, "/opt/data/logconfig.xml" );

final InitialLoggerStoreFactory factory = new InitialLoggerStoreFactory();
return factory.createLoggerStore( data );

Alternatively you can put these two parameters into a file named

META-INF/spice/loggerstore.properties
org.realityforge.loggerstore.factory=org.realityforge.loggerstore.LogKitLoggerStoreFactory
org.realityforge.loggerstore.file=/opt/data/logconfig.xml

And then later just do 

final InitialLoggerStoreFactory factory = new InitialLoggerStoreFactory();
return factory.createLoggerStore( new HashMap() );

The set of properties available atm include;
org.realityforge.loggerstore.factory
org.realityforge.loggerstore.file
org.realityforge.loggerstore.url
org.realityforge.loggerstore.log4j.type

And you can also pass in non-string values such as W3C Element or Avalon 
Configuration, ClassLoaders etc. These are all passed in using name of class. 
SO you end up with keys like the following for the coresponding objects;

java.lang.ClassLoader
java.io.InputStream
org.w3c.dom.Element
org.apache.avalon.framework.configuration.Configuration

Thoughts?

-- 
Cheers,

Peter Donald	
*-------------------------------------------*
| "You can't depend on your eyes when your  |
| imagination is out of focus." -Mark Twain |
*-------------------------------------------*



-------------------------------------------------------
This SF.net email is sponsored by: ObjectStore.
If flattening out C++ or Java code to make your application fit in a
relational database is painful, don't do it! Check out ObjectStore.
Now part of Progress Software. http://www.objectstore.net/sourceforge
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.