Update of
/cvsroot/jicarilla/jicarilla-sandbox/platform/container/impl/src/java/com/leosimons/jicarilla/container
In directory
sc8-pr-cvs1:/tmp/cvs-serv27012/platform/container/impl/src/java/com/leosimons/jicarilla/container
Modified Files:
ClassUtil.java
Log Message:
reference new avalon package
Index: ClassUtil.java
===================================================================
RCS file:
/cvsroot/jicarilla/jicarilla-sandbox/platform/container/impl/src/java/com/leosimons/jicarilla/container/ClassUtil.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- ClassUtil.java 30 Dec 2003 20:44:01 -0000 1.4
+++ ClassUtil.java 30 Dec 2003 21:23:15 -0000 1.5
@@ -26,6 +26,8 @@
package com.leosimons.jicarilla.container;
import com.leosimons.jicarilla.framework.Assert;
+import
com.leosimons.jicarilla.container.integration.avalon.JicarillaBasedAvalonContext;
+import
com.leosimons.jicarilla.container.integration.avalon.JicarillaBasedAvalonServiceManager;
import com.thoughtworks.xstream.XStream;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
@@ -33,11 +35,9 @@
import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
import org.apache.avalon.framework.container.ContainerUtil;
import org.apache.avalon.framework.context.Context;
-import org.apache.avalon.framework.context.ContextException;
import org.apache.avalon.framework.logger.ConsoleLogger;
import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.avalon.framework.service.ServiceException;
import org.apache.avalon.framework.service.ServiceManager;
import org.xml.sax.SAXException;
@@ -56,6 +56,8 @@
import java.util.Set;
/**
+ * This is the big fat ugly class full of introspection magic.
+ *
* @author <a href="mail at leosimons dot com">Leo Simons</a>
* @version $Id$
*/
@@ -309,12 +311,12 @@
protected static Context getContext( Container container )
{
- return new ClassUtil.JicarillaContainerContext( container );
+ return new JicarillaBasedAvalonContext( container );
}
protected static ServiceManager getServiceManager( Container container )
{
- return new JicarillaContainerServiceManager( container );
+ return new JicarillaBasedAvalonServiceManager( container );
}
protected static Configuration getConfiguration( Container container,
String className )
@@ -396,84 +398,4 @@
}
return instance;
}
-
- protected static class JicarillaContainerContext implements Context
- {
- protected Container m_container;
-
- public JicarillaContainerContext( Container container )
- {
- m_container = container;
- }
-
- public Object get( Object key ) throws ContextException
- {
- if( key == null )
- throw new ContextException( "No value exists for key 'null'" );
-
- Object result = null;
- try
- {
- result = m_container.get( key );
- }
- catch( Exception e )
- {
- throw new ContextException(
- "Unable to get " + key.toString() + "from the
context", e );
- }
-
- if( result == null )
- throw new ContextException( "No value exists for key " +
key.toString() );
-
- return result;
- }
- }
-
- /** @todo figure out how to detect cyclic dependencies here */
- protected static class JicarillaContainerServiceManager implements
ServiceManager
- {
- protected Container m_container;
-
- public JicarillaContainerServiceManager( Container container )
- {
- m_container = container;
- }
-
- public Object lookup( String key ) throws ServiceException
- {
- if( key == null )
- throw new ServiceException( key, "No value exists for key
'null'" );
-
- Object result = null;
- try
- {
- result = m_container.get( key );
- }
- catch( Exception e )
- {
- throw new ServiceException( key,
- "Unable to get " + key + "from the ServiceManager", e
);
- }
-
- if( result == null )
- throw new ServiceException( key, "No value exists for key " +
key.toString() );
-
- return result;
- }
-
- public boolean hasService( String key )
- {
- return m_container.contains( key );
- }
-
- public void release( Object component )
- {
- try
- {
- m_container.release( component );
- }
- catch( Exception e ) {}
- }
- }
-
}
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
|